From c5ebc2856b51b88efbbc964c564f54d8e1abf96f Mon Sep 17 00:00:00 2001 From: John Luke Date: Thu, 17 Jul 2003 02:56:34 +0000 Subject: [PATCH] 2003-07-16 John Luke * en/GConf/Client.xml: documented svn path=/trunk/gtk-sharp/; revision=16315 --- doc/ChangeLog | 1 + doc/en/GConf/Client.xml | 104 ++++++++++++++++++++++++++-------------- 2 files changed, 69 insertions(+), 36 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 304ff9edd..202c24611 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,6 +8,7 @@ * en/Gtk/CellRendererText.xml: documented, except one event and method * en/Gtk/CellRendererToggle.xml: documented * en/Gtk/CellRendererPixbuf.xml: documented + * en/GConf/Client.xml: documented 2003-07-15 Duncan Mak diff --git a/doc/en/GConf/Client.xml b/doc/en/GConf/Client.xml index ffbec3c35..bf6ad0194 100644 --- a/doc/en/GConf/Client.xml +++ b/doc/en/GConf/Client.xml @@ -9,8 +9,24 @@ Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. - To be added - To be added + Basic functions to initialize GConf and get/set values. + The following example attempts to retrieve a setting from GConf, and set a default value otherwise. + + +string MyVal; + +GConf.Client gconfClient = new GConf.Client (); + +try +{ + MyVal = (string) gconfClient.Get ("/apps/monoapps/SampleApp/setting1")); +} +catch (GConf.NoSuchKeyException) +{ + gconfClient.Set ("/apps/monoapps/SampleApp/setting1", "sample"); +} + + GConf.ClientBase @@ -26,8 +42,8 @@ - To be added - To be added + Suggests that you have just finished a block of changes, and it would be an optimal time to sync to permanent storage. + This function is just a "hint" provided to maximize efficiency and minimize data loss. @@ -41,10 +57,10 @@ - To be added - To be added: an object of type 'string' - To be added: an object of type 'GConf.NotifyEventHandler' - To be added + Removes a notification request. + an object of type + an object of type + @@ -58,9 +74,9 @@ - To be added - To be added: an object of type 'string' - To be added: an object of type 'GConf.NotifyEventHandler' + Registers a notification request. + an object of type + an object of type To be added @@ -74,27 +90,43 @@ - To be added - To be added: an object of type 'string' - To be added: an object of type 'object' - To be added - - - - - Method - - System.Void - - - - - - - To be added - To be added: an object of type 'string' - To be added: an object of type 'GConf.Value' - To be added + Gets a value from the GConf source. + an object of type + an object of type + Normally you will need to convert the value to the correct type before using it. + Here is how you could set a to use the system-wide setting for style. + + +// assuming you have a Gtk.Toolbar named toolbar1 + +string val; + +try +{ + GConf.Client gconfclient = new GConf.Client (); + val = (string) gconfclient.Get ("/desktop/gnome/interface/toolbar_style"); +} +catch (GConf.NoSuchKeyException) +{ + val = "both"; +} + +switch (val) { + case "both": + toolbar1.ToolbarStyle = Gtk.ToolbarStyle.Both; + break; + case "text": + toolbar1.ToolbarStyle = Gtk.ToolbarStyle.Text; + break; + case "both_horiz": + toolbar1.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz; + break; + default: + toolbar1.ToolbarStyle = Gtk.ToolbarStyle.Icons; + break; +} + + @@ -103,10 +135,10 @@ - To be added - To be added: an object of type 'GConf.Client' - To be added + Creates a new . + an object of type + This is the default constructor for . - \ No newline at end of file +