2003-02-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* gconf/GConf/Client.cs:
	* gconf/GConf/NoSuchKeyException.cs: added key string to the exception
	when Get does not find it.

svn path=/trunk/gtk-sharp/; revision=11544
This commit is contained in:
Gonzalo Paniagua Javier 2003-02-13 03:05:17 +00:00
parent a86191d48d
commit 011ad9f4bf
3 changed files with 29 additions and 1 deletions

View file

@ -1,9 +1,23 @@
2003-02-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* 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 <duncan@ximian.com>
* 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 <gonzalo@ximian.com>
* 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 <gonzalo@ximian.com>
* glade/XML.custom: added a couple of checks for null.

View file

@ -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 ();

View file

@ -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")
{
}
}
}