/** 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); }
/** Connect a GtkFileChooserButton widget to its stored value in the preferences database. * * @internal * * @param fb A pointer to the file chooser button that should be connected. * * @param boxname The Hbox name that contains the GtkFileChooserButton and Clear button */ static void gnc_prefs_connect_file_chooser_button (GtkFileChooserButton *fcb, const gchar *boxname) { GtkImage *image; gchar *group, *pref; gchar *uri; gboolean folder_set = TRUE; g_return_if_fail(GTK_FILE_CHOOSER_BUTTON(fcb)); if (boxname == NULL) gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(fcb)), &group, &pref); else gnc_prefs_split_widget_name (boxname, &group, &pref); uri = gnc_prefs_get_string (group, pref); PINFO("Uri is %s", uri); if ((uri != NULL) && (g_strcmp0 (uri, "") != 0)) // default entry { gchar *path_head = g_filename_from_uri (uri, NULL, NULL); // test for current folder present and set chooser to it if (g_file_test (path_head, G_FILE_TEST_IS_DIR)) gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER(fcb), uri); else folder_set = FALSE; g_free (path_head); } image = g_object_get_data(G_OBJECT(fcb), "path_head_error"); if (folder_set) // If current folder missing, display error and tt message gtk_widget_hide (GTK_WIDGET(image)); else { gchar *uri_u = g_uri_unescape_string (uri, NULL); gchar *path_head = g_filename_from_uri (uri_u, NULL, NULL); gchar *ttip = g_strconcat (_("Path does not exist, "), path_head, NULL); gtk_widget_set_tooltip_text(GTK_WIDGET(image), ttip); gtk_widget_show (GTK_WIDGET(image)); g_free (ttip); g_free (uri_u); g_free (path_head); } g_signal_connect (GTK_FILE_CHOOSER(fcb), "selection-changed", G_CALLBACK(file_chooser_selected_cb), NULL); g_object_set_data_full (G_OBJECT(fcb),"group", g_strdup (group), (GDestroyNotify) g_free); g_object_set_data_full (G_OBJECT(fcb),"pref", g_strdup (pref), (GDestroyNotify) g_free); g_free (group); g_free (pref); g_free (uri); gtk_widget_show_all(GTK_WIDGET(fcb)); }