man Gnome2::GConf::Client () - Gnome2::GConf::Client
NAME
Gnome2::GConf::Client
DESCRIPTION
Gnome2::GConf::Client is a commodity class based on CWGObject used to access the default CWGConfEngine provided by the GConf daemon. It has a cache, finer-grained notification of changes and a default error handling mechanism.
ERROR HANDLING
In C, each fallible function has a CWGError optional argument: by setting it to a valid CWGError structure, the function will fill it in case of error; by passing a NULL value, the function will silently fail.
In Perl, each fallible method has a boolean CWcheck_error argument; by setting this argument to CWTRUE, the method will croak con failure, otherwise it will silently fail.
NOTE: To retain backward compatibility, the default behaviour is to check each error; that is, the CWcheck_error argument silently is set to TRUE.
In order to catch an error, you might use eval as a try...catch equivalent:
eval { $s = $client->get_string($some_key); 1; }; if (Glib::Error::matches($@, 'Gnome2::GConf::Error', 'bad-key')) { # recover from a bad-key error. }
On failure, if the error is unchecked, the CWunreturned_error signal will be fired by the Gnome2::GConf::Client object; the CWerror signal will always be fired, whether the error is checked or not.
If you want to let the global error handler function catch just the unchecked error, use the CWGnome2::GConf::Client::set_error_handling method, and attach a callback to the CWunreturned_error signal:
$client->set_error_handling('handle-unreturned'); $client->signal_connect(unreturned_error => sub { my ($client, $error) = @_; warn $error; # is a Glib::Error });
HIERARCHY
Glib::Object +----Gnome2::GConf::Client
METHODS
This method returns an array containing all the directories in a given directory. This method returns an array containing all the entries (as Gnome2::GConf::Entry) of a given directory. Returns FALSE on failure.
- * ... (list) list of keys to add to the changeset
- Create a Gnome2::GConf::ChangeSet from a list of keys inside the GConf database.
$client->clear_cache
Commit a given Gnome2::GConf::ChangeSet. In scalar context, or if $remove_committed is FALSE, return a boolean value; otherwise, return the boolean value and the Gnome2::GConf::ChangeSet $cs, pruned of the successfully committed changes.
client = Gnome2::GConf::Client->get_default
You should not use this method. This method emits the error signal.
$client->set_error_handling ($mode)
Returns FALSE on failure.
client = Gnome2::GConf::Client->get_for_engine ($engine)
Fetch the CWGConfValue bound to the give $key. Set the CWGConfValue $val bound to the given $key. Returns FALSE on failure.
$client->notify_remove ($cnxn_id)
Reverse the given Gnome2::GConf::ChangeSet. Returns FALSE on failure
$client->suggest_sync ($check_error=TRUE)
You should not use this method. This method emits the unreturned-error signal. You should not use this method. This method emits the value-changed signal.
SIGNALS
- value-changed (Gnome2::GConf::Client, string, gpointer)
- unreturned-error (Gnome2::GConf::Client, gpointer)
- error (Gnome2::GConf::Client, gpointer)
ENUMS AND FLAGS
enum Gnome2::GConf::ClientErrorHandlingMode
- * 'handle-none' / 'GCONF_CLIENT_HANDLE_NONE'
- * 'handle-unreturned' / 'GCONF_CLIENT_HANDLE_UNRETURNED'
- * 'handle-all' / 'GCONF_CLIENT_HANDLE_ALL'
enum Gnome2::GConf::ClientPreloadType
- * 'preload-none' / 'GCONF_CLIENT_PRELOAD_NONE'
- * 'preload-onelevel' / 'GCONF_CLIENT_PRELOAD_ONELEVEL'
- * 'preload-recursive' / 'GCONF_CLIENT_PRELOAD_RECURSIVE'
SEE ALSO
Gnome2::GConf, Glib::Object
COPYRIGHT
Copyright (C) 2003-2005 by the gtk2-perl team.
This software is licensed under the LGPL. See Gnome2::GConf for a full notice.