devhelp r1135 - in trunk: . data/ui src



Author: rhult
Date: Sat Oct  4 19:10:44 2008
New Revision: 1135
URL: http://svn.gnome.org/viewvc/devhelp?rev=1135&view=rev

Log:
2008-10-04  Richard Hult  <richard imendio com>

	* data/ui/devhelp.glade: Remove the "advanced options"
	preference. Also remove lots of old unused parts, only keep the
	preference dialog.

	* configure.in: Add AC_PROG_OBJC so we can build ObjC sources.

	* src/Makefile.am:
	* src/ige-conf.h:
	* src/ige-conf-gconf.h:
	* src/ige-conf-mac.h: Add tiny layer on top of gconf and
	nsdefaults.

	* src/dh-base.[ch]: Remove gconf client.

	* src/dh-preferences.c:
	* src/dh-search.c:
	* src/dh-window.c: Use the conf abstraction.


Added:
   trunk/src/ige-conf-gconf.c
   trunk/src/ige-conf-mac.m
   trunk/src/ige-conf.h
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/data/ui/devhelp.glade
   trunk/src/Makefile.am
   trunk/src/dh-base.c
   trunk/src/dh-base.h
   trunk/src/dh-preferences.c
   trunk/src/dh-search.c
   trunk/src/dh-window.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sat Oct  4 19:10:44 2008
@@ -8,6 +8,7 @@
 
 AC_PROG_CC
 AC_PROG_CPP
+AC_PROG_OBJC
 AM_PROG_CC_C_O
 
 AM_PATH_GLIB_2_0

Modified: trunk/data/ui/devhelp.glade
==============================================================================
--- trunk/data/ui/devhelp.glade	(original)
+++ trunk/data/ui/devhelp.glade	Sat Oct  4 19:10:44 2008
@@ -2,338 +2,6 @@
 <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
 
 <glade-interface>
-<requires lib="gnome"/>
-<requires lib="bonobo"/>
-
-<widget class="GnomeApp" id="devhelp_app">
-  <property name="visible">True</property>
-  <property name="title" translatable="yes">Devhelp</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <property name="enable_layout_config">True</property>
-
-  <child internal-child="dock">
-    <widget class="BonoboDock" id="bonobodock1">
-      <property name="visible">True</property>
-      <property name="allow_floating">True</property>
-
-      <child>
-	<widget class="BonoboDockItem" id="bonobodockitem1">
-	  <property name="visible">True</property>
-	  <property name="shadow_type">GTK_SHADOW_NONE</property>
-
-	  <child>
-	    <widget class="GtkMenuBar" id="menubar1">
-	      <property name="visible">True</property>
-	      <property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
-	      <property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
-
-	      <child>
-		<widget class="GtkMenuItem" id="file1">
-		  <property name="visible">True</property>
-		  <property name="stock_item">GNOMEUIINFO_MENU_FILE_TREE</property>
-
-		  <child>
-		    <widget class="GtkMenu" id="file1_menu">
-
-		      <child>
-			<widget class="GtkImageMenuItem" id="quit1">
-			  <property name="visible">True</property>
-			  <property name="stock_item">GNOMEUIINFO_MENU_EXIT_ITEM</property>
-			  <signal name="activate" handler="on_quit1_activate" last_modification_time="Mon, 15 Mar 2004 19:57:51 GMT"/>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-
-	      <child>
-		<widget class="GtkMenuItem" id="edit1">
-		  <property name="visible">True</property>
-		  <property name="stock_item">GNOMEUIINFO_MENU_EDIT_TREE</property>
-
-		  <child>
-		    <widget class="GtkMenu" id="edit1_menu">
-
-		      <child>
-			<widget class="GtkImageMenuItem" id="copy1">
-			  <property name="visible">True</property>
-			  <property name="stock_item">GNOMEUIINFO_MENU_COPY_ITEM</property>
-			  <signal name="activate" handler="on_copy1_activate" last_modification_time="Mon, 15 Mar 2004 19:57:51 GMT"/>
-			</widget>
-		      </child>
-
-		      <child>
-			<widget class="GtkMenuItem" id="separator2">
-			  <property name="visible">True</property>
-			</widget>
-		      </child>
-
-		      <child>
-			<widget class="GtkImageMenuItem" id="properties1">
-			  <property name="visible">True</property>
-			  <property name="stock_item">GNOMEUIINFO_MENU_PREFERENCES_ITEM</property>
-			  <signal name="activate" handler="on_properties1_activate" last_modification_time="Mon, 15 Mar 2004 19:57:51 GMT"/>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-
-	      <child>
-		<widget class="GtkMenuItem" id="go1">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">_Go</property>
-		  <property name="use_underline">True</property>
-
-		  <child>
-		    <widget class="GtkMenu" id="go1_menu">
-
-		      <child>
-			<widget class="GtkImageMenuItem" id="back1">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">_Back</property>
-			  <property name="use_underline">True</property>
-			  <signal name="activate" handler="on_back1_activate" last_modification_time="Mon, 15 Mar 2004 20:00:32 GMT"/>
-
-			  <child internal-child="image">
-			    <widget class="GtkImage" id="image2">
-			      <property name="visible">True</property>
-			      <property name="stock">gtk-go-back</property>
-			      <property name="icon_size">1</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-
-		      <child>
-			<widget class="GtkImageMenuItem" id="forward1">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">_Forward</property>
-			  <property name="use_underline">True</property>
-			  <signal name="activate" handler="on_forward1_activate" last_modification_time="Mon, 15 Mar 2004 20:00:32 GMT"/>
-
-			  <child internal-child="image">
-			    <widget class="GtkImage" id="image3">
-			      <property name="visible">True</property>
-			      <property name="stock">gtk-go-forward</property>
-			      <property name="icon_size">1</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-
-	      <child>
-		<widget class="GtkMenuItem" id="help1">
-		  <property name="visible">True</property>
-		  <property name="stock_item">GNOMEUIINFO_MENU_HELP_TREE</property>
-
-		  <child>
-		    <widget class="GtkMenu" id="help1_menu">
-
-		      <child>
-			<widget class="GtkImageMenuItem" id="about1">
-			  <property name="visible">True</property>
-			  <property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property>
-			  <signal name="activate" handler="on_about1_activate" last_modification_time="Mon, 15 Mar 2004 19:57:51 GMT"/>
-			</widget>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="placement">BONOBO_DOCK_TOP</property>
-	  <property name="band">0</property>
-	  <property name="position">0</property>
-	  <property name="offset">0</property>
-	  <property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL|BONOBO_DOCK_ITEM_BEH_LOCKED</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="BonoboDockItem" id="bonobodockitem2">
-	  <property name="visible">True</property>
-	  <property name="shadow_type">GTK_SHADOW_OUT</property>
-
-	  <child>
-	    <widget class="GtkToolbar" id="toolbar1">
-	      <property name="visible">True</property>
-	      <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
-	      <property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
-	      <property name="tooltips">True</property>
-	      <property name="show_arrow">True</property>
-
-	      <child>
-		<widget class="GtkToolButton" id="toolbutton3">
-		  <property name="visible">True</property>
-		  <property name="stock_id">gtk-go-back</property>
-		  <property name="visible_horizontal">True</property>
-		  <property name="visible_vertical">True</property>
-		  <property name="is_important">False</property>
-		</widget>
-		<packing>
-		  <property name="expand">False</property>
-		  <property name="homogeneous">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkToolButton" id="toolbutton4">
-		  <property name="visible">True</property>
-		  <property name="stock_id">gtk-go-forward</property>
-		  <property name="visible_horizontal">True</property>
-		  <property name="visible_vertical">True</property>
-		  <property name="is_important">False</property>
-		</widget>
-		<packing>
-		  <property name="expand">False</property>
-		  <property name="homogeneous">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="placement">BONOBO_DOCK_TOP</property>
-	  <property name="band">1</property>
-	  <property name="position">0</property>
-	  <property name="offset">0</property>
-	  <property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkHPaned" id="hpaned">
-	  <property name="visible">True</property>
-	  <property name="can_focus">True</property>
-	  <property name="position">0</property>
-
-	  <child>
-	    <widget class="GtkNotebook" id="notebook">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="show_tabs">True</property>
-	      <property name="show_border">True</property>
-	      <property name="tab_pos">GTK_POS_TOP</property>
-	      <property name="scrollable">False</property>
-	      <property name="enable_popup">False</property>
-
-	      <child>
-		<widget class="GtkScrolledWindow" id="book_tree_sw">
-		  <property name="border_width">2</property>
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-		  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-		  <property name="shadow_type">GTK_SHADOW_IN</property>
-		  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-		  <child>
-		    <placeholder/>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="tab_expand">False</property>
-		  <property name="tab_fill">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="label2">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Contents</property>
-		  <property name="use_underline">False</property>
-		  <property name="use_markup">False</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="type">tab</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="shrink">True</property>
-	      <property name="resize">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkFrame" id="html_frame">
-	      <property name="visible">True</property>
-	      <property name="label_xalign">0</property>
-	      <property name="label_yalign">0.5</property>
-	      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
-	      <child>
-		<placeholder/>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="shrink">True</property>
-	      <property name="resize">True</property>
-	    </packing>
-	  </child>
-	</widget>
-      </child>
-    </widget>
-    <packing>
-      <property name="padding">0</property>
-      <property name="expand">True</property>
-      <property name="fill">True</property>
-    </packing>
-  </child>
-
-  <child internal-child="appbar">
-    <widget class="GnomeAppBar" id="appbar1">
-      <property name="visible">True</property>
-      <property name="has_progress">True</property>
-      <property name="has_status">True</property>
-    </widget>
-    <packing>
-      <property name="padding">0</property>
-      <property name="expand">True</property>
-      <property name="fill">True</property>
-    </packing>
-  </child>
-</widget>
 
 <widget class="GtkDialog" id="preferences_dialog">
   <property name="border_width">5</property>
@@ -392,77 +60,6 @@
 	  <property name="spacing">18</property>
 
 	  <child>
-	    <widget class="GtkVBox" id="search_vbox">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">6</property>
-
-	      <child>
-		<widget class="GtkLabel" id="label10">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Searching&lt;/b&gt;</property>
-		  <property name="use_underline">False</property>
-		  <property name="use_markup">True</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkAlignment" id="alignment2">
-		  <property name="visible">True</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">1</property>
-		  <property name="yscale">1</property>
-		  <property name="top_padding">0</property>
-		  <property name="bottom_padding">0</property>
-		  <property name="left_padding">12</property>
-		  <property name="right_padding">0</property>
-
-		  <child>
-		    <widget class="GtkCheckButton" id="advanced_button">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="label" translatable="yes">_Show advanced search options</property>
-		      <property name="use_underline">True</property>
-		      <property name="relief">GTK_RELIEF_NORMAL</property>
-		      <property name="focus_on_click">True</property>
-		      <property name="active">True</property>
-		      <property name="inconsistent">False</property>
-		      <property name="draw_indicator">True</property>
-		    </widget>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkVBox" id="font_vbox">
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sat Oct  4 19:10:44 2008
@@ -2,7 +2,8 @@
 	-DLOCALEDIR=\""$(datadir)/locale"\" 	  	\
 	-DPREFIX="\"$(prefix)"\"		 	\
 	-DDATADIR=\""$(datadir)"\"                      \
-	-DG_LOG_DOMAIN=\"Devhelp\"
+	-DG_LOG_DOMAIN=\"Devhelp\"			\
+	$(WARN_CFLAGS)
 
 bin_PROGRAMS = devhelp
 
@@ -12,8 +13,7 @@
 devhelp_CPPFLAGS =					\
 	$(AM_CPPFLAGS)
 
-devhelp_CFLAGS = 					\
-	$(WARN_CFLAGS)					\
+devhelp_CFLAGS =					\
 	$(DEVHELP_CFLAGS)
 
 devhelp_LDADD = 					\
@@ -30,9 +30,6 @@
 	dh-keyword-model.h				\
 	dh-link.h					\
 	dh-search.h					\
-	dh-parser.h					\
-	dh-preferences.h                                \
-	dh-util.h					\
 	dh-window.h
 
 libdevhelp_1_la_SOURCES =				\
@@ -50,15 +47,30 @@
 	dh-preferences.c				\
 	dh-util.c					\
 	dh-window.c					\
+	dh-parser.h					\
+	dh-preferences.h                                \
+	dh-util.h					\
 	eggfindbar.c					\
-	eggfindbar.h
+	eggfindbar.h					\
+	ige-conf.h
+
+if HAVE_PLATFORM_OSX
+libdevhelp_1_la_SOURCES +=				\
+	ige-conf-mac.m
+endif
+if HAVE_PLATFORM_X11
+libdevhelp_1_la_SOURCES +=				\
+	ige-conf-gconf.c
+endif
 
 libdevhelp_1_la_CPPFLAGS =				\
 	$(AM_CPPFLAGS)					\
 	$(ZLIB_CPPFLAGS)
 
-libdevhelp_1_la_CFLAGS = 				\
-	$(WARN_CFLAGS)					\
+libdevhelp_1_la_CFLAGS =				\
+	$(LIBDEVHELP_CFLAGS)
+
+libdevhelp_1_la_OBJCFLAGS =				\
 	$(LIBDEVHELP_CFLAGS)
 
 libdevhelp_1_la_LIBADD =				\

Modified: trunk/src/dh-base.c
==============================================================================
--- trunk/src/dh-base.c	(original)
+++ trunk/src/dh-base.c	Sat Oct  4 19:10:44 2008
@@ -25,7 +25,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
 
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
@@ -44,7 +43,6 @@
         GNode       *book_tree;
         GList       *keywords;
         GHashTable  *books;
-        GConfClient *gconf_client;
 } DhBasePriv;
 
 G_DEFINE_TYPE (DhBase, dh_base, G_TYPE_OBJECT);
@@ -68,9 +66,11 @@
 static void
 base_finalize (GObject *object)
 {
-        DhBasePriv *priv = GET_PRIVATE (object);
+        DhBasePriv *priv;
+
+        priv = GET_PRIVATE (object);
 
-        g_object_unref (priv->gconf_client);
+        /* FIXME: Free things... */
 
         G_OBJECT_CLASS (dh_base_parent_class)->finalize (object);
 }
@@ -111,12 +111,6 @@
                 }
         }
 #endif
-
-        priv->gconf_client = gconf_client_get_default ();
-        gconf_client_add_dir (priv->gconf_client,
-                              GCONF_PATH,
-                              GCONF_CLIENT_PRELOAD_ONELEVEL,
-                              NULL);
 }
 
 static void
@@ -570,18 +564,6 @@
 #endif
 }
 
-GConfClient *
-dh_base_get_gconf_client (DhBase *base)
-{
-        DhBasePriv *priv;
-
-        g_return_val_if_fail (DH_IS_BASE (base), NULL);
-
-        priv = GET_PRIVATE (base);
-
-        return priv->gconf_client;
-}
-
 GtkWidget *
 dh_base_get_window (DhBase *base)
 {

Modified: trunk/src/dh-base.h
==============================================================================
--- trunk/src/dh-base.h	(original)
+++ trunk/src/dh-base.h	Sat Oct  4 19:10:44 2008
@@ -24,7 +24,6 @@
 #define __DH_BASE_H__
 
 #include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
 
 typedef struct _DhBase      DhBase;
 typedef struct _DhBaseClass DhBaseClass;
@@ -53,6 +52,5 @@
 GNode *      dh_base_get_book_tree                   (DhBase *base);
 GList *      dh_base_get_keywords                    (DhBase *base);
 GSList *     dh_base_get_windows                     (DhBase *base);
-GConfClient *dh_base_get_gconf_client                (DhBase *base);
 
 #endif /* __DH_BASE_H__ */

Modified: trunk/src/dh-preferences.c
==============================================================================
--- trunk/src/dh-preferences.c	(original)
+++ trunk/src/dh-preferences.c	Sat Oct  4 19:10:44 2008
@@ -20,12 +20,11 @@
 
 #include "config.h"
 #include <glade/glade.h>
-#include <gconf/gconf-client.h>
 #include <gtk/gtk.h>
 #include <string.h>
-
 #include "dh-util.h" 
 #include "dh-preferences.h"
+#include "ige-conf.h"
 #include "dh-base.h"
 
 typedef struct {
@@ -43,45 +42,36 @@
 	guint      fixed_id;
 } DhPreferences;
 
-#define DH_PREFERENCES(x) ((DhPreferences *) x)
-
-static void     preferences_font_set_cb                 (GtkFontButton    *button,
-							 gpointer          user_data);
-static void     preferences_close_cb                    (GtkButton        *button,
-							 gpointer          user_data);
-static void     preferences_system_fonts_toggled_cb     (GtkToggleButton  *button,
-							 gpointer          user_data);
-static void     preferences_var_font_notify_cb          (GConfClient      *client,
-							 guint             cnxn_id,
-							 GConfEntry       *entry,
-							 gpointer          user_data);
-static void     preferences_fixed_font_notify_cb        (GConfClient      *client,
-							 guint             cnxn_id,
-							 GConfEntry       *entry,
-							 gpointer          user_data);
-static void     preferences_use_system_font_notify_cb   (GConfClient      *client,
-							 guint             cnxn_id,
-							 GConfEntry       *entry,
-							 gpointer          user_data);
-static void     preferences_connect_gconf_listeners     (void);
-static void     preferences_get_font_names              (gboolean          use_system_fonts,
-							 gchar           **variable,
-							 gchar           **fixed);
-static gboolean preferences_update_fonts                (gpointer          unused);
-
-
+static void     preferences_font_set_cb               (GtkFontButton    *button,
+                                                       gpointer          user_data);
+static void     preferences_close_cb                  (GtkButton        *button,
+                                                       gpointer          user_data);
+static void     preferences_system_fonts_toggled_cb   (GtkToggleButton  *button,
+                                                       gpointer          user_data);
+static void     preferences_var_font_notify_cb        (IgeConf          *client,
+                                                       const gchar      *path,
+                                                       gpointer          user_data);
+static void     preferences_fixed_font_notify_cb      (IgeConf          *client,
+                                                       const gchar      *path,
+                                                       gpointer          user_data);
+static void     preferences_use_system_font_notify_cb (IgeConf          *client,
+                                                       const gchar      *path,
+                                                       gpointer          user_data);
+static void     preferences_connect_conf_listeners    (void);
+static void     preferences_get_font_names            (gboolean          use_system_fonts,
+                                                       gchar           **variable,
+                                                       gchar           **fixed);
+static gboolean preferences_update_fonts              (gpointer          unused);
 
 static DhPreferences *prefs;
 
 static void
 preferences_font_set_cb (GtkFontButton *button, gpointer user_data)
 {
-	DhPreferences *prefs;
+	DhPreferences *prefs = user_data;
 	const gchar   *font_name;
 	const gchar   *key;
-	GConfClient   *gconf_client;
 
-	prefs = DH_PREFERENCES (user_data); 
 	font_name = gtk_font_button_get_font_name (button);
 
 	if (GTK_WIDGET (button) == prefs->variable_font_button) {
@@ -90,42 +80,13 @@
 		key = GCONF_FIXED_FONT;
 	}
 
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	gconf_client_set_string (gconf_client,
-				 key, font_name,
-				 NULL);
+	ige_conf_set_string (ige_conf_get (), key, font_name);
 }
 
-/* FIXME: I'd rather see the dialog and preference handling split up. In which
- * case this code would be useful:
- */
-/*
-static void
-preferences_destroy_cb (GtkWidget *dialog, DhPreferences *prefs)
-{
-	gconf_client_notify_remove (gconf_client,
-				    prefs->use_system_fonts_id);
-	
-	gconf_client_notify_remove (gconf_client,
-				    prefs->system_var_id);
-
-	gconf_client_notify_remove (gconf_client,
-					 prefs->system_fixed_id);
-	
-	gconf_client_notify_remove (gconf_client,
-				    prefs->var_id);
-	
-	gconf_client_notify_remove (gconf_client,
-				    prefs->fixed_id);
-}
-*/
-
 static void
 preferences_close_cb (GtkButton *button, gpointer user_data)
 {
-	DhPreferences *prefs;
-
-	prefs = DH_PREFERENCES (user_data);
+	DhPreferences *prefs = user_data;
 
 	gtk_widget_destroy (GTK_WIDGET (prefs->dialog));
 
@@ -140,44 +101,36 @@
 preferences_system_fonts_toggled_cb (GtkToggleButton *button, 
 				     gpointer         user_data)
 {
-	DhPreferences *prefs;
+	DhPreferences *prefs = user_data;
 	gboolean       active;
-	GConfClient   *gconf_client;
-
-	prefs = DH_PREFERENCES (user_data);
 
 	active = gtk_toggle_button_get_active (button);
 
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	gconf_client_set_bool (gconf_client,
-			       GCONF_USE_SYSTEM_FONTS,
-			       active, NULL);
+	ige_conf_set_bool (ige_conf_get (),
+                           GCONF_USE_SYSTEM_FONTS,
+                           active);
 	
 	gtk_widget_set_sensitive (prefs->fonts_table, !active);
 }
 
 static void
-preferences_var_font_notify_cb (GConfClient *client,
-				guint        cnxn_id,
-				GConfEntry  *entry,
+preferences_var_font_notify_cb (IgeConf     *client,
+				const gchar *path,
 				gpointer     user_data)
 {
-	DhPreferences *prefs;
+	DhPreferences *prefs = user_data;
 	gboolean       use_system_fonts;
-	const gchar   *font_name;
-	GConfClient   *gconf_client;
+	gchar         *font_name;
 
-	prefs = DH_PREFERENCES (user_data);
-
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	use_system_fonts = gconf_client_get_bool (gconf_client,
-						  GCONF_USE_SYSTEM_FONTS,
-						  NULL);
+        ige_conf_get_bool (ige_conf_get (),
+                           GCONF_USE_SYSTEM_FONTS,
+                           &use_system_fonts);
 
 	if (prefs->variable_font_button) {
-		font_name = gconf_value_get_string (gconf_entry_get_value (entry));
+		ige_conf_get_string (ige_conf_get (), path, &font_name);
 		gtk_font_button_set_font_name (GTK_FONT_BUTTON (prefs->variable_font_button),
 					       font_name);
+                g_free (font_name);
 	}
 	
 	if (use_system_fonts) {
@@ -188,27 +141,23 @@
 }
 
 static void
-preferences_fixed_font_notify_cb (GConfClient *client,
-				  guint        cnxn_id,
-				  GConfEntry  *entry,
+preferences_fixed_font_notify_cb (IgeConf     *client,
+				  const gchar *path,
 				  gpointer     user_data)
 {
-	DhPreferences *prefs;
+	DhPreferences *prefs = user_data;
 	gboolean       use_system_fonts;
-	const gchar   *font_name;
-	GConfClient   *gconf_client;
+	gchar         *font_name;
 
-	prefs = DH_PREFERENCES (user_data);
-
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	use_system_fonts = gconf_client_get_bool (gconf_client,
-						  GCONF_USE_SYSTEM_FONTS,
-						  NULL);
+	ige_conf_get_bool (ige_conf_get (),
+                           GCONF_USE_SYSTEM_FONTS,
+                           &use_system_fonts);
 
 	if (prefs->fixed_font_button) {
-		font_name = gconf_value_get_string (gconf_entry_get_value (entry));
+                ige_conf_get_string (ige_conf_get (), path, &font_name);
 		gtk_font_button_set_font_name (GTK_FONT_BUTTON (prefs->fixed_font_button),
 					       font_name);
+                g_free (font_name);
 	}
 
 	if (use_system_fonts) {
@@ -219,17 +168,14 @@
 }
 
 static void
-preferences_use_system_font_notify_cb (GConfClient *client,
-				       guint        cnxn_id,
-				       GConfEntry  *entry,
+preferences_use_system_font_notify_cb (IgeConf     *client,
+                                       const gchar *path,
 				       gpointer     user_data)
 {
-	DhPreferences *prefs;
+	DhPreferences *prefs = user_data;
 	gboolean       use_system_fonts;
 
-	prefs = DH_PREFERENCES (user_data);
-
-	use_system_fonts = gconf_value_get_bool (gconf_entry_get_value (entry));
+	ige_conf_get_bool (ige_conf_get (), path, &use_system_fonts);
 
 	if (prefs->system_fonts_button) {
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->system_fonts_button),
@@ -244,41 +190,37 @@
 }
 
 static void
-preferences_connect_gconf_listeners (void)
+preferences_connect_conf_listeners (void)
 {
-	GConfClient *gconf_client;
+	IgeConf *conf;
 	
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
+	conf = ige_conf_get ();
 
 	prefs->use_system_fonts_id =
-		gconf_client_notify_add (gconf_client,
-					 GCONF_USE_SYSTEM_FONTS,
-					 preferences_use_system_font_notify_cb,
-					 prefs, NULL, NULL);
-	
+		ige_conf_notify_add (conf,
+                                     GCONF_USE_SYSTEM_FONTS,
+                                     preferences_use_system_font_notify_cb,
+                                     prefs);
 	prefs->system_var_id =
-		gconf_client_notify_add (gconf_client,
-					 GCONF_SYSTEM_VARIABLE_FONT,
-					 preferences_var_font_notify_cb,
-					 prefs, NULL, NULL);
-
+		ige_conf_notify_add (conf,
+                                     GCONF_SYSTEM_VARIABLE_FONT,
+                                     preferences_var_font_notify_cb,
+                                     prefs);
 	prefs->system_fixed_id =
-		gconf_client_notify_add (gconf_client,
-					 GCONF_SYSTEM_FIXED_FONT,
-					 preferences_fixed_font_notify_cb,
-					 prefs, NULL, NULL);
-
+		ige_conf_notify_add (conf,
+                                     GCONF_SYSTEM_FIXED_FONT,
+                                     preferences_fixed_font_notify_cb,
+                                     prefs);
 	prefs->var_id =
-		gconf_client_notify_add (gconf_client,
-					 GCONF_VARIABLE_FONT,
-					 preferences_var_font_notify_cb,
-					 prefs, NULL, NULL);
-
+		ige_conf_notify_add (conf,
+                                     GCONF_VARIABLE_FONT,
+                                     preferences_var_font_notify_cb,
+                                     prefs);
 	prefs->fixed_id =
-		gconf_client_notify_add (gconf_client,
-					 GCONF_FIXED_FONT,
-					 preferences_fixed_font_notify_cb,
-					 prefs, NULL, NULL);
+		ige_conf_notify_add (conf,
+                                     GCONF_FIXED_FONT,
+                                     preferences_fixed_font_notify_cb,
+                                     prefs);
 }
 
 static void
@@ -286,25 +228,25 @@
 			    gchar    **variable,
 			    gchar    **fixed)
 {
-	gchar       *var_font_name, *fixed_font_name;
-	GConfClient *gconf_client;
+	gchar   *var_font_name, *fixed_font_name;
+	IgeConf *conf;
 
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
+	conf = ige_conf_get ();
 	
 	if (use_system_fonts) {
-		var_font_name = gconf_client_get_string (gconf_client,
-							 GCONF_SYSTEM_VARIABLE_FONT,
-							 NULL);
-		fixed_font_name = gconf_client_get_string (gconf_client,
-							   GCONF_SYSTEM_FIXED_FONT,
-							   NULL);
+		ige_conf_get_string (conf,
+                                     GCONF_SYSTEM_VARIABLE_FONT,
+                                     &var_font_name);
+		ige_conf_get_string (conf,
+                                     GCONF_SYSTEM_FIXED_FONT,
+                                     &fixed_font_name);
 	} else {
-		var_font_name = gconf_client_get_string (gconf_client,
-							 GCONF_VARIABLE_FONT, 
-							 NULL);
-		fixed_font_name = gconf_client_get_string (gconf_client,
-							   GCONF_FIXED_FONT,
-							   NULL);
+		ige_conf_get_string (conf,
+                                     GCONF_VARIABLE_FONT, 
+                                     &var_font_name);
+                ige_conf_get_string (conf,
+                                     GCONF_FIXED_FONT,
+                                     &fixed_font_name);
 	}
 
 	*variable = var_font_name;
@@ -314,20 +256,22 @@
 static gboolean
 preferences_update_fonts (gpointer unused)
 {
-	GConfClient *gconf_client;
-	gboolean     use_system_fonts;
-	gchar       *var_font_name;
-	gchar       *fixed_font_name;
-
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	use_system_fonts = gconf_client_get_bool (gconf_client,
-						  GCONF_USE_SYSTEM_FONTS,
-						  NULL);
+	IgeConf  *conf;
+	gboolean  use_system_fonts;
+	gchar    *var_font_name;
+	gchar    *fixed_font_name;
+
+	conf = ige_conf_get ();
+
+	ige_conf_get_bool (conf,
+                           GCONF_USE_SYSTEM_FONTS,
+                           &use_system_fonts);
 
 	preferences_get_font_names (use_system_fonts,
-				    &var_font_name, &fixed_font_name);
+				    &var_font_name,
+                                    &fixed_font_name);
 
-    /* FIXME: Set WebKit font preferences using WebSettings */
+        /* FIXME: Set WebKit font preferences using WebSettings. */
 
 	g_free (var_font_name);
 	g_free (fixed_font_name);
@@ -349,49 +293,48 @@
 dh_preferences_setup_fonts (void)
 {
 	preferences_update_fonts (NULL);
-	preferences_connect_gconf_listeners ();
+	preferences_connect_conf_listeners ();
 }
 
 
 void
 dh_preferences_show_dialog (GtkWindow *parent)
 {
-	gboolean     use_system_fonts;
-	gchar       *var_font_name, *fixed_font_name;
-	GladeXML    *gui;
-	GConfClient *gconf_client;
+	gboolean  use_system_fonts;
+	gchar    *var_font_name, *fixed_font_name;
+	GladeXML *gui;
 
 	if (prefs->dialog != NULL) {
-		/* Do something useful, although it should be visible at this
-		 * point anyway.
+		/* Do something useful, although it should be visible at
+		 * this point anyway.
 		 */
 		gtk_window_present (GTK_WINDOW (prefs->dialog));
 		return;
 	}
 
-	gui = dh_glade_get_file (DATADIR "/devhelp/devhelp.glade",
-				 "preferences_dialog",
-				 NULL,
-				 "preferences_dialog", &prefs->dialog,
-				 "fonts_table", &prefs->fonts_table,
-				 "system_fonts_button", &prefs->system_fonts_button,
-				 "variable_font_button", &prefs->variable_font_button,
-				 "fixed_font_button", &prefs->fixed_font_button,
-				 NULL);
-	
-	dh_glade_connect (gui,
-			  prefs,
-			  "variable_font_button", "font_set", preferences_font_set_cb,
-			  "fixed_font_button", "font_set", preferences_font_set_cb,
-			  "close_button", "clicked", preferences_close_cb,
-			  "system_fonts_button", "toggled", preferences_system_fonts_toggled_cb,
-			  NULL);
-
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	
-	use_system_fonts = gconf_client_get_bool (gconf_client,
-						  GCONF_USE_SYSTEM_FONTS,
-						  NULL);
+	gui = dh_glade_get_file (
+                DATADIR "/devhelp/devhelp.glade",
+                "preferences_dialog",
+                NULL,
+                "preferences_dialog", &prefs->dialog,
+                "fonts_table", &prefs->fonts_table,
+                "system_fonts_button", &prefs->system_fonts_button,
+                "variable_font_button", &prefs->variable_font_button,
+                "fixed_font_button", &prefs->fixed_font_button,
+                NULL);
+
+	dh_glade_connect (
+                gui,
+                prefs,
+                "variable_font_button", "font_set", preferences_font_set_cb,
+                "fixed_font_button", "font_set", preferences_font_set_cb,
+                "close_button", "clicked", preferences_close_cb,
+                "system_fonts_button", "toggled", preferences_system_fonts_toggled_cb,
+                NULL);
+
+	ige_conf_get_bool (ige_conf_get (),
+                           GCONF_USE_SYSTEM_FONTS,
+                           &use_system_fonts);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->system_fonts_button),
 				      use_system_fonts);
 	gtk_widget_set_sensitive (prefs->fonts_table, !use_system_fonts);

Modified: trunk/src/dh-search.c
==============================================================================
--- trunk/src/dh-search.c	(original)
+++ trunk/src/dh-search.c	Sat Oct  4 19:10:44 2008
@@ -25,16 +25,12 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
-
 #include "dh-marshal.h"
 #include "dh-keyword-model.h"
 #include "dh-search.h"
 #include "dh-preferences.h"
 #include "dh-base.h"
 
-#define d(x)
-
 typedef struct {
         DhKeywordModel *model;
 
@@ -157,10 +153,6 @@
 
                 if (link != priv->selected_link) {
                         priv->selected_link = link;
-
-                        d(g_print ("Emiting signal with link to: %s (%s)\n",
-                                   link->name, link->uri));
-
                         g_signal_emit (search, signals[LINK_SELECTED], 0, link);
                 }
         }
@@ -339,8 +331,6 @@
 {
         DhSearchPriv *priv = GET_PRIVATE (search);
 
-        d(g_print ("Entry changed\n"));
-
         if (!priv->idle_filter) {
                 priv->idle_filter =
                         g_idle_add ((GSourceFunc) search_filter_idle, search);
@@ -412,8 +402,6 @@
         gchar        *id;
         DhLink       *link;
 
-        d(g_print ("Filter idle\n"));
-
         str = gtk_entry_get_text (GTK_ENTRY (priv->entry));
         id = search_combo_get_active_id (search);
         link = dh_keyword_model_filter (priv->model, str, id);

Modified: trunk/src/dh-window.c
==============================================================================
--- trunk/src/dh-window.c	(original)
+++ trunk/src/dh-window.c	Sat Oct  4 19:10:44 2008
@@ -23,7 +23,6 @@
 #include <glib/gi18n.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
 #include <webkit/webkit.h>
 
 #ifdef GDK_WINDOWING_QUARTZ
@@ -35,12 +34,11 @@
 #include "dh-search.h"
 #include "dh-window.h"
 #include "eggfindbar.h"
+#include "ige-conf.h"
 
 struct _DhWindowPriv {
         DhBase         *base;
 
-        GConfClient    *gconf_client;
-
         GtkWidget      *main_box;
         GtkWidget      *menu_box;
         GtkWidget      *hpaned;
@@ -488,8 +486,6 @@
 
         priv->manager = gtk_ui_manager_new ();
 
-        priv->gconf_client = gconf_client_get_default ();
-
         accel_group = gtk_ui_manager_get_accel_group (priv->manager);
         gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
 
@@ -674,9 +670,9 @@
 
         gtk_box_pack_start (GTK_BOX (priv->main_box), priv->hpaned, TRUE, TRUE, 0);
 
-        hpaned_position = gconf_client_get_int (priv->gconf_client,
-                                                GCONF_PANED_LOCATION,
-                                                NULL);
+        ige_conf_get_int (ige_conf_get (),
+                          GCONF_PANED_LOCATION,
+                          &hpaned_position);
 
         /* This workaround for broken schema installs is not really working that
          * well, since it makes having a 0 location not possible.
@@ -798,45 +794,37 @@
                 maximized = FALSE;
         }
 
-        gconf_client_set_bool (priv->gconf_client,
-                               GCONF_MAIN_WINDOW_MAXIMIZED, maximized,
-                               NULL);
+        ige_conf_set_bool (ige_conf_get (),
+                           GCONF_MAIN_WINDOW_MAXIMIZED, maximized);
 
-        /* If maximized don't save the size and position */
+        /* If maximized don't save the size and position. */
         if (!maximized) {
                 gint width, height;
                 gint x, y;
 
                 gtk_window_get_size (GTK_WINDOW (window), &width, &height);
-                gconf_client_set_int (priv->gconf_client,
-                                      GCONF_MAIN_WINDOW_WIDTH, width,
-                                      NULL);
-                gconf_client_set_int (priv->gconf_client,
-                                      GCONF_MAIN_WINDOW_HEIGHT, height,
-                                      NULL);
+                ige_conf_set_int (ige_conf_get (),
+                                  GCONF_MAIN_WINDOW_WIDTH, width);
+                ige_conf_set_int (ige_conf_get (),
+                                  GCONF_MAIN_WINDOW_HEIGHT, height);
 
                 gtk_window_get_position (GTK_WINDOW (window), &x, &y);
-                gconf_client_set_int (priv->gconf_client,
-                                      GCONF_MAIN_WINDOW_POS_X, x,
-                                      NULL);
-                gconf_client_set_int (priv->gconf_client,
-                                      GCONF_MAIN_WINDOW_POS_Y, y,
-                                      NULL);
+                ige_conf_set_int (ige_conf_get (),
+                                  GCONF_MAIN_WINDOW_POS_X, x);
+                ige_conf_set_int (ige_conf_get (),
+                                  GCONF_MAIN_WINDOW_POS_Y, y);
         }
 
-        gconf_client_set_int (priv->gconf_client,
-                              GCONF_PANED_LOCATION,
-                              gtk_paned_get_position (GTK_PANED (priv->hpaned)),
-                              NULL);
+        ige_conf_set_int (ige_conf_get (),
+                          GCONF_PANED_LOCATION,
+                          gtk_paned_get_position (GTK_PANED (priv->hpaned)));
 
         if (gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->control_notebook)) == 0) {
-                gconf_client_set_string (priv->gconf_client,
-                                         GCONF_SELECTED_TAB, "content",
-                                         NULL);
+                ige_conf_set_string (ige_conf_get (),
+                                     GCONF_SELECTED_TAB, "content");
         } else {
-                gconf_client_set_string (priv->gconf_client,
-                                         GCONF_SELECTED_TAB, "search",
-                                         NULL);
+                ige_conf_set_string (ige_conf_get (),
+                                     GCONF_SELECTED_TAB, "search");
         }
 }
 
@@ -851,17 +839,17 @@
 
         priv = window->priv;
 
-        width = gconf_client_get_int (priv->gconf_client,
-                                      GCONF_MAIN_WINDOW_WIDTH,
-                                      NULL);
+        ige_conf_get_int (ige_conf_get (),
+                          GCONF_MAIN_WINDOW_WIDTH,
+                          &width);
 
         if (width <= 0) {
                 width = DEFAULT_WIDTH;
         }
 
-        height = gconf_client_get_int (priv->gconf_client,
-                                       GCONF_MAIN_WINDOW_HEIGHT,
-                                       NULL);
+        ige_conf_get_int (ige_conf_get (),
+                          GCONF_MAIN_WINDOW_HEIGHT,
+                          &height);
 
         if (height <= 0) {
                 height = DEFAULT_HEIGHT;
@@ -870,25 +858,25 @@
         gtk_window_set_default_size (GTK_WINDOW (window),
                                      width, height);
 
-        x = gconf_client_get_int (priv->gconf_client,
-                                  GCONF_MAIN_WINDOW_POS_X,
-                                  NULL);
-        y = gconf_client_get_int (priv->gconf_client,
-                                  GCONF_MAIN_WINDOW_POS_Y,
-                                  NULL);
+        ige_conf_get_int (ige_conf_get (),
+                          GCONF_MAIN_WINDOW_POS_X,
+                          &x);
+        ige_conf_get_int (ige_conf_get (),
+                          GCONF_MAIN_WINDOW_POS_Y,
+                          &y);
 
         gtk_window_move (GTK_WINDOW (window), x, y);
 
-        maximized = gconf_client_get_bool (priv->gconf_client,
-                                           GCONF_MAIN_WINDOW_MAXIMIZED,
-                                           NULL);
+        ige_conf_get_bool (ige_conf_get (),
+                           GCONF_MAIN_WINDOW_MAXIMIZED,
+                           &maximized);
         if (maximized) {
                 gtk_window_maximize (GTK_WINDOW (window));
         }
 
-        tab = gconf_client_get_string (priv->gconf_client,
-                                       GCONF_SELECTED_TAB,
-                                       NULL);
+        ige_conf_get_string (ige_conf_get (),
+                             GCONF_SELECTED_TAB,
+                             &tab);
         if (!tab || strcmp (tab, "") == 0 || strcmp (tab, "content") == 0) {
                 gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->control_notebook), 0);
                 gtk_widget_grab_focus (priv->book_tree);

Added: trunk/src/ige-conf-gconf.c
==============================================================================
--- (empty file)
+++ trunk/src/ige-conf-gconf.c	Sat Oct  4 19:10:44 2008
@@ -0,0 +1,335 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include <string.h>
+#include <gconf/gconf-client.h>
+#include "ige-conf.h"
+
+typedef struct {
+        GConfClient *gconf_client;
+} IgeConfPriv;
+
+typedef struct {
+        IgeConf           *conf;
+        IgeConfNotifyFunc  func;
+        gpointer           user_data;
+} IgeConfNotifyData;
+
+G_DEFINE_TYPE (IgeConf, ige_conf, G_TYPE_OBJECT);
+
+#define GET_PRIVATE(instance) G_TYPE_INSTANCE_GET_PRIVATE \
+  (instance, IGE_TYPE_CONF, IgeConfPriv);
+
+static IgeConf *global_conf = NULL;
+
+static void
+conf_finalize (GObject *object)
+{
+        IgeConfPriv *priv;
+
+        priv = GET_PRIV (object);
+
+        gconf_client_remove_dir (priv->gconf_client,
+                                 CONF_PATH,
+                                 NULL);
+
+        g_object_unref (priv->gconf_client);
+
+        G_OBJECT_CLASS (ige_conf_parent_class)->finalize (object);
+}
+
+static void
+ige_conf_class_init (IgeConfClass *class)
+{
+        GObjectClass *object_class;
+
+        object_class = G_OBJECT_CLASS (class);
+
+        object_class->finalize = conf_finalize;
+
+        g_type_class_add_private (object_class, sizeof (IgeConfPriv));
+}
+
+static void
+ige_conf_init (IgeConf *conf)
+{
+        IgeConfPriv *priv;
+
+        priv = GET_PRIV (conf);
+
+        priv->gconf_client = gconf_client_get_default ();
+
+        gconf_client_add_dir (priv->gconf_client,
+                              CONF_PATH,
+                              GCONF_CLIENT_PRELOAD_ONELEVEL,
+                              NULL);
+}
+
+IgeConf *
+ige_conf_get (void)
+{
+        if (!global_conf) {
+                global_conf = g_object_new (IGE_TYPE_CONF, NULL);
+        }
+
+        return global_conf;
+}
+
+gboolean
+ige_conf_set_int (IgeConf     *conf,
+                  const gchar *key,
+                  gint         value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        return gconf_client_set_int (priv->gconf_client,
+                                     key,
+                                     value,
+                                     NULL);
+}
+
+gboolean
+ige_conf_get_int (IgeConf     *conf,
+                  const gchar *key,
+                  gint        *value)
+{
+        IgeConfPriv *priv;
+        GError          *error = NULL;
+
+        *value = 0;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+        g_return_val_if_fail (value != NULL, FALSE);
+
+        priv = GET_PRIV (conf);
+
+        *value = gconf_client_get_int (priv->gconf_client,
+                                       key,
+                                       &error);
+
+        if (error) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_bool (IgeConf     *conf,
+                   const gchar *key,
+                   gboolean     value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        return gconf_client_set_bool (priv->gconf_client,
+                                      key,
+                                      value,
+                                      NULL);
+}
+
+gboolean
+ige_conf_get_bool (IgeConf     *conf,
+                   const gchar *key,
+                   gboolean    *value)
+{
+        IgeConfPriv *priv;
+        GError      *error = NULL;
+
+        *value = FALSE;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+        g_return_val_if_fail (value != NULL, FALSE);
+
+        priv = GET_PRIV (conf);
+
+        *value = gconf_client_get_bool (priv->gconf_client,
+                                        key,
+                                        &error);
+
+        if (error) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_string (IgeConf     *conf,
+                     const gchar *key,
+                     const gchar *value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        return gconf_client_set_string (priv->gconf_client,
+                                        key,
+                                        value,
+                                        NULL);
+}
+
+gboolean
+ige_conf_get_string (IgeConf      *conf,
+                     const gchar  *key,
+                     gchar       **value)
+{
+        IgeConfPriv *priv;
+        GError      *error = NULL;
+
+        *value = NULL;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        *value = gconf_client_get_string (priv->gconf_client,
+                                          key,
+                                          &error);
+
+        if (error) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_string_list (IgeConf     *conf,
+                          const gchar *key,
+                          GSList      *value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        return gconf_client_set_list (priv->gconf_client,
+                                      key,
+                                      GCONF_VALUE_STRING,
+                                      value,
+                                      NULL);
+}
+
+gboolean
+ige_conf_get_string_list (IgeConf      *conf,
+                          const gchar  *key,
+                          GSList      **value)
+{
+        IgeConfPriv *priv;
+        GError      *error = NULL;
+
+        *value = NULL;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        *value = gconf_client_get_list (priv->gconf_client,
+                                        key,
+                                        GCONF_VALUE_STRING,
+                                        &error);
+        if (error) {
+                g_error_free (error);
+                return FALSE;
+        }
+
+        return TRUE;
+}
+
+static void
+conf_notify_data_free (IgeConfNotifyData *data)
+{
+        g_object_unref (data->conf);
+        g_slice_free (IgeConfNotifyData, data);
+}
+
+static void
+conf_notify_func (GConfClient *client,
+                  guint        id,
+                  GConfEntry  *entry,
+                  gpointer     user_data)
+{
+        IgeConfNotifyData *data;
+
+        data = user_data;
+
+        data->func (data->conf,
+                    gconf_entry_get_key (entry),
+                    data->user_data);
+}
+
+guint
+ige_conf_notify_add (IgeConf           *conf,
+                     const gchar       *key,
+                     IgeConfNotifyFunc  func,
+                     gpointer           user_data)
+{
+        IgeConfPriv       *priv;
+        guint              id;
+        IgeConfNotifyData *data;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), 0);
+
+        priv = GET_PRIV (conf);
+
+        data = g_slice_new (IgeConfNotifyData);
+        data->func = func;
+        data->user_data = user_data;
+        data->conf = g_object_ref (conf);
+
+        id = gconf_client_notify_add (priv->gconf_client,
+                                      key,
+                                      conf_notify_func,
+                                      data,
+                                      (GFreeFunc) conf_notify_data_free,
+                                      NULL);
+
+        return id;
+}
+
+gboolean
+ige_conf_notify_remove (IgeConf *conf,
+                        guint    id)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIV (conf);
+
+        gconf_client_notify_remove (priv->gconf_client, id);
+
+        return TRUE;
+}

Added: trunk/src/ige-conf-mac.m
==============================================================================
--- (empty file)
+++ trunk/src/ige-conf-mac.m	Sat Oct  4 19:10:44 2008
@@ -0,0 +1,344 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#import <Cocoa/Cocoa.h>
+#include <string.h>
+#include "ige-conf.h"
+
+typedef struct {
+        NSUserDefaults *defaults;
+} IgeConfPriv;
+
+typedef struct {
+        IgeConf           *conf;
+        IgeConfNotifyFunc  func;
+        gpointer           user_data;
+} IgeConfNotifyData;
+
+#define POOL_ALLOC   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
+#define POOL_RELEASE [pool release]
+
+G_DEFINE_TYPE (IgeConf, ige_conf, G_TYPE_OBJECT);
+
+#define GET_PRIVATE(instance) G_TYPE_INSTANCE_GET_PRIVATE \
+  (instance, IGE_TYPE_CONF, IgeConfPriv);
+
+static IgeConf *global_conf = NULL;
+
+static void
+conf_finalize (GObject *object)
+{
+        IgeConfPriv *priv = GET_PRIVATE (object);
+
+        [priv->defaults synchronize];
+
+        G_OBJECT_CLASS (ige_conf_parent_class)->finalize (object);
+}
+
+static void
+ige_conf_class_init (IgeConfClass *class)
+{
+        GObjectClass *object_class;
+
+        object_class = G_OBJECT_CLASS (class);
+
+        object_class->finalize = conf_finalize;
+
+        g_type_class_add_private (object_class, sizeof (IgeConfPriv));
+}
+
+static void
+ige_conf_init (IgeConf *conf)
+{
+        IgeConfPriv  *priv = GET_PRIVATE (conf);
+        NSDictionary *dict;
+
+        priv->defaults = [NSUserDefaults standardUserDefaults];
+
+        POOL_ALLOC;
+
+#define CONF_PATH                     "/apps/devhelp"
+#define CONF_UI_MAIN_WINDOW_MAXIMIZED CONF_PATH "/ui/main_window_maximized"
+
+        dict = [NSDictionary dictionaryWithObjectsAndKeys:
+                @"NO", @CONF_UI_MAIN_WINDOW_MAXIMIZED,
+                nil];
+
+        /* Setup defaults. FIXME: Can we do this only when needed? */
+        [priv->defaults registerDefaults: dict];
+
+        POOL_RELEASE;
+}
+
+IgeConf *
+ige_conf_get (void)
+{
+        if (!global_conf) {
+                global_conf = g_object_new (IGE_TYPE_CONF, NULL);
+        }
+
+        return global_conf;
+}
+
+gboolean
+ige_conf_set_int (IgeConf     *conf,
+                  const gchar *key,
+                  gint         value)
+{
+        IgeConfPriv *priv;
+        NSString    *string;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        POOL_ALLOC;
+
+        string = [NSString stringWithUTF8String: key];
+        [priv->defaults setInteger: value forKey: string];
+
+        POOL_RELEASE;
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_int (IgeConf     *conf,
+                  const gchar *key,
+                  gint        *value)
+{
+        IgeConfPriv *priv;
+        NSString    *string;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        POOL_ALLOC;
+
+        string = [NSString stringWithUTF8String: key];
+        *value = [priv->defaults integerForKey: string];
+
+        [priv->defaults synchronize];
+
+        POOL_RELEASE;
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_bool (IgeConf     *conf,
+                   const gchar *key,
+                   gboolean     value)
+{
+        IgeConfPriv *priv;
+        NSString    *string;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        POOL_ALLOC;
+
+        string = [NSString stringWithUTF8String: key];
+        [priv->defaults setBool: value forKey: string];
+
+        [priv->defaults synchronize];
+
+        POOL_RELEASE;
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_bool (IgeConf     *conf,
+                   const gchar *key,
+                   gboolean    *value)
+{
+        IgeConfPriv *priv;
+        NSString    *string;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        POOL_ALLOC;
+
+        string = [NSString stringWithUTF8String: key];
+        *value = [priv->defaults boolForKey: string];
+
+        POOL_RELEASE;
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_string (IgeConf     *conf,
+                     const gchar *key,
+                     const gchar *value)
+{
+        IgeConfPriv *priv;
+        NSString    *string, *nsvalue;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        POOL_ALLOC;
+
+        string = [NSString stringWithUTF8String: key];
+        nsvalue = [NSString stringWithUTF8String: value];
+        [priv->defaults setObject: nsvalue forKey: string];
+
+        [priv->defaults synchronize];
+
+        POOL_RELEASE;
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_get_string (IgeConf      *conf,
+                     const gchar  *key,
+                     gchar       **value)
+{
+        IgeConfPriv *priv;
+        NSString    *string, *nsvalue;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        POOL_ALLOC;
+
+        string = [NSString stringWithUTF8String: key];
+        nsvalue = [priv->defaults stringForKey: string];
+
+        *value = g_strdup ([nsvalue UTF8String]);
+
+        POOL_RELEASE;
+
+        return TRUE;
+}
+
+gboolean
+ige_conf_set_string_list (IgeConf     *conf,
+                          const gchar *key,
+                          GSList      *value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        return TRUE; /*gconf_client_set_string_list (priv->gconf_client,
+                                             key,
+                                             value,
+                                             NULL);
+                     */
+}
+
+gboolean
+ige_conf_get_string_list (IgeConf      *conf,
+                          const gchar  *key,
+                          GSList      **value)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        *value = NULL; /*gconf_client_get_string_list (priv->gconf_client,
+                                               key,
+                                               &error);
+                       */
+        return TRUE;
+}
+
+/*
+static void
+conf_notify_data_free (IgeConfNotifyData *data)
+{
+        g_object_unref (data->conf);
+        g_slice_free (IgeConfNotifyData, data);
+}
+
+static void
+conf_notify_func (GConfClient *client,
+                  guint        id,
+                  GConfEntry  *entry,
+                  gpointer     user_data)
+{
+        IgeConfNotifyData *data;
+
+        data = user_data;
+
+        data->func (data->conf,
+                    gconf_entry_get_key (entry),
+                    data->user_data);
+}
+*/
+
+guint
+ige_conf_notify_add (IgeConf           *conf,
+                     const gchar       *key,
+                     IgeConfNotifyFunc  func,
+                     gpointer           user_data)
+{
+        IgeConfPriv       *priv;
+        guint              id;
+        IgeConfNotifyData *data;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), 0);
+
+        priv = GET_PRIVATE (conf);
+
+        data = g_slice_new (IgeConfNotifyData);
+        data->func = func;
+        data->user_data = user_data;
+        data->conf = g_object_ref (conf);
+
+        id = 0; /*gconf_client_notify_add (priv->gconf_client,
+                                      key,
+                                      conf_notify_func,
+                                      data,
+                                      (GFreeFunc) conf_notify_data_free,
+                                      NULL);
+        */
+        return id;
+}
+
+gboolean
+ige_conf_notify_remove (IgeConf *conf,
+                        guint    id)
+{
+        IgeConfPriv *priv;
+
+        g_return_val_if_fail (IGE_IS_CONF (conf), FALSE);
+
+        priv = GET_PRIVATE (conf);
+
+        /*gconf_client_notify_remove (priv->gconf_client, id);*/
+
+        return TRUE;
+}

Added: trunk/src/ige-conf.h
==============================================================================
--- (empty file)
+++ trunk/src/ige-conf.h	Sat Oct  4 19:10:44 2008
@@ -0,0 +1,85 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __IGE_CONF_H__
+#define __IGE_CONF_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define IGE_TYPE_CONF         (ige_conf_get_type ())
+#define IGE_CONF(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), IGE_TYPE_CONF, IgeConf))
+#define IGE_CONF_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), IGE_TYPE_CONF, IgeConfClass))
+#define IGE_IS_CONF(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), IGE_TYPE_CONF))
+#define IGE_IS_CONF_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), IGE_TYPE_CONF))
+#define IGE_CONF_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), IGE_TYPE_CONF, IgeConfClass))
+
+typedef struct _IgeConf      IgeConf;
+typedef struct _IgeConfClass IgeConfClass;
+
+struct _IgeConf  {
+        GObject parent;
+};
+
+struct _IgeConfClass {
+        GObjectClass parent_class;
+};
+
+typedef void (*IgeConfNotifyFunc) (IgeConf     *conf,
+                                   const gchar *key,
+                                   gpointer     user_data);
+
+GType       ige_conf_get_type        (void);
+IgeConf    *ige_conf_get             (void);
+guint       ige_conf_notify_add      (IgeConf            *conf,
+                                      const gchar        *key,
+                                      IgeConfNotifyFunc   func,
+                                      gpointer            data);
+gboolean    ige_conf_notify_remove   (IgeConf            *conf,
+                                      guint               id);
+gboolean    ige_conf_set_int         (IgeConf            *conf,
+                                      const gchar        *key,
+                                      gint                value);
+gboolean    ige_conf_get_int         (IgeConf            *conf,
+                                      const gchar        *key,
+                                      gint               *value);
+gboolean    ige_conf_set_bool        (IgeConf            *conf,
+                                      const gchar        *key,
+                                      gboolean            value);
+gboolean    ige_conf_get_bool        (IgeConf            *conf,
+                                      const gchar        *key,
+                                      gboolean           *value);
+gboolean    ige_conf_set_string      (IgeConf            *conf,
+                                      const gchar        *key,
+                                      const gchar        *value);
+gboolean    ige_conf_get_string      (IgeConf            *conf,
+                                      const gchar        *key,
+                                      gchar             **value);
+gboolean    ige_conf_set_string_list (IgeConf            *conf,
+                                      const gchar        *key,
+                                      GSList             *value);
+gboolean    ige_conf_get_string_list (IgeConf            *conf,
+                                      const gchar        *key,
+                                      GSList            **value);
+
+G_END_DECLS
+
+#endif /* __IGE_CONF_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]