/** Connect a GtkSpinButton widget to its stored value in the preferences database. * * @internal * * @param button A pointer to the spin button that should be * connected. */ static void gnc_prefs_connect_spin_button (GtkSpinButton *spin) { gchar *group, *pref; g_return_if_fail(GTK_IS_SPIN_BUTTON(spin)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(spin)), &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (spin), "value"); g_free (group); g_free (pref); }
/** Connect a GtkEntry widget to its stored value in the preferences database. * * @internal * * @param entry A pointer to the entry that should be connected. */ static void gnc_prefs_connect_entry (GtkEntry *entry) { gchar *group, *pref; g_return_if_fail(GTK_IS_ENTRY(entry)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(entry)), &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (entry), "text"); g_free (group); g_free (pref); }
/** Connect a GtkComboBox widget to its stored value in the preferences database. * * @internal * * @param box A pointer to the combo box that should be connected. */ static void gnc_prefs_connect_combo_box (GtkComboBox *box) { gchar *group, *pref; g_return_if_fail(GTK_IS_COMBO_BOX(box)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(box)), &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (box), "active"); g_free (group); g_free (pref); }
/** Connect a GtkCheckButton widget to its stored value in the preferences database. * * @internal * * @param button A pointer to the check button that should be * connected. */ static void gnc_prefs_connect_check_button (GtkCheckButton *button) { gchar *group, *pref; g_return_if_fail(GTK_IS_CHECK_BUTTON(button)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(button)), &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (button), "active"); g_free (group); g_free (pref); }
/** Connect a GncDateEdit widget to its stored value in the preferences database. * * @internal * * @param gde A pointer to the date_edit that should be connected. */ static void gnc_prefs_connect_date_edit (GNCDateEdit *gde , const gchar *boxname ) { gchar *group, *pref; g_return_if_fail(GNC_IS_DATE_EDIT(gde)); gnc_prefs_split_widget_name (boxname, &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (gde), "time"); g_free (group); g_free (pref); }
/** Connect a GncPeriodSelect widget to its stored value in the preferences database. * * @internal * * @param period A pointer to the GncPeriodSelect that should be connected. */ static void gnc_prefs_connect_period_select (GncPeriodSelect *period, const gchar *boxname ) { gchar *group, *pref; g_return_if_fail(GNC_IS_PERIOD_SELECT(period)); gnc_prefs_split_widget_name (boxname, &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (period), "active"); g_free (group); g_free (pref); }
/** Connect a GtkFontButton widget to its stored value in the preferences database. * * @internal * * @param fb A pointer to the font button that should be connected. */ static void gnc_prefs_connect_font_button (GtkFontButton *fb) { gchar *group, *pref; g_return_if_fail(GTK_IS_FONT_BUTTON(fb)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(fb)), &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (fb), "font-name"); g_free (group); g_free (pref); gtk_widget_show_all(GTK_WIDGET(fb)); }
/** Connect a GncCurrencyEdit widget to its stored value in the preferences database. * * @internal * * @param gce A pointer to the currency_edit that should be connected. */ static void gnc_prefs_connect_currency_edit (GNCCurrencyEdit *gce, const gchar *boxname ) { gchar *group, *pref; g_return_if_fail(GNC_IS_CURRENCY_EDIT(gce)); gnc_prefs_split_widget_name (boxname, &group, &pref); gnc_prefs_bind (group, pref, G_OBJECT (gce), "mnemonic"); g_free (group); g_free (pref); gtk_widget_show_all(GTK_WIDGET(gce)); }
/** Connect a GtkComboBox widget to its stored value in the preferences database. * * @internal * * @param box A pointer to the combo box that should be connected. */ static void gnc_prefs_connect_combo_box (GtkComboBox *box) { gchar *group, *pref; gint active; g_return_if_fail(GTK_IS_COMBO_BOX(box)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(box)), &group, &pref); // active = gnc_prefs_get_int(group, pref); // gtk_combo_box_set_active(GTK_COMBO_BOX(box), active); // DEBUG(" Combo box %s/%s set to item %d", group, pref, active); gnc_prefs_bind (group, pref, G_OBJECT (box), "active"); g_free (group); g_free (pref); }
/** Connect a GtkSpinButton widget to its stored value in the preferences database. * * @internal * * @param button A pointer to the spin button that should be * connected. */ static void gnc_prefs_connect_spin_button (GtkSpinButton *spin) { gchar *group, *pref; gdouble value; g_return_if_fail(GTK_IS_SPIN_BUTTON(spin)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(spin)), &group, &pref); // value = gnc_prefs_get_float (group, pref); // gtk_spin_button_set_value(spin, value); // DEBUG(" Spin button %s/%s has initial value %f", group, pref, value); gnc_prefs_bind (group, pref, G_OBJECT (spin), "value"); g_free (group); g_free (pref); }
/** Connect a GtkCheckButton widget to its stored value in the preferences database. * * @internal * * @param button A pointer to the check button that should be * connected. */ static void gnc_prefs_connect_check_button (GtkCheckButton *button) { gchar *group, *pref; gboolean active; g_return_if_fail(GTK_IS_CHECK_BUTTON(button)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(button)), &group, &pref); // active = gnc_prefs_get_bool (group, pref); // DEBUG(" Checkbox %s/%s initially %sactive", group, pref, active ? "" : "in"); // gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); gnc_prefs_bind (group, pref, G_OBJECT (button), "active"); g_free (group); g_free (pref); }
/** Connect a GtkEntry widget to its stored value in the preferences database. * * @internal * * @param entry A pointer to the entry that should be connected. */ static void gnc_prefs_connect_entry (GtkEntry *entry) { gchar *group, *pref; gchar *text; g_return_if_fail(GTK_IS_ENTRY(entry)); gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(entry)), &group, &pref); // text = gnc_prefs_get_string(group, pref); // gtk_entry_set_text(GTK_ENTRY(entry), text ? text : ""); // DEBUG(" Entry %s/%s set to '%s'", group, pref, text ? text : "(null)"); // g_free(text); gnc_prefs_bind (group, pref, G_OBJECT (entry), "text"); g_free (group); g_free (pref); }
/* Bind the visibility of the extra toolbar buttons to the * enable_toolbuttons preference. */ static void bind_toolbuttons_visibility (GncMainWindow *mainwindow) { GtkActionGroup *action_group; const char **iter; g_return_if_fail(mainwindow); g_return_if_fail(GNC_IS_MAIN_WINDOW(mainwindow)); /* Get the action group */ action_group = gnc_main_window_get_action_group(mainwindow, PLUGIN_ACTIONS_NAME); g_assert(action_group); for (iter = extra_toolbar_actions; *iter; ++iter) { /* Set the action's visibility */ GtkAction *action = gtk_action_group_get_action (action_group, *iter); gnc_prefs_bind (GNC_PREFS_GROUP_INVOICE, GNC_PREF_EXTRA_TOOLBUTTONS, G_OBJECT (action), "visible"); } }
/******************************************************* * Create the Assistant *******************************************************/ static GtkWidget * csv_export_assistant_create (CsvExportInfo *info) { GtkBuilder *builder; GtkWidget *window; GtkWidget *box, *h_box; GtkWidget *button; GtkWidget *table, *hbox; time64 start_time, end_time; builder = gtk_builder_new(); gnc_builder_add_from_file (builder , "assistant-csv-export.glade", "CSV Export Assistant"); window = GTK_WIDGET(gtk_builder_get_object (builder, "CSV Export Assistant")); info->window = window; /* Set the assistant colors */ gnc_assistant_set_colors (GTK_ASSISTANT (info->window)); /* Load default settings */ load_settings (info); /* Start Page */ info->start_page = GTK_WIDGET(gtk_builder_get_object(builder, "start_page")); info->start_label = GTK_WIDGET(gtk_builder_get_object(builder, "start_label")); info->custom_entry = GTK_WIDGET(gtk_builder_get_object(builder, "custom_entry")); gtk_widget_set_sensitive (info->custom_entry, FALSE); /* Account Page */ info->account_page = GTK_WIDGET(gtk_builder_get_object(builder, "account_page")); if (info->export_type == XML_EXPORT_TREE) gtk_widget_destroy (info->account_page); else { GtkTreeView *tree_view; GtkTreeSelection *selection; GtkWidget *box, *label; info->csva.acct_info = GTK_WIDGET(gtk_builder_get_object (builder, "acct_info_vbox")); info->csva.num_acct_label = GTK_WIDGET(gtk_builder_get_object (builder, "num_accounts_label")); tree_view = gnc_tree_view_account_new (FALSE); info->csva.account_treeview = GTK_WIDGET(tree_view); selection = gtk_tree_view_get_selection (tree_view); gtk_tree_selection_set_mode (selection, GTK_SELECTION_EXTENDED); g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK(csv_export_account_changed_cb), info); gtk_widget_show (info->csva.account_treeview); box = GTK_WIDGET(gtk_builder_get_object (builder, "account_scroll")); gtk_container_add (GTK_CONTAINER(box), info->csva.account_treeview); label = GTK_WIDGET(gtk_builder_get_object (builder, "accounts_label")); gtk_label_set_mnemonic_widget (GTK_LABEL(label), GTK_WIDGET(tree_view)); /* select subaccounts button */ button = GTK_WIDGET(gtk_builder_get_object (builder, "select_subaccounts_button")); info->csva.select_button = button; g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(csv_export_select_subaccounts_clicked_cb), info); g_signal_connect (G_OBJECT(info->csva.account_treeview), "cursor_changed", G_CALLBACK(csv_export_cursor_changed_cb), info); /* Set the date info */ button = GTK_WIDGET(gtk_builder_get_object (builder, "show_range")); /* Earliest and Latest in Book */ start_time = get_earliest_in_book (gnc_get_current_book()); end_time = gnc_time (NULL); info->csvd.start_time = start_time; info->csvd.end_time = end_time; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), FALSE); table = GTK_WIDGET(gtk_builder_get_object (builder, "select_range_table")); info->csvd.table = table; gtk_widget_set_sensitive (GTK_WIDGET(table), FALSE); info->csvd.start_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_choose")); info->csvd.start_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_today")); info->csvd.end_date_choose = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_choose")); info->csvd.end_date_today = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_today")); /* Start date info */ info->csvd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE); hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox")); gtk_box_pack_start (GTK_BOX(hbox), info->csvd.start_date, TRUE, TRUE, 0); gtk_widget_show (info->csvd.start_date); gnc_date_edit_set_time (GNC_DATE_EDIT(info->csvd.start_date), start_time); g_signal_connect (G_OBJECT(info->csvd.start_date), "date-changed", G_CALLBACK(csv_export_date_changed_cb), info); /* End date info */ info->csvd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE); hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox")); gtk_box_pack_start (GTK_BOX(hbox), info->csvd.end_date, TRUE, TRUE, 0); gtk_widget_show (info->csvd.end_date); gnc_date_edit_set_time (GNC_DATE_EDIT(info->csvd.end_date), end_time); g_signal_connect (G_OBJECT (info->csvd.end_date), "date-changed", G_CALLBACK (csv_export_date_changed_cb), info); /* Load Accounts */ show_acct_type_accounts (info); update_accounts_tree (info); } /* File chooser Page */ info->file_page = GTK_WIDGET(gtk_builder_get_object(builder, "file_page")); info->file_chooser = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SAVE); button = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_widget_set_size_request (button, 100, -1); gtk_widget_show (button); h_box = gtk_hbox_new (TRUE, 0); gtk_box_pack_start(GTK_BOX(h_box), button, FALSE, FALSE, 0); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(info->file_chooser), h_box); g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(csv_export_file_chooser_confirm_cb), info); box = GTK_WIDGET(gtk_builder_get_object (builder, "file_page")); gtk_box_pack_start (GTK_BOX (box), info->file_chooser, TRUE, TRUE, 6); gtk_widget_show (info->file_chooser); /* Finish Page */ info->finish_label = GTK_WIDGET(gtk_builder_get_object (builder, "end_page")); /* Summary Page */ info->summary_label = GTK_WIDGET(gtk_builder_get_object (builder, "summary_page")); g_signal_connect (G_OBJECT(window), "destroy", G_CALLBACK(csv_export_assistant_destroy_cb), info); gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window)); if (gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY)) { GObject *object = gtk_builder_get_object (builder, "paned"); gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_PANED_POS, object, "position"); } gtk_builder_connect_signals (builder, info); g_object_unref (G_OBJECT(builder)); return window; }