[Gtk-sharp-list] Trying to use GConf, and it wants a slash

Adam Tauno Williams awilliam@whitemice.org
Sun, 09 May 2004 17:49:06 -0400


I'm attempting to add GConf support to my little app using the
instructions found at -
http://www.go-mono.com/monkeyguide/html/en/gnome/bindings/gconf/gconf.
html

But whenever I attempt to bring up the dialog box with the preference
bindings it crashes with:
Unhandled Exception: GLib.GException: Bad key or directory name:
"localhost": Must begin with a slash (/)
in <0x00090> GConf.Client:Get (string)
in <0x00050> GConf.PropertyEditors.PropertyEditor:Get ()
in <0x00057> GConf.PropertyEditors.PropertyEditor:Setup ()

Why does the default value have to start with a "/"?  I'm confused.

I used...
env GCONF_CONFIG_SOURCE="" gconftool-2 --makefile-install-rule
GConfSchema.xml
gconfsharp-schemagen mWhitePage GConfSchema.xml > GConf.cs
... to create GConf.cs from ...
<gconfschemafile>
  <schemalist>
    <schema>
      <key>/schemas/apps/botwm/mWhitePage/serverName</key>
      <applyto>/apps/botwm/mWhitePage/serverName</applyto>
      <owner>mWhitePage</owner>
      <type>string</type>
      <cstype class="mWhitePage.ServerName">string</cstype>
      <locale name="C">
        <short>Server Name</short>
        <long>Fully qualified domain name of LDAP server</long>
      </locale>
      <default>localhost</default>
    </schema>
    <schema>
      <key>/schemas/apps/botwm/mWhitePage/serverRootDN</key>
      <applyto>/apps/botwm/mWhitePage/serverRootDN</applyto>
      <owner>mWhitePage</owner>
      <type>string</type>
      <cstype class="mWhitePage.ServerRootDN">string</cstype>
      <locale name="C">
        <short>Server Root</short>
        <long>Root DN of LDAP server</long>
      </locale>
      <default>o=Morrison Industries,c=US</default>
    </schema>
    <schema>
      <key>/schemas/apps/botwm/mWhitePage/serverBindDN</key>
      <applyto>/apps/botwm/mWhitePage/serverBindDN</applyto>
      <owner>mWhitePage</owner>
      <type>string</type>
      <cstype class="mWhitePage.ServerBindDN">string</cstype>
      <locale name="C">
        <short>Bind DN</short>
        <long>DN for binding to LDAP server</long>
      </locale>
      <default>ou=People,o=Morrison Industries,c=US</default>
    </schema>    
  </schemalist>
</gconfschemafile>

Summoning up the preference dialog with...
public class PreferencesWindow
{
[Widget] Dialog preferencesWindow;

	public PreferencesWindow() 
	{
     Glade.XML gxml = new Glade.XML (null, "gui.glade",
"preferencesWindow", null);
	 gxml.Autoconnect (this);
	 GConf.PropertyEditors.EditorShell shell =
	   new GConf.PropertyEditors.EditorShell(gxml);
	 shell.Add(mWhitePage.Settings.ServerName, "fieldServerName");
	 shell.Add(mWhitePage.Settings.ServerRootDN, "fieldServerRootDN");
	 shell.Add(mWhitePage.Settings.ServerBindDN, "fieldServerBindDN");
	}