[Gnucash-changes] Test whether or not Gnucash can find its GConf keys.

David Hampton hampton at cvs.gnucash.org
Sat Jul 16 00:01:50 EDT 2005


Log Message:
-----------
Test whether or not Gnucash can find its GConf keys.  If not present
the user with a warning message.  If the user chooses to setup gconf,
launch a druid to lead them through the process.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src:
        gnc-ui.h
    gnucash/src/gnome-utils:
        Makefile.am
        gnc-dir.h.in
        gnc-gnome-utils.c

Added Files:
-----------
    gnucash/src/gnome-utils:
        druid-gconf-setup.c
        druid-gconf-setup.glade
        druid-gconf-setup.h

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.239
retrieving revision 1.1487.2.240
diff -LChangeLog -LChangeLog -u -r1.1487.2.239 -r1.1487.2.240
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,34 @@
+2005-07-15  David Hampton  <hampton at employees.org>
+
+	* src/gnc-ui.h:
+	* src/gnome-utils/Makefile.am:
+	* src/gnome-utils/druid-gconf-setup.[ch]:
+	* src/gnome-utils/druid-gconf-setup.glade:
+	* src/gnome-utils/gnc-dir.h.in: Test whether or not Gnucash can
+	find its GConf keys.  If not present the user with a warning
+	message.  If the user chooses to setup gconf, launch a druid to
+	lead them through the process.
+
+	* src/core-utils/gnc-gconf-utils.[ch]: New function to check
+	existence of gconf keys.  New functions to add/remove gconf
+	notifications for use by code that doesn't have a GObject
+	available.
+	
+	* src/bin/Makefile.am:
+	* src/bin/update-gnucash-gconf.in: New script to install all of
+	Gnucash's gconf schemas into the users ~/.gconf directory.
+
+	* configure.in:
+	* src/app-file/schemas/Makefile.am:
+	* src/business/business-gnome/schemas/Makefile.am:
+	* src/gnome/schemas/Makefile.am: Do all schema installs into
+	${prefix}/etc/gconf, not /etc/gconf.  Make sure this directory
+	exists before installing.
+
+	* src/gnome-utils/gnc-gnome-utils.[ch]:
+	* src/gnome-utils/gnc-main-window.[ch]: Move the gnc_shutdown
+	routine to a different file.
+
 2005-07-11  David Hampton  <hampton at employees.org>
 
 	* src/business/business-gnome/gnc-plugin-page-invoice.c:
Index: gnc-ui.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnc-ui.h,v
retrieving revision 1.30.4.8
retrieving revision 1.30.4.9
diff -Lsrc/gnc-ui.h -Lsrc/gnc-ui.h -u -r1.30.4.8 -r1.30.4.9
--- src/gnc-ui.h
+++ src/gnc-ui.h
@@ -43,6 +43,7 @@
 #define HL_PRINTCHECK        "print-check"
 #define HL_RECNWIN           "acct-reconcile"
 #define HL_SXEDITOR          "tran-sched"
+#define HL_GCONF             "gconf"
 
 /* GTK Windows - Common Response Codes */
 
--- /dev/null
+++ src/gnome-utils/druid-gconf-setup.glade
@@ -0,0 +1,1003 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="GConf Query">
+  <property name="border_width">6</property>
+  <property name="visible">True</property>
+  <property name="title" translatable="yes"></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">False</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_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">False</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">12</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area1">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="helpbutton1">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-help</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-11</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="button1">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-quit</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-6</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="button2">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-9</property>
+
+	      <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">0</property>
+		  <property name="yscale">0</property>
+		  <property name="top_padding">0</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">0</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox3">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image3">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-dialog-warning</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label3">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">S_kip</property>
+			  <property name="use_underline">True</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>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="button3">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="has_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-3</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment1">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">0</property>
+		  <property name="yscale">0</property>
+		  <property name="top_padding">0</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">0</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox2">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">2</property>
+
+		      <child>
+			<widget class="GtkImage" id="image2">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-apply</property>
+			  <property name="icon_size">4</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label2">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Setup</property>
+			  <property name="use_underline">True</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>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkHBox" id="hbox1">
+	  <property name="border_width">6</property>
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">12</property>
+
+	  <child>
+	    <widget class="GtkImage" id="image1">
+	      <property name="visible">True</property>
+	      <property name="stock">gtk-dialog-warning</property>
+	      <property name="icon_size">6</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label1">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Cannot find default values&lt;/b&gt;
+
+The configuration data used to specify default values for Gnucash cannot be found in the default system locations.  Without this data Gnucash will still operate properly but it may require some extra time to setup.  Do you wish to setup the configuration data?</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">True</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkWindow" id="GConf Install Druid">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Update gconf settings - Gnucash</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>
+  <signal name="destroy_event" handler="druid_gconf_destroy_event" last_modification_time="Thu, 14 Jul 2005 21:19:31 GMT"/>
+  <signal name="delete_event" handler="druid_gconf_delete_event" last_modification_time="Sat, 16 Jul 2005 02:04:17 GMT"/>
+
+  <child>
+    <widget class="GnomeDruid" id="druid">
+      <property name="border_width">4</property>
+      <property name="visible">True</property>
+      <property name="show_help">False</property>
+      <signal name="cancel" handler="druid_gconf_cancel" last_modification_time="Thu, 14 Jul 2005 04:56:01 GMT"/>
+
+      <child>
+	<widget class="GnomeDruidPageEdge" id="start_page">
+	  <property name="visible">True</property>
+	  <property name="position">GNOME_EDGE_START</property>
+	  <property name="title" translatable="yes">Update Gnucash configuration data</property>
+	  <property name="text" translatable="yes">The configuration data used by Gnucash to specify its default values cannot be found in the default system locations.  Without this data Gnucash will still operate properly, but it may require some extra time to set up.</property>
+	</widget>
+      </child>
+
+      <child>
+	<widget class="GnomeDruidPageStandard" id="choose_page">
+	  <property name="visible">True</property>
+	  <property name="title" translatable="yes">Choose Method</property>
+	  <property name="contents_background">#e6e6e6e6e6e6</property>
+	  <signal name="next" handler="druid_gconf_choose_page_next" last_modification_time="Thu, 14 Jul 2005 04:52:59 GMT"/>
+	  <signal name="prepare" handler="druid_gconf_choose_page_prepare" last_modification_time="Thu, 14 Jul 2005 18:24:15 GMT"/>
+
+	  <child internal-child="vbox">
+	    <widget class="GtkVBox" id="druid-vbox1">
+	      <property name="border_width">16</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkTable" id="table1">
+		  <property name="visible">True</property>
+		  <property name="n_rows">5</property>
+		  <property name="n_columns">1</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">12</property>
+		  <property name="column_spacing">0</property>
+
+		  <child>
+		    <widget class="GtkScrolledWindow" id="scrolledwindow1">
+		      <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_NEVER</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
+		      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		      <child>
+			<widget class="GtkTextView" id="textview1">
+			  <property name="visible">True</property>
+			  <property name="sensitive">False</property>
+			  <property name="editable">False</property>
+			  <property name="overwrite">False</property>
+			  <property name="accepts_tab">False</property>
+			  <property name="justification">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap_mode">GTK_WRAP_WORD</property>
+			  <property name="cursor_visible">False</property>
+			  <property name="pixels_above_lines">0</property>
+			  <property name="pixels_below_lines">0</property>
+			  <property name="pixels_inside_wrap">0</property>
+			  <property name="left_margin">0</property>
+			  <property name="right_margin">0</property>
+			  <property name="indent">0</property>
+			  <property name="text" translatable="yes">The configuration data is stored in a non-standard location.  There are two methods that can be used to make this data visible to GnuCash.  The first it so modify a system search path to include the data location.  The second is to copy the data into your home directory.</property>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="update_path">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Update search path</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="install_data">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Install into home directory</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <property name="group">update_path</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">3</property>
+		      <property name="bottom_attach">4</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkScrolledWindow" id="scrolledwindow3">
+		      <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_NEVER</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
+		      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		      <child>
+			<widget class="GtkTextView" id="textview2">
+			  <property name="visible">True</property>
+			  <property name="sensitive">False</property>
+			  <property name="editable">False</property>
+			  <property name="overwrite">False</property>
+			  <property name="accepts_tab">False</property>
+			  <property name="justification">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap_mode">GTK_WRAP_WORD</property>
+			  <property name="cursor_visible">False</property>
+			  <property name="pixels_above_lines">0</property>
+			  <property name="pixels_below_lines">0</property>
+			  <property name="pixels_inside_wrap">0</property>
+			  <property name="left_margin">0</property>
+			  <property name="right_margin">0</property>
+			  <property name="indent">0</property>
+			  <property name="text" translatable="yes">This method will modify the file .gconf.path in your home directory.  It will add the Gnucash install directory to this path so that Gnucash can find its default settings and their descriptions.</property>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_padding">36</property>
+		      <property name="x_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkScrolledWindow" id="scrolledwindow4">
+		      <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_NEVER</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
+		      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		      <child>
+			<widget class="GtkTextView" id="textview3">
+			  <property name="visible">True</property>
+			  <property name="sensitive">False</property>
+			  <property name="editable">False</property>
+			  <property name="overwrite">False</property>
+			  <property name="accepts_tab">False</property>
+			  <property name="justification">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap_mode">GTK_WRAP_WORD</property>
+			  <property name="cursor_visible">False</property>
+			  <property name="pixels_above_lines">0</property>
+			  <property name="pixels_below_lines">0</property>
+			  <property name="pixels_inside_wrap">0</property>
+			  <property name="left_margin">0</property>
+			  <property name="right_margin">0</property>
+			  <property name="indent">0</property>
+			  <property name="text" translatable="yes">This method will install the Gnucash default settings and descriptions into the .gconf directory within your home directory.  The disadvantage to this method is that an update to GnuCash will not update your local settings to add in new keys.</property>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">4</property>
+		      <property name="bottom_attach">5</property>
+		      <property name="x_padding">36</property>
+		      <property name="x_options">fill</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+      </child>
+
+      <child>
+	<widget class="GnomeDruidPageStandard" id="update_page">
+	  <property name="visible">True</property>
+	  <property name="title" translatable="yes">Update Path</property>
+	  <property name="contents_background">#e6e6e6e6e6e6</property>
+	  <signal name="next" handler="druid_gconf_update_page_next" last_modification_time="Thu, 14 Jul 2005 04:55:39 GMT"/>
+	  <signal name="prepare" handler="druid_gconf_update_page_prepare" last_modification_time="Thu, 14 Jul 2005 04:55:32 GMT"/>
+
+	  <child internal-child="vbox">
+	    <widget class="GtkVBox" id="druid-vbox2">
+	      <property name="border_width">16</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkTable" id="table2">
+		  <property name="visible">True</property>
+		  <property name="n_rows">6</property>
+		  <property name="n_columns">1</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">12</property>
+		  <property name="column_spacing">0</property>
+
+		  <child>
+		    <widget class="GtkScrolledWindow" id="scrolledwindow5">
+		      <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_NEVER</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
+		      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		      <child>
+			<widget class="GtkTextView" id="textview4">
+			  <property name="visible">True</property>
+			  <property name="sensitive">False</property>
+			  <property name="editable">False</property>
+			  <property name="overwrite">False</property>
+			  <property name="accepts_tab">False</property>
+			  <property name="justification">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap_mode">GTK_WRAP_WORD</property>
+			  <property name="cursor_visible">False</property>
+			  <property name="pixels_above_lines">0</property>
+			  <property name="pixels_below_lines">0</property>
+			  <property name="pixels_inside_wrap">0</property>
+			  <property name="left_margin">0</property>
+			  <property name="right_margin">0</property>
+			  <property name="indent">0</property>
+			  <property name="text" translatable="yes">You have chosen to update the system search path.  GnuCash can do this for you, or it can tell you how to do it yourself.</property>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="program1">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Do it for me</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="user1">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_I'll do it myself</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <property name="group">program1</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">3</property>
+		      <property name="bottom_attach">4</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="done1">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">I _already did this in another window</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <property name="group">program1</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">5</property>
+		      <property name="bottom_attach">6</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkVBox" id="vbox1">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="label5">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Please add the following lines at the end of your ~/.gconf.path file:</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</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkScrolledWindow" id="scrolledwindow7">
+			  <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_NEVER</property>
+			  <property name="shadow_type">GTK_SHADOW_NONE</property>
+			  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+			  <child>
+			    <widget class="GtkTextView" id="update_text">
+			      <property name="visible">True</property>
+			      <property name="editable">True</property>
+			      <property name="overwrite">False</property>
+			      <property name="accepts_tab">False</property>
+			      <property name="justification">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap_mode">GTK_WRAP_NONE</property>
+			      <property name="cursor_visible">False</property>
+			      <property name="pixels_above_lines">0</property>
+			      <property name="pixels_below_lines">0</property>
+			      <property name="pixels_inside_wrap">0</property>
+			      <property name="left_margin">0</property>
+			      <property name="right_margin">0</property>
+			      <property name="indent">0</property>
+			      <property name="text" translatable="yes">Gnucash will add the appropriate text here.
+</property>
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">4</property>
+		      <property name="bottom_attach">5</property>
+		      <property name="x_padding">36</property>
+		      <property name="x_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label4">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Gnucash will update the system path for you.</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</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_padding">36</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+      </child>
+
+      <child>
+	<widget class="GnomeDruidPageStandard" id="install_page">
+	  <property name="visible">True</property>
+	  <property name="title" translatable="yes">Install Locally</property>
+	  <property name="contents_background">#e6e6e6e6e6e6</property>
+	  <signal name="back" handler="druid_gconf_install_page_back" last_modification_time="Thu, 14 Jul 2005 04:55:25 GMT"/>
+	  <signal name="prepare" handler="druid_gconf_install_page_prepare" last_modification_time="Thu, 14 Jul 2005 04:55:19 GMT"/>
+	  <signal name="next" handler="druid_gconf_install_page_next" last_modification_time="Thu, 14 Jul 2005 20:24:52 GMT"/>
+
+	  <child internal-child="vbox">
+	    <widget class="GtkVBox" id="druid-vbox3">
+	      <property name="border_width">16</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkTable" id="table3">
+		  <property name="visible">True</property>
+		  <property name="n_rows">6</property>
+		  <property name="n_columns">1</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">12</property>
+		  <property name="column_spacing">0</property>
+
+		  <child>
+		    <widget class="GtkScrolledWindow" id="scrolledwindow9">
+		      <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_NEVER</property>
+		      <property name="shadow_type">GTK_SHADOW_NONE</property>
+		      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		      <child>
+			<widget class="GtkTextView" id="textview5">
+			  <property name="visible">True</property>
+			  <property name="sensitive">False</property>
+			  <property name="editable">False</property>
+			  <property name="overwrite">False</property>
+			  <property name="accepts_tab">False</property>
+			  <property name="justification">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap_mode">GTK_WRAP_WORD</property>
+			  <property name="cursor_visible">False</property>
+			  <property name="pixels_above_lines">0</property>
+			  <property name="pixels_below_lines">0</property>
+			  <property name="pixels_inside_wrap">0</property>
+			  <property name="left_margin">0</property>
+			  <property name="right_margin">0</property>
+			  <property name="indent">0</property>
+			  <property name="text" translatable="yes">You have chosen to install the configuration data used by Gnucash into the ~/.gconf directory.  GnuCash can do this for you, or tell you how to do it yourself.</property>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="program2">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Do it for me</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="user2">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_I'll do it myself</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <property name="group">program2</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">3</property>
+		      <property name="bottom_attach">4</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="done2">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">I _already did this in another window</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <property name="group">program2</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">5</property>
+		      <property name="bottom_attach">6</property>
+		      <property name="x_padding">12</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkVBox" id="vbox2">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="label7">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Please run the following commands:</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</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkScrolledWindow" id="scrolledwindow12">
+			  <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_NEVER</property>
+			  <property name="shadow_type">GTK_SHADOW_NONE</property>
+			  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+			  <child>
+			    <widget class="GtkTextView" id="install_text">
+			      <property name="visible">True</property>
+			      <property name="editable">True</property>
+			      <property name="overwrite">False</property>
+			      <property name="accepts_tab">False</property>
+			      <property name="justification">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap_mode">GTK_WRAP_NONE</property>
+			      <property name="cursor_visible">False</property>
+			      <property name="pixels_above_lines">0</property>
+			      <property name="pixels_below_lines">0</property>
+			      <property name="pixels_inside_wrap">0</property>
+			      <property name="left_margin">0</property>
+			      <property name="right_margin">0</property>
+			      <property name="indent">0</property>
+			      <property name="text" translatable="yes">update-gnucash-gconf
+</property>
+			    </widget>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">4</property>
+		      <property name="bottom_attach">5</property>
+		      <property name="x_padding">36</property>
+		      <property name="x_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label6">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Gnucash will install the data for you.</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</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_padding">36</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	  </child>
+	</widget>
+      </child>
+
+      <child>
+	<widget class="GnomeDruidPageEdge" id="finish_page">
+	  <property name="visible">True</property>
+	  <property name="position">GNOME_EDGE_FINISH</property>
+	  <property name="title" translatable="yes">Finish changes</property>
+	  <property name="text" translatable="yes">One of four stanzas:
+
+When you click Apply, Gnucash will modify your ~/.gconf.path file and restart the gconf backend.
+
+When you click Apply, Gnucash will install the configuration data into your local ~/.gconf file and restart the gconf backend.  If you have not already done so, you can click the Back button and copy the necessary text from the dialog.&quot;;
+
+You have chosen to correct the problem by yourself.  When you click Apply, Gnucash will exit.  Please correct the problem and restart the gconf backend before restarting Gnucash.
+
+You have already corrected the problem.  When you click Apply, Gnucash will restart the gconf backend and continue loading.</property>
+	  <signal name="prepare" handler="druid_gconf_finish_page_prepare" last_modification_time="Thu, 14 Jul 2005 04:54:49 GMT"/>
+	  <signal name="back" handler="druid_gconf_finish_page_back" last_modification_time="Thu, 14 Jul 2005 04:54:55 GMT"/>
+	  <signal name="finish" handler="druid_gconf_finish_page_finish" last_modification_time="Thu, 14 Jul 2005 04:55:11 GMT"/>
+	</widget>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
Index: gnc-gnome-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-gnome-utils.c,v
retrieving revision 1.2.4.12
retrieving revision 1.2.4.13
diff -Lsrc/gnome-utils/gnc-gnome-utils.c -Lsrc/gnome-utils/gnc-gnome-utils.c -u -r1.2.4.12 -r1.2.4.13
--- src/gnome-utils/gnc-gnome-utils.c
+++ src/gnome-utils/gnc-gnome-utils.c
@@ -35,9 +35,12 @@
 #include "gnc-html-graph-gog.h"
 
 #include "argv-list-converters.h"
+#include "druid-gconf-setup.h"
+#include "gnc-gconf-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-html.h"
 #include "gnc-trace.h"
+#include "gnc-ui.h"
 
 #include <libgnomeui/gnome-window-icon.h>
 #include <gnc-dir.h>
@@ -173,13 +176,6 @@
   restargv2 = (char**) poptGetArgs (returnedPoptContext);
   ret = gnc_argv2scm (argv_length (restargv2), (const char**)restargv2);
 
-#ifdef GTKHTML_HAVE_GCONF
-  {
-    if (!gconf_init (restargc, restargv, &error))
-      g_error_free (error);
-  }
-#endif
-
   gnc_free_argv (restargv);
 
   /* initialization required for gtkhtml */
@@ -203,6 +199,8 @@
   gnc_html_guppi_init ();
 #endif
 
+  druid_gconf_install_check_schemas();
+
   return ret;
 }
 
--- /dev/null
+++ src/gnome-utils/druid-gconf-setup.c
@@ -0,0 +1,618 @@
+/*
+ * druid-gconf-setup.c  -- install gconf keys where they can be found.
+ *
+ * Copyright (c) 2005 David Hampton <hampton at employees.org>
+ *
+ * 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, contact:
+ *
+ * Free Software Foundation           Voice:  +1-617-542-5942
+ * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
+ * Boston, MA  02111-1307,  USA       gnu at gnu.org
+ */
+
+/** @addtogroup GUI
+    @{ */
+/** @addtogroup GConf Setup Druid
+    @{ */
+/** @file druid-gconf-setup.c
+    @brief Check for gconf.  Help user set up if needed.
+    @author Copyright (C) 2005 David Hampton <hampton at employees.org>
+*/
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <errno.h>
+#include <gnome.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "dialog-utils.h"
+#include "druid-gconf-setup.h"
+#include "druid-utils.h"
+#include "gnc-dir.h"
+#include "gnc-gconf-utils.h"
+#include "gnc-gui-query.h"
+#include "gnc-gnome-utils.h"
+#include "gnc-ui.h"
+#include "messages.h"
+
+#define WHO_DOES		"who_does"
+#define WHO_GNUCASH		1
+#define WHO_USER		2
+#define WHO_ALREADY_DONE	3
+
+#define HOW			"how"
+#define HOW_UPDATE		1
+#define HOW_INSTALL		2
+
+#define PATH_STRING1 "xml:readwrite:~/.gconf\n"
+#define PATH_STRING2 "xml:readonly:%s\n"
+
+
+/********************
+ * Declarations
+ ********************/
+
+
+gboolean druid_gconf_delete_event (GtkWidget *window, GdkEvent *event, gpointer user_data);
+void     druid_gconf_cancel (GnomeDruid *druid, gpointer user_data);
+void     druid_gconf_choose_page_prepare (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+gboolean druid_gconf_choose_page_next (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+void     druid_gconf_update_page_prepare (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+gboolean druid_gconf_update_page_next (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+void     druid_gconf_install_page_prepare (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+gboolean druid_gconf_install_page_next (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+gboolean druid_gconf_install_page_back (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+void     druid_gconf_finish_page_prepare (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+gboolean druid_gconf_finish_page_back (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+void     druid_gconf_finish_page_finish (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data);
+
+
+/********************
+ * Work Functions
+ ********************/
+
+
+/** This function is called to create/update the users ~/.gconf.path
+ *  file to point at the location of the gnucash schema files.  It
+ *  should add two lines to the file.  The first points at the user's
+ *  local .gconf directory and the second points at gnucash.  If this
+ *  isn't done then all the gnucash keys end up being interpreted as
+ *  read-only keys and the user isn't allowed to change anything.
+ *
+ *  This function first checks to file to see if the ~/.gconf line
+ *  already exists in the path file.  If so, it won't add it a second
+ *  time.  The function then adds the one or two needed lines to the
+ *  end of the file.  Any errors are reported to the caller.
+ *
+ *  @param error This argument points to a location where error
+ *  information can be stored.  It is updated if there is a problem
+ *  executing the command.
+ *
+ *  @return This functions returns TRUE if all the steps needed to
+ *  update the users ~/.gconf.path file were able to complete
+ *  successfully. It returns FALSE otherwise.
+ */
+static gboolean
+druid_gconf_update_path (GError **error)
+{
+  gchar *path_filename, *data_filename;
+  gchar *contents, **lines, *line;
+  gboolean found_user_dir = FALSE;
+  FILE *output;
+
+  data_filename = g_strjoin("/", g_getenv("HOME"), ".gconf", NULL);
+  path_filename = g_strjoin("/", g_getenv("HOME"), ".gconf.path", NULL);
+  if (g_file_test(path_filename, G_FILE_TEST_EXISTS)) {
+    if (!g_file_get_contents(path_filename, &contents, NULL, error)) {
+      g_free(path_filename);
+      g_free(data_filename);
+      return FALSE;
+    }
+    
+    lines = g_strsplit_set(contents, "\r\n", -1);
+    for (line = *lines; line; line++) {
+      if (line[0] == '#')
+	continue;
+      if ((strstr(line, "$(HOME)/.gconf") == 0) ||
+	  (strstr(line, "~/.gconf") == 0) ||
+	  (strstr(line, data_filename))) {
+	found_user_dir = TRUE;
+	break;
+      }
+    }
+    g_strfreev(lines);
+  }
+
+  output = fopen(path_filename, "a");
+  if (output == NULL) {
+    *error = g_error_new (G_FILE_ERROR,
+			  g_file_error_from_errno(errno),
+			  "Error opening file %s for writing.",
+			  path_filename);
+    g_free(path_filename);
+    g_free(data_filename);
+    return FALSE;
+  }
+
+  fprintf(output, "\n######## The following lines were added by Gnucash. ########\n");
+  if (!found_user_dir)
+    fprintf(output, PATH_STRING1);
+  fprintf(output, PATH_STRING2, GNC_GCONF_DIR);
+  fprintf(output,   "############## End of lines added by Gnucash. ##############\n");
+  if (fclose(output) != 0)  {
+    *error = g_error_new (G_FILE_ERROR,
+			  g_file_error_from_errno(errno),
+			  "Error closing file %s.",
+			  path_filename);
+    g_free(path_filename);
+    g_free(data_filename);
+    return  FALSE;
+  }
+
+  g_free(path_filename);
+  g_free(data_filename);
+  return TRUE;
+}
+
+
+/** This function is called to install the gnucash gconf schemas into
+ *  the users local .goncf directory.  It spawns a process to run a
+ *  shell script that is installed with gnucash.  Any errors are
+ *  reported to the caller.
+ *
+ *  @param error This argument points to a location where error
+ *  information can be stored.  It is updated if there is a problem
+ *  executing the command.
+ *
+ *  @return This functions returns TRUE if the command completed
+ *  successfully, FALSE otherwise.  Note that this is based on whether
+ *  the script could be found, the script's exit code, etc., not on
+ *  whether any individual command in the script was successful.
+ */
+static gboolean
+druid_gconf_install_keys (GError **error)
+{
+  return g_spawn_command_line_sync("update-gnucash-gconf", NULL, NULL,
+				     NULL, error);
+}
+
+/********************
+ * Common Callbacks
+ ********************/
+
+
+/** This function is called when the window manager close button is
+ *  clicked on any page of the druid.  It destroys the dialog and
+ *  kills gnucash.
+ */
+gboolean
+druid_gconf_delete_event (GtkWidget *window,
+			   GdkEvent *event,
+			   gpointer user_data)
+{
+  gtk_widget_destroy(GTK_WIDGET(window));
+  exit(40);
+}
+
+
+/** This function is called when the Cancel button is clicked on any
+ *  page of the druid.  It destroys the dialog and kills gnucash.
+ */
+void
+druid_gconf_cancel (GnomeDruid *druid,
+		    gpointer user_data)
+{
+  GtkWidget *window;
+
+  window = gnc_glade_lookup_widget(GTK_WIDGET(druid), "GConf Install Druid");
+  gtk_widget_destroy(GTK_WIDGET(window));
+  exit(41);
+}
+
+
+/********************
+ * Choose Page
+ ********************/
+
+
+/** This function is called before the Choose page is presented to the
+ *  user.  Its sole purpose is to change the background color of the
+ *  GtkTextView widgets to match the color of the druid.
+ */
+void
+druid_gconf_choose_page_prepare (GnomeDruidPage *druidpage,
+				 GnomeDruid *druid,
+				 gpointer user_data)
+{
+  GtkWidget *textview;
+
+  textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "textview1");
+  gtk_widget_modify_base(textview, GTK_STATE_INSENSITIVE,
+			 &GNOME_DRUID_PAGE_STANDARD(druidpage)->contents_background);
+  textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "textview2");
+  gtk_widget_modify_base(textview, GTK_STATE_INSENSITIVE,
+			 &GNOME_DRUID_PAGE_STANDARD(druidpage)->contents_background);
+  textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "textview3");
+  gtk_widget_modify_base(textview, GTK_STATE_INSENSITIVE,
+			 &GNOME_DRUID_PAGE_STANDARD(druidpage)->contents_background);
+}
+
+
+/** This function is called when the Next button is clicked on the
+ *  Choose page of the druid.  It save the user selection on the
+ *  dialog widget, and uses that selection to determines whether to go
+ *  to the the "Update Path" or "Install" page.
+ */
+gboolean
+druid_gconf_choose_page_next (GnomeDruidPage *druidpage,
+			      GnomeDruid *druid,
+			      gpointer user_data)
+{
+  GtkWidget *page, *button;
+
+  button = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "update_path");
+  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) {
+    page = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "update_page");
+    g_object_set_data(G_OBJECT(druid), HOW, GINT_TO_POINTER(HOW_UPDATE));
+  } else {
+    page = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "install_page");
+    g_object_set_data(G_OBJECT(druid), HOW, GINT_TO_POINTER(HOW_INSTALL));
+  }
+
+  gnome_druid_set_page(druid, GNOME_DRUID_PAGE(page));
+  return TRUE;
+}
+
+
+/********************
+ * Update Page
+ ********************/
+
+
+/** This function is called before the Choose page is presented to the
+ *  user.  Its changes the background color of the GtkTextView widgets
+ *  to match the color of the druid, and fills in the text of one of
+ *  the textview widgets based upon the installed path of gnucash.
+ */
+void
+druid_gconf_update_page_prepare (GnomeDruidPage *druidpage,
+				 GnomeDruid *druid,
+				 gpointer user_data)
+{
+  GtkTextBuffer *textbuffer;
+  GtkWidget *textview;
+  gchar *msg;
+
+  /* The text views don't have the right background color for some reason. */
+  textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "textview4");
+  gtk_widget_modify_base(textview, GTK_STATE_INSENSITIVE,
+			 &GNOME_DRUID_PAGE_STANDARD(druidpage)->contents_background);
+
+  textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "update_text");
+  textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
+  msg = g_strdup_printf(PATH_STRING1 PATH_STRING2, GNC_GCONF_DIR);
+  gtk_text_buffer_set_text(textbuffer, msg, -1);
+}
+
+
+/** This function is called when the Next button is clicked on the
+ *  Update Path page of the druid.  It save the user selection on the
+ *  dialog widget, and skips to the Finish page.
+ */
+gboolean
+druid_gconf_update_page_next (GnomeDruidPage *druidpage,
+			      GnomeDruid *druid,
+			      gpointer user_data)
+{
+  GtkWidget *page, *button1, *button2;
+
+  button1 = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "program1");
+  button2 = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "user1");
+  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button1))) {
+    g_object_set_data(G_OBJECT(druid), WHO_DOES, GINT_TO_POINTER(WHO_GNUCASH));
+  } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button2))) {
+    g_object_set_data(G_OBJECT(druid), WHO_DOES, GINT_TO_POINTER(WHO_USER));
+  } else {
+    g_object_set_data(G_OBJECT(druid), WHO_DOES, GINT_TO_POINTER(WHO_ALREADY_DONE));
+  }
+
+  page = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "finish_page");
+  gnome_druid_set_page(druid, GNOME_DRUID_PAGE(page));
+  return TRUE;
+}
+
+/********************
+ * Install Page
+ ********************/
+
+/** This function is called before the Install page is presented to the
+ *  user.  Its sole purpose is to change the background color of the
+ *  GtkTextView widgets to match the color of the druid.
+ */
+void
+druid_gconf_install_page_prepare (GnomeDruidPage *druidpage,
+				  GnomeDruid *druid,
+				  gpointer user_data)
+{
+  GtkWidget *textview;
+
+  textview = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "textview5");
+  gtk_widget_modify_base(textview, GTK_STATE_INSENSITIVE,
+			 &GNOME_DRUID_PAGE_STANDARD(druidpage)->contents_background);
+}
+
+
+/** This function is called when the Next button is clicked on the
+ *  Install page of the druid.  It save the user selection on the
+ *  dialog widget, and moves to the Finish page.
+ */
+gboolean
+druid_gconf_install_page_next (GnomeDruidPage *druidpage,
+			       GnomeDruid *druid,
+			       gpointer user_data)
+{
+  GtkWidget *page, *button1, *button2;
+
+  button1 = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "program2");
+  button2 = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "user2");
+  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button1))) {
+    g_object_set_data(G_OBJECT(druid), WHO_DOES, GINT_TO_POINTER(WHO_GNUCASH));
+  } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button2))) {
+    g_object_set_data(G_OBJECT(druid), WHO_DOES, GINT_TO_POINTER(WHO_USER));
+  } else {
+    g_object_set_data(G_OBJECT(druid), WHO_DOES, GINT_TO_POINTER(WHO_ALREADY_DONE));
+  }
+
+  page = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "finish_page");
+  gnome_druid_set_page(druid, GNOME_DRUID_PAGE(page));
+  return TRUE;
+}
+
+
+/** This function is called when the Back button is clicked on the
+ *  Install page of the druid.  It skips back to the Choose page.
+ */
+gboolean
+druid_gconf_install_page_back (GnomeDruidPage *druidpage,
+			       GnomeDruid *druid,
+			       gpointer user_data)
+{
+  GtkWidget *page;
+
+  page = gnc_glade_lookup_widget(GTK_WIDGET(druidpage), "choose_page");
+  gnome_druid_set_page(druid, GNOME_DRUID_PAGE(page));
+  return TRUE;
+}
+
+
+/********************
+ * Finish Page
+ ********************/
+
+
+/** This function is called before the Finish page is presented to the
+ *  user.  Its determines which of four messages will be presented to
+ *  the user based upon their previous selections.
+ */
+void
+druid_gconf_finish_page_prepare (GnomeDruidPage *druidpage,
+				 GnomeDruid *druid,
+				 gpointer user_data)
+{
+  gint who, how;
+  const gchar *text;
+  const gchar *pgm_path =
+    "When you click Appply, Gnucash will modify your ~/.gconf.path file "
+    "and restart the gconf backend.";
+  const gchar *pgm_install =
+    "When you click Appply, Gnucash will install the gconf data into your "
+    "local ~/.gconf file and restart the gconf backend.";
+  const gchar *user_does =
+    "You have chosen to correct the problem by yourself.  When you click "
+    "Apply, Gnucash will exit.  Please correct the problem and restart "
+    "the gconf backend before restarting Gnucash.  If you have not already "
+    "done so, you can click the Back button and copy the necessary text "
+    "from the dialog.";
+  const gchar *user_did =
+    "You have already corrected the problem.  When you click Apply, Gnucash "
+    "will continue loading.";
+
+  who = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(druid), WHO_DOES));
+  switch (who) {
+    case WHO_ALREADY_DONE:
+      text = user_did;
+      break;
+
+    case WHO_USER:
+      text = user_does;
+      break;
+
+    default:
+      how = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(druid), HOW));
+      switch(how) {
+      case HOW_INSTALL:
+	text = pgm_install;
+	break;
+
+      default:
+	text = pgm_path;
+	break;
+      }
+  }
+
+  gnome_druid_page_edge_set_text(GNOME_DRUID_PAGE_EDGE(druidpage), text);
+}
+
+
+/** This function is called when the Back button is clicked on the
+ *  Finish page of the druid.  It determines whether to go back the
+ *  the "Update Path" or "Install" pages.
+ */
+gboolean
+druid_gconf_finish_page_back (GnomeDruidPage *druidpage,
+			      GnomeDruid *druid,
+			      gpointer user_data)
+{
+  return druid_gconf_choose_page_next(druidpage, druid, user_data);
+}
+
+
+/** This function is called when the Apply button is clicked on the
+ *  Finish Page end of the druid.  It determines whether or not there
+ *  is any work to be performed by Gnucash, and if so it calls other
+ *  functions to carry out the work.
+ */
+void
+druid_gconf_finish_page_finish (GnomeDruidPage *druidpage,
+				GnomeDruid *druid,
+				gpointer user_data)
+{
+  GtkWidget *window;
+  gint value, value2;
+  GError *error = NULL;
+  gboolean keep_going = TRUE;
+
+  /* What to do... what to do... */
+  value = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(druid), WHO_DOES));
+  switch (value) {
+    case WHO_ALREADY_DONE:
+      break;
+
+    case WHO_USER:
+      keep_going = FALSE;
+      break;
+
+    default:
+      value2 = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(druid), HOW));
+      switch(value2) {
+      case HOW_INSTALL:
+	if (!druid_gconf_install_keys(&error)) {
+	  keep_going = FALSE;
+	  gnc_error_dialog(NULL, error->message);
+	  g_error_free(error);
+	}
+	break;
+
+      default:
+	if (!druid_gconf_update_path(&error)) {
+	  keep_going = FALSE;
+	  gnc_error_dialog(NULL, error->message);
+	  g_error_free(error);
+	}
+	break;
+      }
+      break;
+  }
+
+  window = gnc_glade_lookup_widget(GTK_WIDGET(druid), "GConf Install Druid");
+  gtk_widget_destroy(GTK_WIDGET(window));
+  if (keep_going) {
+    gtk_main_quit();
+  } else {
+    exit(42);
+  }
+}
+
+
+/********************
+ * Druid Creation
+ ********************/
+
+
+/** This function build and presents the druid that presents the user
+ *  with the two methods of making the gconf schemas visible, and
+ *  learns whether gnucash should do the work or the user will do the
+ *  work.  This function then blocks in a call to gtk_main(), while
+ *  all of the work happens in callback functions.  Once the dialog is
+ *  finished, this function kills off any existing gconf daemon so
+ *  that the changes will be noticed upon daemon restart.
+ */
+static void
+gnc_gnome_install_gconf_schemas (void)
+{
+  GladeXML *xml;
+  GtkWidget *window;
+  GError *error = NULL;
+
+  xml = gnc_glade_xml_new ("druid-gconf-setup.glade", "GConf Install Druid");
+  glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func, NULL);
+  window = glade_xml_get_widget (xml, "GConf Install Druid");
+  gtk_widget_show_all(window);
+
+  /* This won't return until the dialog is finished */
+  gtk_main();
+
+  /* Kill the backend daemon. When it restarts it will find our changes */
+  if (!g_spawn_command_line_sync("gconftool-2 --shutdown", NULL, NULL,
+				 NULL, &error)) {
+    gnc_warning_dialog(NULL, error->message);
+    g_error_free(error);
+  }
+}
+
+
+/** This routine checks to see if GnuCash's gconf schemas are visible
+ *  to the user.  The schemas typically should be visible, as rpm and
+ *  deb installs will put the schemas in the default system location.
+ *  For things like network installs or developers, this function will
+ *  present a warning dialog that asks the user whether to setup
+ *  gconf, continue without the schemas, or quit.  If the user chooses
+ *  to set up the schemas, this function will invoke a druid to walk
+ *  the user through making the schemas visible.
+ */
+void
+druid_gconf_install_check_schemas (void)
+{
+  GladeXML *xml;
+  GtkWidget *dialog;
+  gboolean done = FALSE;
+  gint response;
+
+  if (gnc_gconf_schemas_found())
+    return;
+
+  xml = gnc_glade_xml_new ("druid-gconf-setup.glade", "GConf Query");
+  dialog = glade_xml_get_widget (xml, "GConf Query");
+  do {
+    response = gtk_dialog_run(GTK_DIALOG(dialog));
+
+    switch (response) {
+    case GTK_RESPONSE_CANCEL:
+    default:
+      gnc_shutdown(42);
+      /* never returns */
+
+    case GTK_RESPONSE_NO:
+      /* User wants to run without setting up gconf */
+      done = TRUE;
+      break;
+
+    case GTK_RESPONSE_ACCEPT:
+      gtk_widget_hide(dialog);
+      gnc_gnome_install_gconf_schemas();
+      done = TRUE;
+      break;
+
+    case GTK_RESPONSE_HELP:
+      gnc_gnome_help(HF_HELP, HL_GCONF);
+      break;
+    }
+  } while (!done);
+
+  gtk_widget_destroy(dialog);
+}
+
+/** @} */
Index: Makefile.am
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Makefile.am,v
retrieving revision 1.48.2.31
retrieving revision 1.48.2.32
diff -Lsrc/gnome-utils/Makefile.am -Lsrc/gnome-utils/Makefile.am -u -r1.48.2.31 -r1.48.2.32
--- src/gnome-utils/Makefile.am
+++ src/gnome-utils/Makefile.am
@@ -41,6 +41,7 @@
   dialog-transfer.c \
   dialog-utils.c \
   druid-utils.c \
+  druid-gconf-setup.c \
   gnc-account-sel.c \
   gnc-amount-edit.c \
   gnc-budget-list-tree-model.c \
@@ -102,6 +103,7 @@
   dialog-transfer.h \
   dialog-utils.h \
   druid-utils.h \
+  druid-gconf-setup.h \
   gnc-account-sel.h \
   gnc-amount-edit.h \
   gnc-budget-list-tree-model.h \
@@ -199,6 +201,7 @@
   dialog-query-list.glade \
   druid-provider-multifile.glade \
   exchange-dialog.glade \
+  druid-gconf-setup.glade \
   gnc-date-format.glade \
   preferences.glade \
   transfer.glade
@@ -219,7 +222,8 @@
 	rm -f $@.tmp
 	sed < $< > $@.tmp \
 	    -e 's:@-GNC_ACCOUNTS_DIR-@:${GNC_ACCOUNTS_DIR}:g' \
-	    -e 's:@-GNC_GLADE_DIR-@:${GNC_GLADE_DIR}:g'
+	    -e 's:@-GNC_GLADE_DIR-@:${GNC_GLADE_DIR}:g' \
+	    -e 's:@-GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY-@:${GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY}:g'
 	mv $@.tmp $@
 
 gnc-version.h: _gnc-version.h
--- /dev/null
+++ src/gnome-utils/druid-gconf-setup.h
@@ -0,0 +1,49 @@
+/*
+ * druid-gconf-setup.h  -- install gconf keys where they can be found.
+ *
+ * Copyright (c) 2005 David Hampton <hampton at employees.org>
+ *
+ * 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, contact:
+ *
+ * Free Software Foundation           Voice:  +1-617-542-5942
+ * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
+ * Boston, MA  02111-1307,  USA       gnu at gnu.org
+ */
+
+/** @addtogroup GUI
+    @{ */
+/** @addtogroup GConf Setup Druid
+    @{ */
+/** @file druid-gconf-setup.c
+    @brief Check for gconf.  Help user set up if needed.
+    @author Copyright (C) 2005 David Hampton <hampton at employees.org>
+*/
+
+#ifndef GNC_DRUID_GCONF_SETUP_H
+#define GNC_DRUID_GCONF_SETUP_H
+
+/** This routine checks to see if GnuCash's gconf schemas are visible
+ *  to the user.  The schemas typically should be visible, as rpm and
+ *  deb installs will put the schemas in the default system location.
+ *  For things like network installs or developers, this function will
+ *  present a warning dialog that asks the user whether to setup
+ *  gconf, continue without the schemas, or quit.  If the user chooses
+ *  to set up the schemas, this function will invoke a druid to walk
+ *  the user through making the schemas visible.
+ */
+void druid_gconf_install_check_schemas(void);
+
+#endif
+
+/** @} */
Index: gnc-dir.h.in
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-dir.h.in,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -Lsrc/gnome-utils/gnc-dir.h.in -Lsrc/gnome-utils/gnc-dir.h.in -u -r1.1.6.1 -r1.1.6.2
--- src/gnome-utils/gnc-dir.h.in
+++ src/gnome-utils/gnc-dir.h.in
@@ -25,5 +25,6 @@
 
 #define GNC_ACCOUNTS_DIR "@-GNC_ACCOUNTS_DIR-@"
 #define GNC_GLADE_DIR "@-GNC_GLADE_DIR-@"
+#define GNC_GCONF_DIR "@-GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY-@"
 
 #endif


More information about the gnucash-changes mailing list