r23234 - gnucash/trunk/src - Gnc-Prefs: migrate all GtkFontButton widgets (default_font property)
Geert Janssens
gjanssens at code.gnucash.org
Mon Oct 7 10:11:22 EDT 2013
Author: gjanssens
Date: 2013-10-07 10:11:18 -0400 (Mon, 07 Oct 2013)
New Revision: 23234
Trac: http://svn.gnucash.org/trac/changeset/23234
Modified:
gnucash/trunk/src/gnome-utils/dialog-preferences.c
gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade
gnucash/trunk/src/gnome/dialog-print-check.c
gnucash/trunk/src/gnome/dialog-print-check2.c
gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
Log:
Gnc-Prefs: migrate all GtkFontButton widgets (default_font property)
All GtkFontButtons now use the new preferences backend
so drop the GtkFontButton-Gconf wiring as well.
Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c 2013-10-07 14:10:46 UTC (rev 23233)
+++ gnucash/trunk/src/gnome/dialog-print-check.c 2013-10-07 14:11:18 UTC (rev 23234)
@@ -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 @@
#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 @@
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 */
Modified: gnucash/trunk/src/gnome/dialog-print-check2.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check2.c 2013-10-07 14:10:46 UTC (rev 23233)
+++ gnucash/trunk/src/gnome/dialog-print-check2.c 2013-10-07 14:11:18 UTC (rev 23234)
@@ -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 @@
#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 @@
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 */
Modified: gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
===================================================================
--- gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in 2013-10-07 14:10:46 UTC (rev 23233)
+++ gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in 2013-10-07 14:11:18 UTC (rev 23234)
@@ -65,5 +65,12 @@
<summary>Print '***' before and after text.</summary>
<description>Print '***' before and after text.</description>
</key>
+ <key name="last-geometry" type="(iiii)">
+ <default>(-1,-1,-1,-1)</default>
+ <summary>Last window position and size</summary>
+ <description>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.</description>
+ </key>
</schema>
</schemalist>
Modified: gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
===================================================================
--- gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in 2013-10-07 14:10:46 UTC (rev 23233)
+++ gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in 2013-10-07 14:11:18 UTC (rev 23234)
@@ -5,7 +5,6 @@
<child name="edit_prices" schema="org.gnucash.dialogs.edit_prices"/>
<child name="preferences" schema="org.gnucash.dialogs.preferences"/>
<child name="price_editor" schema="org.gnucash.dialogs.price_editor"/>
- <child name="print_checks" schema="org.gnucash.dialogs.print_checks"/>
<child name="reset_warnings" schema="org.gnucash.dialogs.reset_warnings"/>
<child name="tax_info" schema="org.gnucash.dialogs.tax_info"/>
<child name="tip_of_the_day" schema="org.gnucash.dialogs.tip_of_the_day"/>
@@ -62,16 +61,6 @@
</key>
</schema>
- <schema id="org.gnucash.dialogs.print_checks" path="/apps/gnucash/dialogs/print_checks/">
- <key name="last-geometry" type="(iiii)">
- <default>(-1,-1,-1,-1)</default>
- <summary>Last window position and size</summary>
- <description>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.</description>
- </key>
- </schema>
-
<schema id="org.gnucash.dialogs.reset_warnings" path="/apps/gnucash/dialogs/reset_warnings/">
<key name="last-geometry" type="(iiii)">
<default>(-1,-1,-1,-1)</default>
Modified: gnucash/trunk/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-preferences.c 2013-10-07 14:10:46 UTC (rev 23233)
+++ gnucash/trunk/src/gnome-utils/dialog-preferences.c 2013-10-07 14:11:18 UTC (rev 23234)
@@ -646,88 +646,6 @@
}
/* 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,8 +1325,33 @@
}
/* 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,13 +1420,8 @@
/* These tests must be ordered from more specific widget to less
* specific widget. */
- if (GTK_IS_FONT_BUTTON(widget))
+ if (GTK_IS_RADIO_BUTTON(widget))
{
- DEBUG(" %s - entry", name);
- gnc_prefs_connect_font_button_gconf(GTK_FONT_BUTTON(widget));
- }
- else 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 @@
/* 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,13 +1751,8 @@
/* These tests must be ordered from more specific widget to less
* specific widget. */
- if (GTK_IS_FONT_BUTTON(widget))
+ if (GTK_IS_RADIO_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))
- {
DEBUG("widget %p - radio button", widget);
gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget));
}
Modified: gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade
===================================================================
--- gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade 2013-10-07 14:10:46 UTC (rev 23233)
+++ gnucash/trunk/src/gnome-utils/gtkbuilder/dialog-preferences.glade 2013-10-07 14:11:18 UTC (rev 23234)
@@ -2288,7 +2288,7 @@
<property name="label" translatable="yes">Default _font:</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">gconf/dialogs/print_checks/default_font</property>
+ <property name="mnemonic_widget">pref/dialogs.checkprinting/default_font</property>
</object>
</child>
</object>
@@ -2300,7 +2300,7 @@
</packing>
</child>
<child>
- <object class="GtkFontButton" id="gconf/dialogs/print_checks/default_font">
+ <object class="GtkFontButton" id="pref/dialogs.checkprinting/default_font">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>.
More information about the gnucash-changes
mailing list