r23241 - gnucash/trunk/src - Gnc-Prefs: migrate int-typed preferences (and GtkCombobox widgets linked to them)

Geert Janssens gjanssens at code.gnucash.org
Mon Oct 7 10:14:12 EDT 2013


Author: gjanssens
Date: 2013-10-07 10:14:11 -0400 (Mon, 07 Oct 2013)
New Revision: 23241
Trac: http://svn.gnucash.org/trac/changeset/23241

Modified:
   gnucash/trunk/src/business/business-gnome/business-gnome-utils.h
   gnucash/trunk/src/business/business-gnome/dialog-invoice.h
   gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
   gnucash/trunk/src/business/business-gnome/gtkbuilder/business-prefs.glade
   gnucash/trunk/src/gnome-utils/dialog-preferences.c
   gnucash/trunk/src/gnome-utils/dialog-totd.c
   gnucash/trunk/src/gnome/dialog-lot-viewer.c
   gnucash/trunk/src/gnome/dialog-print-check.c
   gnucash/trunk/src/gnome/dialog-print-check2.c
   gnucash/trunk/src/gnome/dialog-tax-info.c
   gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in
   gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in
   gnucash/trunk/src/gnome/gtkbuilder/dialog-lot-viewer.glade
   gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c
   gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h
Log:
Gnc-Prefs: migrate int-typed preferences (and GtkCombobox widgets linked to them)

All GtkComboBoxes now use the new preferences backend
so drop the GtkComboBoxes-Gconf wiring as well.

Modified: gnucash/trunk/src/business/business-gnome/business-gnome-utils.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome-utils.h	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/business/business-gnome/business-gnome-utils.h	2013-10-07 14:14:11 UTC (rev 23241)
@@ -30,11 +30,6 @@
 #include "gncTaxTable.h"
 #include "gncInvoice.h"
 
-#define GCONF_SECTION_ORDER    "dialogs/business/order"
-#define GCONF_SECTION_JOB      "dialogs/business/job"
-#define GCONF_SECTION_CUSTOMER "dialogs/business/customer"
-#define GCONF_SECTION_VENDOR   "dialogs/business/vendor"
-#define GCONF_SECTION_EMPLOYEE "dialogs/business/employee"
 
 GtkWidget * gnc_owner_select_create (GtkWidget *label, GtkWidget *hbox,
                                      QofBook *book, GncOwner *owner);

Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.h
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.h	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.h	2013-10-07 14:14:11 UTC (rev 23241)
@@ -46,9 +46,6 @@
 } invoice_sort_type_t;
 
 
-#define GCONF_SECTION_INVOICE "dialogs/business/invoice"
-#define GCONF_SECTION_BILL    "dialogs/business/bill"
-#define GCONF_SECTION_VOUCHER "dialogs/business/voucher"
 #define GNC_PREFS_GROUP_INVOICE "dialogs.business.invoice"
 #define GNC_PREFS_GROUP_BILL    "dialogs.business.bill"
 #define GNC_PREFS_GROUP_VOUCHER "dialogs.business.voucher"

Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-business.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -48,8 +48,7 @@
 #include "gnc-session.h"
 #include "gnome-utils/gnc-icons.h" /* for GNC_STOCK_INVOICE_NEW */
 
-#include "gnc-prefs.h" /* for GCONF_PATH */
-#include "gnc-gconf-utils.h"
+#include "gnc-prefs.h"
 #include "gnome-utils/gnc-main-window.h"
 
 #include "gnc-plugin-page-register.h"
@@ -134,6 +133,7 @@
 #define PLUGIN_UI_FILENAME  "gnc-plugin-business-ui.xml"
 
 #define GNC_PREF_EXTRA_TOOLBUTTONS "enable_toolbuttons"
+#define GNC_PREF_INV_PRINT_RPT     "invoice_printreport"
 
 /** This variable maintains a pointer to the last window where a
  *  Business command was executed.  It is used to determine where new
@@ -397,9 +397,6 @@
     plugin_class->n_actions    = gnc_plugin_n_actions;
     plugin_class->ui_filename  = PLUGIN_UI_FILENAME;
 
-    plugin_class->gconf_notifications = NULL;
-    plugin_class->gconf_section = NULL;
-
     g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
 }
 
@@ -1078,8 +1075,7 @@
 
 const char *gnc_plugin_business_get_invoice_printreport(void)
 {
-    int value = gnc_gconf_get_int(GCONF_SECTION_INVOICE,
-                                  "invoice_printreport", NULL);
+    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

Modified: gnucash/trunk/src/business/business-gnome/gtkbuilder/business-prefs.glade
===================================================================
--- gnucash/trunk/src/business/business-gnome/gtkbuilder/business-prefs.glade	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/business/business-gnome/gtkbuilder/business-prefs.glade	2013-10-07 14:14:11 UTC (rev 23241)
@@ -262,7 +262,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkComboBox" id="gconf/dialogs/business/invoice/invoice_printreport">
+          <object class="GtkComboBox" id="pref/dialogs.business.invoice/invoice_printreport">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="has_tooltip">True</property>

Modified: gnucash/trunk/src/gnome/dialog-lot-viewer.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-lot-viewer.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/dialog-lot-viewer.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -45,8 +45,8 @@
 #include "dialog-utils.h"
 #include "dialog-lot-viewer.h"
 #include "gnc-component-manager.h"
+#include "gnc-prefs.h"
 #include "gnc-ui-util.h"
-#include "gnc-gconf-utils.h"
 #include "misc-gnome-utils.h"
 
 #define LOT_VIEWER_CM_CLASS "dialog-lot-viewer"
@@ -82,10 +82,9 @@
 #define RESPONSE_SCRUB_ACCOUNT 4
 #define RESPONSE_NEW_LOT       5
 
-#define GCONF_SECTION "dialogs/lot_viewer"
 #define GNC_PREFS_GROUP "dialogs.lot_viewer"
-#define GCONF_KEY_HPOSITION "hpane_position"
-#define GCONF_KEY_VPOSITION "vpane_position"
+#define GNC_PREF_HPOS   "hpane_position"
+#define GNC_PREF_VPOS   "vpane_position"
 
 struct _GNCLotViewer
 {
@@ -96,8 +95,6 @@
     GtkButton     * delete_button;
     GtkButton     * scrub_lot_button;
     GtkButton     * new_lot_button;
-    GtkPaned      * lot_hpaned;
-    GtkPaned      * lot_vpaned;
     GtkTreeView   * lot_view;
     GtkListStore  * lot_store;
     GtkTextView   * lot_notes;
@@ -723,32 +720,6 @@
 }
 
 /* ======================================================================== */
-/* Divider moved */
-
-void
-lv_paned_notify_cb (GObject *gobject,
-                    GParamSpec *pspec,
-                    gpointer user_data)
-{
-    const gchar *param_name;
-    gint value;
-
-    param_name = g_param_spec_get_name(pspec);
-    if (strcmp(param_name, "position") != 0)
-        return;
-    g_object_get(gobject, "position", &value, NULL);
-
-    if (GTK_IS_HPANED(gobject))
-    {
-        gnc_gconf_set_int(GCONF_SECTION, GCONF_KEY_HPOSITION, value, NULL);
-    }
-    else
-    {
-        gnc_gconf_set_int(GCONF_SECTION, GCONF_KEY_VPOSITION, value, NULL);
-    }
-}
-
-/* ======================================================================== */
 /* Any button was pressed */
 
 void
@@ -968,6 +939,7 @@
     gchar *win_title;
     gint position;
     GtkBuilder *builder;
+    GtkWidget *widget;
 
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-lot-viewer.glade", "Lot Viewer Window");
@@ -1000,16 +972,17 @@
     lv->remove_split_from_lot_button = GTK_BUTTON(gtk_builder_get_object (builder, "remove split from lot button"));
     lv_init_split_buttons(lv);
 
-    lv->lot_vpaned = GTK_PANED (gtk_builder_get_object (builder, "lot vpaned"));
-    position = gnc_gconf_get_int(GCONF_SECTION, GCONF_KEY_VPOSITION, NULL);
-    if (position)
-        gtk_paned_set_position (lv->lot_vpaned, position);
 
-    lv->lot_hpaned = GTK_PANED (gtk_builder_get_object (builder, "lot hpaned"));
-    position = gnc_gconf_get_int(GCONF_SECTION, GCONF_KEY_HPOSITION, NULL);
-    if (position)
-        gtk_paned_set_position (lv->lot_hpaned, position);
+    if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
+    {
+        GObject *object;
+        object = gtk_builder_get_object (builder, "lot vpaned");
+        gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_VPOS, object, "position");
 
+        object = gtk_builder_get_object (builder, "lot hpaned");
+        gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_HPOS, object, "position");
+    }
+
     lv->selected_lot = NULL;
 
     /* Setup signals */

Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/dialog-print-check.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -68,9 +68,8 @@
 #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"
-#define KEY_FIRST_PAGE_COUNT   "first_page_count"
+#define GNC_PREF_CHECK_POSITION     "check_position"
+#define GNC_PREF_FIRST_PAGE_COUNT   "first_page_count"
 #define KEY_DATE_FORMAT_USER   "date_format_custom"
 #define GNC_PREF_CUSTOM_PAYEE       "custom_payee"
 #define GNC_PREF_CUSTOM_DATE        "custom_date"
@@ -81,7 +80,7 @@
 #define GNC_PREF_CUSTOM_MEMO        "custom_memo"
 #define GNC_PREF_CUSTOM_TRANSLATION "custom_translation"
 #define GNC_PREF_CUSTOM_ROTATION    "custom_rotation"
-#define KEY_CUSTOM_UNITS       "custom_units"
+#define GNC_PREF_CUSTOM_UNITS       "custom_units"
 #define GNC_PREF_PRINT_DATE_FMT     "print_date_format"
 #define GNC_PREF_DEFAULT_FONT       "default_font"
 #define GNC_PREF_BLOCKING_CHARS     "blocking_chars"
@@ -569,11 +568,11 @@
                              check ? check->guid : "custom", NULL);
     }
     active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
-    gnc_gconf_set_int(GCONF_SECTION, KEY_CHECK_POSITION, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION, active);
     active = gtk_spin_button_get_value_as_int(pcd->first_page_count);
-    gnc_gconf_set_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT, active);
     active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format));
-    gnc_gconf_set_int(GCONF_SECTION, KEY_DATE_FORMAT, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT, active);
     if (active == QOF_DATE_FORMAT_CUSTOM)
     {
         format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format));
@@ -621,7 +620,7 @@
     gnc_prefs_set_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION,
                         gtk_spin_button_get_value(pcd->check_rotation));
     active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox));
-    gnc_gconf_set_int(GCONF_SECTION, KEY_CUSTOM_UNITS, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS, active);
 }
 
 
@@ -637,15 +636,10 @@
     /* Options page */
     guid = gnc_gconf_get_string(GCONF_SECTION, KEY_CHECK_FORMAT_GUID, NULL);
     if (guid == NULL)
-    {
-        active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_FORMAT, NULL);
-        gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), active);
-    }
+        gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
     else if (strcmp(guid, "custom") == 0)
-    {
         gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox),
                                  pcd->format_max - 1);
-    }
     else
     {
         model = gtk_combo_box_get_model(GTK_COMBO_BOX(pcd->format_combobox));
@@ -658,16 +652,16 @@
             gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
         }
     }
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_POSITION, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION);
 
     /* If the check format used last time no longer exists, then the saved check
        position may be invalid.  If so set it to the first position. */
     if (active < 0 || active > pcd->position_max)
         active = 0;
     gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active);
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT);
     gtk_spin_button_set_value(pcd->first_page_count, (gdouble) active);
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_DATE_FORMAT, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT);
     gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active);
     if (active == QOF_DATE_FORMAT_CUSTOM)
     {
@@ -716,7 +710,7 @@
     gtk_spin_button_set_value(pcd->translation_y, y);
     x = gnc_prefs_get_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION);
     gtk_spin_button_set_value(pcd->check_rotation, x);
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_CUSTOM_UNITS, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS);
     gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active);
 }
 

Modified: gnucash/trunk/src/gnome/dialog-print-check2.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check2.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/dialog-print-check2.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -68,9 +68,8 @@
 #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"
-#define KEY_FIRST_PAGE_COUNT   "first_page_count"
+#define GNC_PREF_CHECK_POSITION     "check_position"
+#define GNC_PREF_FIRST_PAGE_COUNT   "first_page_count"
 #define KEY_DATE_FORMAT_USER   "date_format_custom"
 #define GNC_PREF_CUSTOM_PAYEE       "custom_payee"
 #define GNC_PREF_CUSTOM_DATE        "custom_date"
@@ -81,7 +80,7 @@
 #define GNC_PREF_CUSTOM_MEMO        "custom_memo"
 #define GNC_PREF_CUSTOM_TRANSLATION "custom_translation"
 #define GNC_PREF_CUSTOM_ROTATION    "custom_rotation"
-#define KEY_CUSTOM_UNITS       "custom_units"
+#define GNC_PREF_CUSTOM_UNITS       "custom_units"
 #define GNC_PREF_PRINT_DATE_FMT     "print_date_format"
 #define GNC_PREF_DEFAULT_FONT       "default_font"
 #define GNC_PREF_BLOCKING_CHARS     "blocking_chars"
@@ -570,11 +569,11 @@
                              check ? check->guid : "custom", NULL);
     }
     active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
-    gnc_gconf_set_int(GCONF_SECTION, KEY_CHECK_POSITION, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION, active);
     active = gtk_spin_button_get_value_as_int(pcd->first_page_count);
-    gnc_gconf_set_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT, active);
     active = gnc_date_format_get_format (GNC_DATE_FORMAT(pcd->date_format));
-    gnc_gconf_set_int(GCONF_SECTION, KEY_DATE_FORMAT, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT, active);
     if (active == QOF_DATE_FORMAT_CUSTOM)
     {
         format = gnc_date_format_get_custom (GNC_DATE_FORMAT(pcd->date_format));
@@ -622,7 +621,7 @@
     gnc_prefs_set_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION,
                         gtk_spin_button_get_value(pcd->check_rotation));
     active = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->units_combobox));
-    gnc_gconf_set_int(GCONF_SECTION, KEY_CUSTOM_UNITS, active, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS, active);
 }
 
 
@@ -638,15 +637,10 @@
     /* Options page */
     guid = gnc_gconf_get_string(GCONF_SECTION, KEY_CHECK_FORMAT_GUID, NULL);
     if (guid == NULL)
-    {
-        active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_FORMAT, NULL);
-        gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), active);
-    }
+        gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
     else if (strcmp(guid, "custom") == 0)
-    {
         gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox),
                                  pcd->format_max - 1);
-    }
     else
     {
         model = gtk_combo_box_get_model(GTK_COMBO_BOX(pcd->format_combobox));
@@ -659,16 +653,16 @@
             gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->format_combobox), 0);
         }
     }
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_CHECK_POSITION, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CHECK_POSITION);
 
     /* If the check format used last time no longer exists, then the saved check
        position may be invalid.  If so set it to the first position. */
     if (active < 0 || active > pcd->position_max)
         active = 0;
     gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->position_combobox), active);
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_FIRST_PAGE_COUNT, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_FIRST_PAGE_COUNT);
     gtk_spin_button_set_value(pcd->first_page_count, (gdouble) active);
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_DATE_FORMAT, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_DATE_FORMAT);
     gnc_date_format_set_format(GNC_DATE_FORMAT(pcd->date_format), active);
     if (active == QOF_DATE_FORMAT_CUSTOM)
     {
@@ -717,7 +711,7 @@
     gtk_spin_button_set_value(pcd->translation_y, y);
     x = gnc_prefs_get_float(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_ROTATION);
     gtk_spin_button_set_value(pcd->check_rotation, x);
-    active = gnc_gconf_get_int(GCONF_SECTION, KEY_CUSTOM_UNITS, NULL);
+    active = gnc_prefs_get_int(GNC_PREFS_GROUP, GNC_PREF_CUSTOM_UNITS);
     gtk_combo_box_set_active(GTK_COMBO_BOX(pcd->units_combobox), active);
 }
 

Modified: gnucash/trunk/src/gnome/dialog-tax-info.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-tax-info.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/dialog-tax-info.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -36,7 +36,6 @@
 #include "Account.h"
 #include "gnc-ui-util.h"
 #include "dialog-utils.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-prefs.h"
 #include "gnc-tree-view-account.h"
 #include "gnc-component-manager.h"
@@ -45,9 +44,8 @@
 #include "gnc-ui.h"
 
 #define DIALOG_TAX_INFO_CM_CLASS "dialog-tax-info"
-#define GCONF_SECTION "dialogs/tax_info"
-#define PANED_POSITION "paned_position"
-#define GNC_PREFS_GROUP "dialogs.tax_info"
+#define GNC_PREFS_GROUP    "dialogs.tax_info"
+#define GNC_PREF_PANED_POS "paned_position"
 
 enum
 {
@@ -97,7 +95,6 @@
 typedef struct
 {
     GtkWidget * dialog;
-    GtkWidget * paned;
 
     GtkWidget * entity_name_display;
     GtkWidget * entity_name_entry;
@@ -1461,12 +1458,11 @@
 
     gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog));
 
-    ti_dialog->paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned"));
 
     if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
     {
-        gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL);
-        gtk_paned_set_position(GTK_PANED(ti_dialog->paned), position);
+        GObject *object = gtk_builder_get_object (builder, "paned");
+        gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_PANED_POS, object, "position");
     }
     g_object_unref (builder);
 }
@@ -1476,12 +1472,6 @@
 {
     TaxInfoDialog *ti_dialog = user_data;
 
-    if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
-    {
-        gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION,
-                          gtk_paned_get_position(GTK_PANED(ti_dialog->paned)), NULL);
-    }
-
     gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(ti_dialog->dialog));
     gtk_widget_destroy (ti_dialog->dialog);
 }

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:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.checkprinting.gschema.xml.in	2013-10-07 14:14:11 UTC (rev 23241)
@@ -1,15 +1,20 @@
 <schemalist gettext-domain="GETTEXT_PACKAGE">
   <schema id="org.gnucash.dialogs.checkprinting" path="/apps/gnucash/dialogs/print_checks/">
-    <key name="check_format" type="i">
-      <default>0</default>
-      <summary>Index of predefined check format to use</summary>
-      <description>This value specifies the predefined check format to use.  The number is the 0-based index into the list of known check formats.</description>
+    <key name="check_format_guid" type="s">
+      <default>''</default>
+      <summary>GUID of predefined check format to use</summary>
+      <description>This value specifies the predefined check format to use.  The number is the guid of a known check format.</description>
     </key>
     <key name="check_position" type="i">
       <default>0</default>
       <summary>Which check position to print</summary>
       <description>On preprinted checks containing multiple checks per page, this setting specifies which check position to print.  The possible values are 0, 1 and 2, corresponding to the top, middle and bottom checks on the page.</description>
     </key>
+    <key name="first_page_count" type="i">
+      <default>0</default>
+      <summary>Number of checks to print on the first page.</summary>
+      <description>Number of checks to print on the first page.</description>
+    </key>
     <key name="date_format" type="i">
       <default>0</default>
       <summary>Date format to use</summary>

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:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/gschemas/org.gnucash.dialogs.gschema.xml.in	2013-10-07 14:14:11 UTC (rev 23241)
@@ -72,6 +72,11 @@
   </schema>
 
   <schema id="org.gnucash.dialogs.tax_info" path="/apps/gnucash/dialogs/tax_info/">
+    <key name="paned_position" type="i">
+      <default>0</default>
+      <summary>Position of the horizontal pane divider.</summary>
+      <description>Position of the horizontal pane divider.</description>
+    </key>
     <key name="last-geometry" type="(iiii)">
       <default>(-1,-1,-1,-1)</default>
       <summary>Last window position and size</summary>
@@ -169,6 +174,16 @@
   </schema>
 
   <schema id="org.gnucash.dialogs.lot_viewer" path="/apps/gnucash/dialogs/lot_viewer/">
+    <key name="hpane_position" type="i">
+      <default>200</default>
+      <summary>Position of the horizontal pane divider.</summary>
+      <description>Position of the horizontal pane divider.</description>
+    </key>
+    <key name="vpane_position" type="i">
+      <default>200</default>
+      <summary>Position of the vertical pane divider.</summary>
+      <description>Position of the vertical pane divider.</description>
+    </key>
     <key name="last-geometry" type="(iiii)">
       <default>(-1,-1,-1,-1)</default>
       <summary>Last window position and size</summary>

Modified: gnucash/trunk/src/gnome/gtkbuilder/dialog-lot-viewer.glade
===================================================================
--- gnucash/trunk/src/gnome/gtkbuilder/dialog-lot-viewer.glade	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome/gtkbuilder/dialog-lot-viewer.glade	2013-10-07 14:14:11 UTC (rev 23241)
@@ -18,7 +18,6 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="position">200</property>
-            <signal name="notify" handler="lv_paned_notify_cb"/>
             <child>
               <object class="GtkHPaned" id="lot hpaned">
                 <property name="width_request">300</property>
@@ -27,7 +26,6 @@
                 <property name="can_focus">True</property>
                 <property name="border_width">3</property>
                 <property name="position">200</property>
-                <signal name="notify" handler="lv_paned_notify_cb"/>
                 <child>
                   <object class="GtkTable" id="table1">
                     <property name="visible">True</property>

Modified: gnucash/trunk/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-preferences.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome-utils/dialog-preferences.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -752,76 +752,6 @@
 
 /****************************************************************************/
 
-/** The user changed a combo box.  Update gconf.  Combo box
- *  choices are stored as an int.
- *
- *  @internal
- *
- *  @param box A pointer to the combo box that was changed.
- *
- *  @param user_data Unused.
- */
-static void
-gnc_prefs_combo_box_user_cb_gconf (GtkComboBox *box,
-                             gpointer user_data)
-{
-    const gchar *name;
-    gint active;
-
-    g_return_if_fail(GTK_IS_COMBO_BOX(box));
-    name = gtk_buildable_get_name(GTK_BUILDABLE(box)) + PREFIX_LEN;
-    active = gtk_combo_box_get_active(box);
-    DEBUG("Combo box %s set to item %d", name, active);
-    gnc_gconf_set_int(name, NULL, active, NULL);
-}
-
-
-/** A combo box choice was updated in gconf.  Update the user
- *  visible dialog.
- *
- *  @internal
- *
- *  @param box A pointer to the combo box that changed.
- *
- *  @param value The new value of the combo box.
- */
-static void
-gnc_prefs_combo_box_gconf_cb_gconf (GtkComboBox *box,
-                              gint value)
-{
-    g_return_if_fail(GTK_IS_COMBO_BOX(box));
-    ENTER("box %p, value %d", box, value);
-    g_signal_handlers_block_by_func(G_OBJECT(box),
-                                    G_CALLBACK(gnc_prefs_combo_box_user_cb_gconf), NULL);
-    gtk_combo_box_set_active(box, value);
-    g_signal_handlers_unblock_by_func(G_OBJECT(box),
-                                      G_CALLBACK(gnc_prefs_combo_box_user_cb_gconf), NULL);
-    LEAVE(" ");
-}
-
-
-/** Connect a combo box widget to the user callback function.  Set
- *  the starting state of the box from its value in gconf.
- *
- *  @internal
- *
- *  @param box A pointer to the combo box that should be connected.
- */
-static void
-gnc_prefs_connect_combo_box_gconf (GtkComboBox *box)
-{
-    const gchar *name;
-    gint active;
-
-    g_return_if_fail(GTK_IS_COMBO_BOX(box));
-    name = gtk_buildable_get_name(GTK_BUILDABLE(box)) + PREFIX_LEN;
-    active = gnc_gconf_get_int(name, NULL, NULL);
-    gtk_combo_box_set_active(GTK_COMBO_BOX(box), active);
-    DEBUG(" Combo box %s set to item %d", name, active);
-    g_signal_connect(G_OBJECT(box), "changed",
-                     G_CALLBACK(gnc_prefs_combo_box_user_cb_gconf), NULL);
-}
-
 /****************************************************************************/
 
 /** The user changed a currency_edit.  Update gconf.  Currency_edit
@@ -1263,8 +1193,36 @@
     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;
+    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);
+}
+
+
+
 /****************************************************************************/
 
 /********************/
@@ -1338,11 +1296,6 @@
         DEBUG("  %s - radio button", name);
         gnc_prefs_connect_radio_button_gconf(GTK_RADIO_BUTTON(widget));
     }
-    else if (GTK_IS_COMBO_BOX(widget))
-    {
-        DEBUG("  %s - combo box", name);
-        gnc_prefs_connect_combo_box_gconf(GTK_COMBO_BOX(widget));
-    }
     else if (GTK_IS_ENTRY(widget))
     {
         DEBUG("  %s - entry", name);
@@ -1416,6 +1369,11 @@
         DEBUG("  %s - spin button", name);
         gnc_prefs_connect_spin_button(GTK_SPIN_BUTTON(widget));
     }
+    else if (GTK_IS_COMBO_BOX(widget))
+    {
+        DEBUG("  %s - combo box", name);
+        gnc_prefs_connect_combo_box(GTK_COMBO_BOX(widget));
+    }
     else
     {
         DEBUG("  %s - unsupported %s", name,
@@ -1669,12 +1627,6 @@
             DEBUG("widget %p - radio button", widget);
             gnc_prefs_radio_button_gconf_cb_gconf(GTK_RADIO_BUTTON(widget));
         }
-        else if (GTK_IS_COMBO_BOX(widget))
-        {
-            DEBUG("widget %p - combo_box", widget);
-            gnc_prefs_combo_box_gconf_cb_gconf(GTK_COMBO_BOX(widget),
-                                         gconf_value_get_int(entry->value));
-        }
         else if (GTK_IS_ENTRY(widget))
         {
             DEBUG("widget %p - entry", widget);

Modified: gnucash/trunk/src/gnome-utils/dialog-totd.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-totd.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/gnome-utils/dialog-totd.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -31,14 +31,12 @@
 #include "dialog-utils.h"
 #include "gnc-component-manager.h"
 #include "gnc-filepath-utils.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-prefs.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-engine.h"
 
-#define GCONF_SECTION   "dialogs/tip_of_the_day"
 #define GNC_PREFS_GROUP      "dialogs.totd"
-#define KEY_CURRENT_TIP "current_tip"
+#define GNC_PREF_CURRENT_TIP "current_tip"
 #define GNC_PREF_SHOW_TIPS   "show_at_startup"
 #define DIALOG_TOTD_CM_CLASS "dialog-totd"
 
@@ -68,7 +66,7 @@
 /***********************************************************************
  *  This function should be called to change the tip number.  It
  *  handles clamping the number to the range of tips available, saving
- *  the number in the GConf database, and updating the dialog window
+ *  the number in the preferences database, and updating the dialog window
  *  with the text of the newly selected tip.
  *
  *  @param Tip of the day structure. This points to the dialog and
@@ -93,7 +91,7 @@
         current_tip_number = tip_count - 1;
     if (current_tip_number >= tip_count)
         current_tip_number = 0;
-    gnc_gconf_set_int(GCONF_SECTION, KEY_CURRENT_TIP, current_tip_number, NULL);
+    gnc_prefs_set_int(GNC_PREFS_GROUP, GNC_PREF_CURRENT_TIP, current_tip_number);
 
     /* A tip consists of a translatable string, which might contain a %s
      * placeholder, optionally followed by a | and a (non-translated)
@@ -322,7 +320,7 @@
     {
         if (!gnc_totd_initialize())
             return;
-        current_tip_number =  gnc_gconf_get_int(GCONF_SECTION, KEY_CURRENT_TIP, NULL);
+        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))

Modified: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c
===================================================================
--- gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/import-export/csv-export/assistant-csv-export.c	2013-10-07 14:14:11 UTC (rev 23241)
@@ -34,7 +34,6 @@
 #include "gnc-uri-utils.h"
 #include "gnc-component-manager.h"
 #include "gnc-date-edit.h"
-#include "gnc-gconf-utils.h"
 #include "gnc-prefs.h"
 #include "gnc-tree-view-account.h"
 #include "dialog-utils.h"
@@ -46,9 +45,8 @@
 #include "csv-tree-export.h"
 #include "csv-transactions-export.h"
 
-#define GCONF_SECTION "dialogs/export/csv"
-#define GNC_PREFS_GROUP  "dialogs.export.csv"
-#define PANED_POSITION "paned_position"
+#define GNC_PREFS_GROUP    "dialogs.export.csv"
+#define GNC_PREF_PANED_POS "paned_position"
 #define ASSISTANT_CSV_EXPORT_CM_CLASS "assistant-csv-export"
 
 /* This static indicates the debugging module that this .o belongs to.  */
@@ -746,13 +744,6 @@
 {
     CsvExportInfo *info = user_data;
     gchar *text, *mtext;
-
-    /* Save the Window size, paned position and directory */
-    if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
-    {
-        gnc_gconf_set_int(GCONF_SECTION, PANED_POSITION,
-                          gtk_paned_get_position(GTK_PANED(info->csva.paned)), NULL);
-    }
     gnc_set_default_directory(GNC_PREFS_GROUP, info->starting_dir);
 
     if (info->failed)
@@ -1009,13 +1000,10 @@
                       G_CALLBACK (csv_export_assistant_destroy_cb), info);
 
     gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(info->window));
-
-    info->csva.paned = GTK_WIDGET(gtk_builder_get_object (builder, "paned"));
-
     if (gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
     {
-        gint position = gnc_gconf_get_int(GCONF_SECTION, PANED_POSITION, NULL);
-        gtk_paned_set_position(GTK_PANED(info->csva.paned), position);
+        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);

Modified: gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h
===================================================================
--- gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h	2013-10-07 14:13:51 UTC (rev 23240)
+++ gnucash/trunk/src/import-export/csv-export/assistant-csv-export.h	2013-10-07 14:14:11 UTC (rev 23241)
@@ -52,7 +52,6 @@
 
 typedef struct
 {
-    GtkWidget        *paned;
     GtkWidget        *acct_info;
     GtkWidget        *expense_radio;
     GtkWidget        *asset_radio;



More information about the gnucash-changes mailing list