/** This function is called whenever an entry in the general register * preferences group is changed. It does nothing more than kick off a * gui refresh which should be delivered to any open register page. * The register pages will then reread their preferences and * update the screen. * * @prefs Unused. * * @pref Unused. * * @user_data Unused. */ static void gnc_plugin_register2_pref_changed (gpointer prefs, gchar *pref, gpointer user_data) { ENTER(""); gnc_gui_refresh_all (); LEAVE(""); }
static void edit_clicked (CommoditiesDialog *cd) { gnc_commodity *commodity; commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree); if (commodity == NULL) return; if (gnc_ui_edit_commodity_modal (commodity, cd->dialog)) gnc_gui_refresh_all (); }
void gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data) { PricesDialog *pdb_dialog = data; SCM quotes_func; SCM book_scm; SCM scm_window; ENTER(" "); quotes_func = scm_c_eval_string ("gnc:book-add-quotes"); if (!scm_is_procedure (quotes_func)) { LEAVE(" no procedure"); return; } book_scm = gnc_book_to_scm (pdb_dialog->book); if (scm_is_true (scm_not (book_scm))) { LEAVE("no book"); return; } scm_window = SWIG_NewPointerObj(pdb_dialog->dialog, SWIG_TypeQuery("_p_GtkWidget"), 0); gnc_set_busy_cursor (NULL, TRUE); scm_call_2 (quotes_func, scm_window, book_scm); gnc_unset_busy_cursor (NULL); /* Without this, the summary bar on the accounts tab * won't reflect the new prices (bug #522095). */ gnc_gui_refresh_all (); LEAVE(" "); }
static void remove_clicked (CommoditiesDialog *cd) { GNCPriceDB *pdb; GList *prices; gboolean can_delete; gnc_commodity *commodity; GtkWidget *dialog; const gchar *message, *warning; gint response; commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree); if (commodity == NULL) return; AccountList_t accounts = gnc_account_get_descendants (gnc_book_get_root_account(cd->book)); can_delete = TRUE; for (AccountList_t::const_iterator node = accounts.begin(); node != accounts.end(); node++) { Account *account = *node; if (commodity == xaccAccountGetCommodity (account)) { can_delete = FALSE; break; } } /* FIXME check for transaction references */ if (!can_delete) { const char *message = _("That commodity is currently used by " "at least one of your accounts. You may " "not delete it."); gnc_warning_dialog (cd->dialog, "%s", message); return; } pdb = gnc_pricedb_get_db (cd->book); prices = gnc_pricedb_get_prices(pdb, commodity, NULL); if (prices) { message = _("This commodity has price quotes. Are " "you sure you want to delete the selected " "commodity and its price quotes?"); warning = "delete_commodity2"; } else { message = _("Are you sure you want to delete the " "selected commodity?"); warning = "delete_commodity"; } dialog = gtk_message_dialog_new(GTK_WINDOW(cd->dialog), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", _("Delete commodity?")); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", message); gtk_dialog_add_buttons(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_DELETE, GTK_RESPONSE_OK, (gchar *)NULL); response = gnc_dialog_run(GTK_DIALOG(dialog), warning); gtk_widget_destroy(dialog); if (response == GTK_RESPONSE_OK) { gnc_commodity_table *ct; ct = gnc_commodity_table_get_table (cd->book); for (GList *node = prices; node; node = node->next) gnc_pricedb_remove_price(pdb, node->data); gnc_commodity_table_remove (ct, commodity); gnc_commodity_destroy (commodity); commodity = NULL; } gnc_price_list_destroy(prices); gnc_gui_refresh_all (); }
static gboolean ap_close_period (GnomeDruidPage *druidpage, GtkWidget *druid, gpointer user_data) { AcctPeriodInfo *info = user_data; QofBook *closed_book = NULL, *current_book; const char *btitle; char *bnotes; Timespec closing_date; KvpFrame *book_frame; gboolean really_do_close_books = FALSE; ENTER("info=%p", info); current_book = gnc_get_current_book (); btitle = gtk_entry_get_text (info->book_title); bnotes = xxxgtk_textview_get_text (info->book_notes); PINFO("book title=%s\n", btitle); timespecFromTime_t (&closing_date, gnc_timet_get_day_end_gdate (&info->closing_date)); #define REALLY_DO_CLOSE_BOOKS #ifdef REALLY_DO_CLOSE_BOOKS really_do_close_books = TRUE; #endif /* REALLY_DO_CLOSE_BOOKS */ if (really_do_close_books) { /* Close the books ! */ qof_event_suspend (); gnc_suspend_gui_refresh (); scrub_all(); closed_book = gnc_book_close_period (current_book, closing_date, NULL, btitle); book_frame = qof_book_get_slots(closed_book); kvp_frame_set_str (book_frame, "/book/title", btitle); kvp_frame_set_str (book_frame, "/book/notes", bnotes); qof_session_add_book (gnc_get_current_session(), closed_book); /* We must save now; if we don't, and the user bails without saving, * then opening account balances will be incorrect, and this can only * lead to unhappiness. */ gnc_file_save (); gnc_resume_gui_refresh (); qof_event_resume (); gnc_gui_refresh_all (); /* resume above should have been enough ??? */ } g_free(bnotes); /* Report the status back to the user. */ info->close_status = 0; /* XXX fixme success or failure? */ /* Find the next closing date ... */ info->prev_closing_date = info->closing_date; recurrenceListNextInstance(info->period, &info->prev_closing_date, &info->closing_date); /* If the next closing date is in the future, then we are done. */ if (time(NULL) < gnc_timet_get_day_end_gdate (&info->closing_date)) { return FALSE; } /* Load up the GUI for the next closing period. */ gnc_frequency_setup_recurrence(info->period_menu, NULL, &info->closing_date); show_book_details (info); return TRUE; }