[Gnucash-changes] Collapse knowledge of desktop gconf keys into a single file.

David Hampton hampton at cvs.gnucash.org
Mon Apr 25 00:07:56 EDT 2005


Log Message:
-----------
Collapse knowledge of desktop gconf keys into a single file.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash/src/business/business-gnome:
        dialog-billterms.c
        dialog-invoice.c
    gnucash/src/core-utils:
        gnc-gconf-utils.h
    gnucash/src/gnome:
        gnc-split-reg.c
        window-main.c
        window-reconcile.c
        window-register.c
    gnucash/src/gnome-utils:
        gnc-mdi-utils.c

Revision Data
-------------
Index: dialog-invoice.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/dialog-invoice.c,v
retrieving revision 1.81.4.13
retrieving revision 1.81.4.14
diff -Lsrc/business/business-gnome/dialog-invoice.c -Lsrc/business/business-gnome/dialog-invoice.c -u -r1.81.4.13 -r1.81.4.14
--- src/business/business-gnome/dialog-invoice.c
+++ src/business/business-gnome/dialog-invoice.c
@@ -24,7 +24,6 @@
 #include "config.h"
 
 #include <gnome.h>
-#include <gconf/gconf-client.h>
 #include <g-wrap-wct.h>
 #include <libguile.h>
 
@@ -1055,7 +1054,6 @@
 {
   GtkWidget *popup;
   GladeXML *xml;
-  GConfClient *client;
 
   xml = gnc_glade_xml_new ("invoice.glade", "Invoice Window Popup Menu");
 
@@ -1064,8 +1062,7 @@
   glade_xml_signal_autoconnect_full (xml, gnc_glade_autoconnect_full_func, iw);
 
   /* Glade insists on making this a tearoff menu. */
-  client = gconf_client_get_default ();
-  if (gconf_client_get_bool (client, "/desktop/gnome/interface/menus_have_tearoff", NULL)) {
+  if (gnc_gconf_menus_have_tearoff()) {
     GtkMenuShell *ms = GTK_MENU_SHELL (popup);
     GtkWidget *tearoff;
 
Index: dialog-billterms.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/business/business-gnome/dialog-billterms.c,v
retrieving revision 1.4.4.10
retrieving revision 1.4.4.11
diff -Lsrc/business/business-gnome/dialog-billterms.c -Lsrc/business/business-gnome/dialog-billterms.c -u -r1.4.4.10 -r1.4.4.11
--- src/business/business-gnome/dialog-billterms.c
+++ src/business/business-gnome/dialog-billterms.c
@@ -24,7 +24,6 @@
 #include "config.h"
 
 #include <gnome.h>
-#include <gconf/gconf-client.h>
 
 #include "dialog-utils.h"
 #include "gnc-component-manager.h"
@@ -362,15 +361,13 @@
 {
   GladeXML *xml;
   GtkWidget *popup;
-  GConfClient *client;
 
   /* Open and read the Popup XML */
   xml = gnc_glade_xml_new ("billterms.glade", "Term Type Popup");
   popup = glade_xml_get_widget (xml, "Term Type Popup");
 
   /* Glade insists on making this a tearoff menu. */
-  client = gconf_client_get_default ();
-  if (gconf_client_get_bool (client, "/desktop/gnome/interface/menus_have_tearoff", NULL)) {
+  if (gnc_gconf_menus_have_tearoff()) {
     GtkMenuShell *ms = GTK_MENU_SHELL (popup);
     GtkWidget *tearoff;
 
Index: gnc-gconf-utils.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/core-utils/Attic/gnc-gconf-utils.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -Lsrc/core-utils/gnc-gconf-utils.h -Lsrc/core-utils/gnc-gconf-utils.h -u -r1.1.2.1 -r1.1.2.2
--- src/core-utils/gnc-gconf-utils.h
+++ src/core-utils/gnc-gconf-utils.h
@@ -492,6 +492,33 @@
 				    const gchar *section);
 /** @} */
 
+/** @name GConf One Liners */
+/** @{ */
+
+#define DESTKOP_TEAROFF_MENUS "/desktop/gnome/interface/menus_have_tearoff"
+#define DESTKOP_MENUBAR_DETACHABLE "/desktop/gnome/interface/menubar_detachable"
+#define DESTKOP_TOOLBAR_DETACHABLE "/desktop/gnome/interface/toolbar_detachable"
+
+static inline gboolean
+gnc_gconf_menus_have_tearoff (void)
+{
+  return gnc_gconf_get_bool(DESTKOP_TEAROFF_MENUS, NULL, NULL);
+}
+
+static inline gboolean
+gnc_gconf_menubar_detachable (void)
+{
+  return gnc_gconf_get_bool(DESTKOP_MENUBAR_DETACHABLE, NULL, NULL);
+}
+
+static inline gboolean
+gnc_gconf_toolbar_detachable (void)
+{
+  return gnc_gconf_get_bool(DESTKOP_TOOLBAR_DETACHABLE, NULL, NULL);
+}
+
+/** @} */
+
 #endif /* GNC_GCONF_UTILS_H */
 /** @} */
 /** @} */
Index: window-main.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/window-main.c,v
retrieving revision 1.180.4.16
retrieving revision 1.180.4.17
diff -Lsrc/gnome/window-main.c -Lsrc/gnome/window-main.c -u -r1.180.4.16 -r1.180.4.17
--- src/gnome/window-main.c
+++ src/gnome/window-main.c
@@ -191,7 +191,7 @@
     behavior = (BONOBO_DOCK_ITEM_BEH_EXCLUSIVE |
                 BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL);
     client = gconf_client_get_default ();
-    if (!gconf_client_get_bool (client, "/desktop/gnome/interface/toolbar_detachable", NULL))
+    if (!gnc_gconf_toolbar_detachable()))
       behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
     g_object_unref(client);
 
Index: window-register.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/window-register.c,v
retrieving revision 1.198.4.16
retrieving revision 1.198.4.17
diff -Lsrc/gnome/window-register.c -Lsrc/gnome/window-register.c -u -r1.198.4.16 -r1.198.4.17
--- src/gnome/window-register.c
+++ src/gnome/window-register.c
@@ -32,7 +32,6 @@
 #include <gnome.h>
 #include <time.h>
 #include <g-wrap-wct.h>
-#include <gconf/gconf-client.h>
 
 #include "Scrub.h"
 #include "dialog-account.h"
@@ -46,6 +45,7 @@
 #include "gnc-date-edit.h"
 #include "gnc-engine-util.h"
 #include "gnc-euro.h"
+#include "gnc-gconf-utils.h"
 #include "gnc-gui-query.h"
 #include "gnc-ledger-display.h"
 #include "gnc-menu-extensions.h"
@@ -1025,7 +1025,6 @@
 {
   int adj = 0;
   GtkWidget *mbar, *menu, *regMenu, *regMenuItem, *tmpMi;
-  GConfClient *client;
 
   /* Get our menu bar from glade. */
   mbar = glade_xml_get_widget( xml, "gnc_register_menubar" );
@@ -1038,8 +1037,7 @@
    * . remove the RegWindow menu from the menu bar, saving it's index.
    * . insert the GNCSplitReg menu at the same index.
    * . destroy now-unused widgets. */
-  client = gconf_client_get_default ();
-  if ( gconf_client_get_bool (client, "/desktop/gnome/interface/menus_have_tearoff", NULL) ) {
+  if ( gnc_gconf_menus_have_tearoff() ) {
     /* offset by one for the tearoff menu item. */
     adj = 1;
   }
Index: window-reconcile.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/window-reconcile.c,v
retrieving revision 1.103.4.10
retrieving revision 1.103.4.11
diff -Lsrc/gnome/window-reconcile.c -Lsrc/gnome/window-reconcile.c -u -r1.103.4.10 -r1.103.4.11
--- src/gnome/window-reconcile.c
+++ src/gnome/window-reconcile.c
@@ -35,7 +35,6 @@
 #include <stdio.h>
 #include <time.h>
 #include <libgnomeui/gnome-window-icon.h>
-#include <gconf/gconf-client.h>
 
 #include "Scrub.h"
 #include "dialog-account.h"
@@ -48,6 +47,7 @@
 #include "gnc-date.h"
 #include "gnc-date-edit.h"
 #include "gnc-engine-util.h"
+#include "gnc-gconf-utils.h"
 #include "gnc-gui-query.h"
 #include "gnc-ledger-display.h"
 #include "gnc-main-window.h"
@@ -1661,7 +1661,6 @@
   GtkWidget *statusbar;
   GtkWidget *vbox;
   GtkWidget *dock;
-  GConfClient *client;
 
   if (account == NULL)
     return NULL;
@@ -1671,8 +1670,6 @@
   if (recnData)
     return recnData;
 
-  client = gconf_client_get_default ();
-  
   recnData = g_new0 (RecnWindow, 1);
 
   recnData->account = *xaccAccountGetGUID (account);
@@ -1714,7 +1711,7 @@
     GtkWidget *menubar;
 
     behavior = BONOBO_DOCK_ITEM_BEH_EXCLUSIVE;
-    if (!gconf_client_get_bool (client, "/desktop/gnome/interface/menubar_detachable", NULL))
+    if (!gnc_gconf_menubar_detachable())
       behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
 
     dock_item = bonobo_dock_item_new("menu", behavior);
@@ -1735,7 +1732,7 @@
     SCM id;
 
     behavior = BONOBO_DOCK_ITEM_BEH_EXCLUSIVE;
-    if (!gconf_client_get_bool (client, "/desktop/gnome/interface/toolbar_detachable", NULL))
+    if (!gnc_gconf_toolbar_detachable())
       behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
 
     dock_item = bonobo_dock_item_new("toolbar", behavior);
@@ -1898,7 +1895,6 @@
   gnc_window_adjust_for_screen(GTK_WINDOW(recnData->window));
 
   gtk_widget_grab_focus (recnData->debit);
-  g_object_unref(client);
 
   return recnData;
 }
Index: gnc-split-reg.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/gnc-split-reg.c,v
retrieving revision 1.19.4.17
retrieving revision 1.19.4.18
diff -Lsrc/gnome/gnc-split-reg.c -Lsrc/gnome/gnc-split-reg.c -u -r1.19.4.17 -r1.19.4.18
--- src/gnome/gnc-split-reg.c
+++ src/gnome/gnc-split-reg.c
@@ -31,7 +31,6 @@
 
 #include <gnome.h>
 #include <time.h>
-#include <gconf/gconf-client.h>
 
 #include "gnc-split-reg.h"
 
@@ -49,6 +48,7 @@
 #include "gnc-engine-util.h"
 #include "gnc-err-popup.h"
 #include "gnc-euro.h"
+#include "gnc-gconf-utils.h"
 #include "gnc-gui-query.h"
 #include "gnc-ledger-display.h"
 #include "gnc-pricedb.h"
@@ -2095,7 +2095,6 @@
 {
   GtkWidget *popup, *menuitem;
   GladeXML *xml;
-  GConfClient *client;
 
   xml = gnc_glade_xml_new( "register.glade", "register_popup" );
   popup = glade_xml_get_widget( xml, "register_popup" );
@@ -2103,9 +2102,8 @@
                                      gnc_glade_autoconnect_full_func,
                                      gsr );
 
-  client = gconf_client_get_default ();
   /* Glade insists on making this a tearoff menu. */
-  if (gconf_client_get_bool (client, "/desktop/gnome/interface/menus_have_tearoff", NULL)) {
+  if (gnc_gconf_menus_have_tearoff()) {
     GtkMenuShell *ms = GTK_MENU_SHELL(popup);
     GtkWidget *tearoff;
 
@@ -2113,7 +2111,6 @@
     ms->children = g_list_remove(ms->children, tearoff);
     gtk_widget_destroy(tearoff);
   }
-  g_object_unref(client);
 
   gsr->split_popup_check = glade_xml_get_widget( xml, "popup_splits" );
 
Index: gnc-mdi-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-mdi-utils.c,v
retrieving revision 1.18.4.14
retrieving revision 1.18.4.15
diff -Lsrc/gnome-utils/gnc-mdi-utils.c -Lsrc/gnome-utils/gnc-mdi-utils.c -u -r1.18.4.14 -r1.18.4.15
--- src/gnome-utils/gnc-mdi-utils.c
+++ src/gnome-utils/gnc-mdi-utils.c
@@ -24,13 +24,13 @@
 #include "config.h"
 
 #include <gnome.h>
-#include <gconf/gconf-client.h>
 
 #include "dialog-utils.h"
 #include "global-options.h"
 #include "gnc-book.h"
 #include "gnc-component-manager.h"
 #include "gnc-engine-util.h"
+#include "gnc-gconf-utils.h"
 #include "gnc-html.h"
 #include "gnc-mdi-utils.h"
 #include "gnc-session.h"
@@ -782,7 +782,6 @@
   GtkWidget        * oldbar;
   GnomeApp         * new_app = NULL; 
   BonoboDockItemBehavior behavior;
-  GConfClient      * client;
 
   ENTER(" ");
   if (prev_child)
@@ -799,10 +798,8 @@
   }
 
   behavior = BONOBO_DOCK_ITEM_BEH_EXCLUSIVE;
-  client = gconf_client_get_default ();
-  if (!gconf_client_get_bool (client, "/desktop/gnome/interface/toolbar_detachable", NULL))
+  if (!gnc_gconf_toolbar_detachable())
     behavior |= BONOBO_DOCK_ITEM_BEH_LOCKED;
-  g_object_unref(client);
 
   if (childwin && childwin->toolbar)
   {


More information about the gnucash-changes mailing list