diff --git a/ChangeLog b/ChangeLog index 8212c403d..1da422a8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,23 @@ +2003-02-13 Gonzalo Paniagua Javier + + * gconf/GConf/Client.cs: + * gconf/GConf/NoSuchKeyException.cs: added key string to the exception + when Get does not find it. + 2003-02-11 Duncan Mak * gnome/voidObjectAffineSVPintSignal.cs: * gnome/CanvasProxy.cs: Make the voidObjectAffineSVPintSignal class be in the 'GtkSharp' namespace, instead of 'GtkSharp.Gnome'. +2003-02-10 Gonzalo Paniagua Javier + + * gconf/GConf/Client.cs: added a new Get method which takes a default + value to be returned when the key is not found. + + * gconf/GConf/NoSuchKeyException.cs: added a couple of ctors to display + useful messages. + 2003-02-10 Gonzalo Paniagua Javier * glade/XML.custom: added a couple of checks for null. diff --git a/gconf/GConf/Client.cs b/gconf/GConf/Client.cs index 2ac9a2036..01c2dc198 100644 --- a/gconf/GConf/Client.cs +++ b/gconf/GConf/Client.cs @@ -41,12 +41,16 @@ namespace GConf public override object Get (string key) { + if (key == null) + throw new ArgumentNullException ("key"); + IntPtr err; IntPtr raw = gconf_client_get (Raw, key, out err); if (err != IntPtr.Zero) throw new GLib.GException (err); + if (raw == IntPtr.Zero) - throw new NoSuchKeyException (); + throw new NoSuchKeyException (key); Value val = new Value (raw); return val.Get (); diff --git a/gconf/GConf/NoSuchKeyException.cs b/gconf/GConf/NoSuchKeyException.cs index bf774ffe4..ba539d94e 100644 --- a/gconf/GConf/NoSuchKeyException.cs +++ b/gconf/GConf/NoSuchKeyException.cs @@ -4,5 +4,15 @@ namespace GConf public class NoSuchKeyException : Exception { + public NoSuchKeyException () + : base ("The requested GConf key was not found") + { + } + + public NoSuchKeyException (string key) + : base ("Key '" + key + "' not found in GConf") + { + } } } +