diff --git a/src/gnome-utils/dialog-preferences.c b/src/gnome-utils/dialog-preferences.c index 35d9187280..19949c5a2c 100644 --- a/src/gnome-utils/dialog-preferences.c +++ b/src/gnome-utils/dialog-preferences.c @@ -646,88 +646,6 @@ gnc_prefs_split_widget_name (const gchar *name, gchar **group, gchar **pref) } /* FIXME to remove when gconf conversion of preferences is complete */ -/** The user changed a GtkFontButton. Update gconf. Font selection - * choices are stored as a string. - * - * @internal - * - * @param gde A pointer to the GtkFontButton that was changed. - * - * @param user_data Unused. - */ -static void -gnc_prefs_font_button_user_cb_gconf (GtkFontButton *fb, - gpointer user_data) -{ - const gchar *key, *font; - - g_return_if_fail(GTK_IS_FONT_BUTTON(fb)); - key = gtk_buildable_get_name(GTK_BUILDABLE(fb)) + PREFIX_LEN; - font = gtk_font_button_get_font_name(fb); - - DEBUG("font_button %s set", key); - gnc_gconf_set_string(key, NULL, font, NULL); -} - - -/** A GtkFontButton choice was updated in gconf. Update the user - * visible dialog. - * - * @internal - * - * @param gde A pointer to the GtkFontButton that changed. - * - * @param value The new value of the GtkFontButton. - */ -static void -gnc_prefs_font_button_gconf_cb_gconf (GtkFontButton *fb, - GConfEntry *entry) -{ - const gchar *font; - - g_return_if_fail(GTK_IS_FONT_BUTTON(fb)); - ENTER("fb %p, entry %p", fb, entry); - - font = gconf_value_get_string(entry->value); - - g_signal_handlers_block_by_func(G_OBJECT(fb), - G_CALLBACK(gnc_prefs_font_button_user_cb_gconf), NULL); - gtk_font_button_set_font_name(fb, font); - g_signal_handlers_unblock_by_func(G_OBJECT(fb), - G_CALLBACK(gnc_prefs_font_button_user_cb_gconf), NULL); - LEAVE(" "); -} - - -/** Connect a GtkFontButton widget to the user callback function. Set - * the font from its value in gconf. - * - * @internal - * - * @param gde A pointer to the date_edit that should be connected. - */ -static void -gnc_prefs_connect_font_button_gconf (GtkFontButton *fb) -{ - const gchar *name; - gchar *font; - - g_return_if_fail(GTK_IS_FONT_BUTTON(fb)); - - /* Lookup font name based upon gconf setting */ - name = gtk_buildable_get_name(GTK_BUILDABLE(fb)) + PREFIX_LEN; - font = gnc_gconf_get_string(name, NULL, NULL); - - gtk_font_button_set_font_name(fb, font); - DEBUG(" font_button %s set", name); - g_free(font); - - g_signal_connect(G_OBJECT(fb), "font_set", - G_CALLBACK(gnc_prefs_font_button_user_cb_gconf), NULL); - - gtk_widget_show_all(GTK_WIDGET(fb)); -} - /****************************************************************************/ /** The user clicked on a radio button. Update gconf. Radio button @@ -1407,6 +1325,31 @@ gnc_prefs_connect_date_edit_gconf (GNCDateEdit *gde , const gchar *boxname ) } /* FIXME end of section to remove */ +/****************************************************************************/ + +/** 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; + gchar *font; + + 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)); +} + /****************************************************************************/ @@ -1477,12 +1420,7 @@ gnc_prefs_connect_one_gconf (const gchar *name, /* These tests must be ordered from more specific widget to less * specific widget. */ - if (GTK_IS_FONT_BUTTON(widget)) - { - DEBUG(" %s - entry", name); - gnc_prefs_connect_font_button_gconf(GTK_FONT_BUTTON(widget)); - } - else if (GTK_IS_RADIO_BUTTON(widget)) + if (GTK_IS_RADIO_BUTTON(widget)) { DEBUG(" %s - radio button", name); gnc_prefs_connect_radio_button_gconf(GTK_RADIO_BUTTON(widget)); @@ -1560,6 +1498,16 @@ gnc_prefs_connect_one (const gchar *name, /* These tests must be ordered from more specific widget to less * specific widget. */ + if (GTK_IS_FONT_BUTTON(widget)) + { + DEBUG(" %s - entry", name); + gnc_prefs_connect_font_button(GTK_FONT_BUTTON(widget)); + } + else + { + DEBUG(" %s - unsupported %s", name, + G_OBJECT_TYPE_NAME(G_OBJECT(widget))); + } } @@ -1803,12 +1751,7 @@ gnc_preferences_gconf_changed (GConfClient *client, /* These tests must be ordered from more specific widget to less * specific widget. */ - if (GTK_IS_FONT_BUTTON(widget)) - { - DEBUG("widget %p - font button", widget); - gnc_prefs_font_button_gconf_cb_gconf(GTK_FONT_BUTTON(widget), entry); - } - else if (GTK_IS_RADIO_BUTTON(widget)) + if (GTK_IS_RADIO_BUTTON(widget)) { DEBUG("widget %p - radio button", widget); gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget)); diff --git a/src/gnome-utils/gtkbuilder/dialog-preferences.glade b/src/gnome-utils/gtkbuilder/dialog-preferences.glade index 83dbef9b0f..db4400fa3c 100644 --- a/src/gnome-utils/gtkbuilder/dialog-preferences.glade +++ b/src/gnome-utils/gtkbuilder/dialog-preferences.glade @@ -2288,7 +2288,7 @@ many months before the current month: Default _font: True True - gconf/dialogs/print_checks/default_font + pref/dialogs.checkprinting/default_font @@ -2300,7 +2300,7 @@ many months before the current month: - + True True True. diff --git a/src/gnome/dialog-print-check.c b/src/gnome/dialog-print-check.c index 3684cc2065..c5fcba2bbc 100644 --- a/src/gnome/dialog-print-check.c +++ b/src/gnome/dialog-print-check.c @@ -40,6 +40,7 @@ #include "qof.h" #include "gnc-date.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-numeric.h" #include "gnc-plugin-page-register.h" #include "dialog-print-check.h" @@ -65,7 +66,7 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks"; #define GCONF_SECTION "dialogs/print_checks" -#define GNC_PREFS_GROUP "dialogs.print_checks" +#define GNC_PREFS_GROUP "dialogs.checkprinting" #define KEY_CHECK_FORMAT_GUID "check_format_guid" #define KEY_CHECK_FORMAT "check_format" #define KEY_CHECK_POSITION "check_position" @@ -82,12 +83,13 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks"; #define KEY_CUSTOM_ROTATION "custom_rotation" #define KEY_CUSTOM_UNITS "custom_units" #define KEY_PRINT_DATE_FMT "print_date_format" -#define KEY_DEFAULT_FONT "default_font" +#define GNC_PREF_DEFAULT_FONT "default_font" #define KEY_BLOCKING_CHARS "blocking_chars" #define KEY_SPLITS_AMOUNT "splits_amount" #define KEY_SPLITS_MEMO "splits_memo" #define KEY_SPLITS_ACCOUNT "splits_account" + #define DEFAULT_FONT "sans 12" #define CHECK_FMT_DIR "checks" #define CHECK_NAME_EXTENSION ".chk" @@ -1734,7 +1736,7 @@ gnc_ui_print_check_dialog_create(GncPluginPageRegister *plugin_page, gtk_table_attach_defaults(GTK_TABLE(table), pcd->date_format, 1, 3, 4, 7); /* Default font (set in preferences) */ - font = gnc_gconf_get_string(GCONF_SECTION, KEY_DEFAULT_FONT, NULL); + font = gnc_prefs_get_string(GNC_PREFS_GROUP, GNC_PREF_DEFAULT_FONT); pcd->default_font = font ? font : g_strdup(DEFAULT_FONT); /* Update the combo boxes bases on the available check formats */ diff --git a/src/gnome/dialog-print-check2.c b/src/gnome/dialog-print-check2.c index 09a93eaa79..34be878f04 100644 --- a/src/gnome/dialog-print-check2.c +++ b/src/gnome/dialog-print-check2.c @@ -40,6 +40,7 @@ #include "qof.h" #include "gnc-date.h" #include "gnc-gconf-utils.h" +#include "gnc-prefs.h" #include "gnc-numeric.h" #include "gnc-plugin-page-register2.h" #include "dialog-print-check2.h" @@ -65,6 +66,7 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks"; #define GCONF_SECTION "dialogs/print_checks" +#define GNC_PREFS_GROUP "dialogs.checkprinting" #define KEY_CHECK_FORMAT_GUID "check_format_guid" #define KEY_CHECK_FORMAT "check_format" #define KEY_CHECK_POSITION "check_position" @@ -81,12 +83,13 @@ G_GNUC_UNUSED static QofLogModule log_module = "gnc.printing.checks"; #define KEY_CUSTOM_ROTATION "custom_rotation" #define KEY_CUSTOM_UNITS "custom_units" #define KEY_PRINT_DATE_FMT "print_date_format" -#define KEY_DEFAULT_FONT "default_font" +#define GNC_PREF_DEFAULT_FONT "default_font" #define KEY_BLOCKING_CHARS "blocking_chars" #define KEY_SPLITS_AMOUNT "splits_amount" #define KEY_SPLITS_MEMO "splits_memo" #define KEY_SPLITS_ACCOUNT "splits_account" + #define DEFAULT_FONT "sans 12" #define CHECK_FMT_DIR "checks" #define CHECK_NAME_EXTENSION ".chk" @@ -1733,7 +1736,7 @@ gnc_ui_print_check_dialog_create2(GncPluginPageRegister2 *plugin_page, gtk_table_attach_defaults(GTK_TABLE(table), pcd->date_format, 1, 3, 4, 7); /* Default font (set in preferences) */ - font = gnc_gconf_get_string(GCONF_SECTION, KEY_DEFAULT_FONT, NULL); + font = gnc_prefs_get_string(GNC_PREFS_GROUP, GNC_PREF_DEFAULT_FONT); pcd->default_font = font ? font : g_strdup(DEFAULT_FONT); /* Update the combo boxes bases on the available check formats */ diff --git a/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in b/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in index 7434c1bcec..4a98bfe4e0 100644 --- a/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in +++ b/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in @@ -65,5 +65,12 @@ Print '***' before and after text. Print '***' before and after text. + + (-1,-1,-1,-1) + Last window position and size + This setting describes the size and position of the window when it was last closed. + The numbers are the X and Y coordinates of the top left corner of the window + followed by the width and height of the window. + diff --git a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in b/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in index 0a0b7239e1..22595e2e0d 100644 --- a/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in +++ b/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in @@ -5,7 +5,6 @@ - @@ -62,16 +61,6 @@ - - - (-1,-1,-1,-1) - Last window position and size - This setting describes the size and position of the window when it was last closed. - The numbers are the X and Y coordinates of the top left corner of the window - followed by the width and height of the window. - - - (-1,-1,-1,-1)