void gnc_totd_dialog (GtkWindow *parent, gboolean startup) { TotdDialog *totd_dialog; GtkBuilder *builder; GtkWidget *dialog, *button; GtkTextView *textview; gboolean show_tips; totd_dialog = g_new0 (TotdDialog, 1); show_tips = gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_SHOW_TIPS); if (startup && !show_tips) return; if (tip_count == -1) { if (!gnc_totd_initialize()) return; current_tip_number = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CURRENT_TIP); } if (gnc_forall_gui_components(DIALOG_TOTD_CM_CLASS, show_handler, NULL)) { return; } builder = gtk_builder_new(); gnc_builder_add_from_file (builder, "dialog-totd.glade", "totd_dialog"); dialog = GTK_WIDGET(gtk_builder_get_object (builder, "totd_dialog")); gtk_window_set_transient_for(GTK_WINDOW (dialog), parent); totd_dialog->dialog = dialog; ENTER("totd_dialog %p, dialog %p", totd_dialog, dialog); gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, totd_dialog); button = GTK_WIDGET(gtk_builder_get_object (builder, "show_checkbutton")); totd_dialog->showcheck_button = button; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (button), show_tips); textview = GTK_TEXT_VIEW(gtk_builder_get_object (builder, "tip_textview")); totd_dialog->textview = textview; gnc_new_tip_number(totd_dialog, 1); gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(totd_dialog->dialog)); gtk_widget_show(GTK_WIDGET (totd_dialog->dialog)); gnc_register_gui_component(DIALOG_TOTD_CM_CLASS, NULL, close_handler, totd_dialog); g_object_unref(G_OBJECT(builder)); LEAVE(""); }
const char *gnc_plugin_business_get_invoice_printreport(void) { int value = gnc_prefs_get_int (GNC_PREFS_GROUP_INVOICE, GNC_PREF_INV_PRINT_RPT); if (value >= 0 && value < 4) return invoice_printreport_values[value]; else return NULL; }
static time64 lookup_end_date_option(GDate *fy_end) { time64 time; int which; if (gnc_prefs_get_bool (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_CHOICE_ABS)) time = gnc_prefs_get_int64 (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_DATE); else { which = gnc_prefs_get_int(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_PERIOD); time = gnc_accounting_period_end_time64(which, fy_end, NULL); } if (time == 0) time = -1; return time; }
/* gnc_configure_date_format * sets dateFormat to the current value on the scheme side * * Args: Nothing * Returns: Nothing */ static void gnc_configure_date_format (void) { QofDateFormat df = gnc_prefs_get_int(GNC_PREFS_GROUP_GENERAL, GNC_PREF_DATE_FORMAT); /* Only a subset of the qof date formats is currently * supported for date entry. */ if ((df > QOF_DATE_FORMAT_LOCALE) || (df > QOF_DATE_FORMAT_LOCALE)) { PERR("Incorrect date format"); return; } qof_date_format_set(df); }
static time64 lookup_start_date_option(GDate *fy_end) { gchar *choice; time64 time; int which; if (gnc_prefs_get_bool (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_CHOICE_ABS)) time = gnc_prefs_get_int64 (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_DATE); else { which = gnc_prefs_get_int(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_PERIOD); time = gnc_accounting_period_start_time64(which, fy_end, NULL); } /* we will need the balance of the last transaction before the start date, so subtract 1 from start date */ /* CAS: we don't actually do what this comment says. I think that's because a bug in the engine has been fixed. */ return time; }
gint gnc_dialog_run (GtkDialog *dialog, const gchar *pref_name) { GtkWidget *perm, *temp; gboolean ask = TRUE; gint response; /* Does the user want to see this question? If not, return the * previous answer. */ response = gnc_prefs_get_int(GNC_PREFS_GROUP_WARNINGS_PERM, pref_name); if (response != 0) return response; response = gnc_prefs_get_int(GNC_PREFS_GROUP_WARNINGS_TEMP, pref_name); if (response != 0) return response; /* Add in the checkboxes to find out if the answer should be remembered. */ #if 0 if (GTK_IS_MESSAGE_DIALOG(dialog)) { GtkMessageType type; g_object_get(dialog, "message-type", &type, (gchar*)NULL); ask = (type == GTK_MESSAGE_QUESTION); } else { ask = FALSE; } #endif perm = gtk_check_button_new_with_mnemonic (ask ? _("Remember and don't _ask me again.") : _("Don't _tell me again.")); temp = gtk_check_button_new_with_mnemonic (ask ? _("Remember and don't ask me again this _session.") : _("Don't tell me again this _session.")); gtk_widget_show(perm); gtk_widget_show(temp); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), perm, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), temp, TRUE, TRUE, 0); g_signal_connect(perm, "clicked", G_CALLBACK(gnc_perm_button_cb), temp); /* OK. Present the dialog. */ response = gtk_dialog_run(dialog); if ((response == GTK_RESPONSE_NONE) || (response == GTK_RESPONSE_DELETE_EVENT)) { return GTK_RESPONSE_CANCEL; } if (response != GTK_RESPONSE_CANCEL) { /* Save the answer? */ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(perm))) { gnc_prefs_set_int(GNC_PREFS_GROUP_WARNINGS_PERM, pref_name, response); } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp))) { gnc_prefs_set_int(GNC_PREFS_GROUP_WARNINGS_TEMP, pref_name, response); } } return response; }