00001
00002
00003
#ifndef _GCONFMM_CLIENT_H
00004
#define _GCONFMM_CLIENT_H
00005
00006
#include <glibmm.h>
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
#include <gconf/gconf-client.h>
00031
00032
#include <glibmm/object.h>
00033
00034
#include <glibmm/error.h>
00035
#include <gconfmm/value.h>
00036
#include <gconfmm/callback.h>
00037
#include <gconfmm/entry.h>
00038
#include <gconfmm/schema.h>
00039
#include <gconfmm/setinterface.h>
00040
#include <gconfmm/changeset.h>
00041
00042
00043
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00044
typedef struct _GConfClient GConfClient;
00045
typedef struct _GConfClientClass GConfClientClass;
00046
#endif
00047
00048
00049
namespace Gnome
00050 {
00051
00052
namespace Conf
00053 {
class Client_Class; }
00054
00055 }
00056
namespace Gnome
00057 {
00058
namespace Conf
00059 {
00060
00066 enum ClientErrorHandlingMode
00067 {
00068 CLIENT_HANDLE_NONE,
00069 CLIENT_HANDLE_UNRETURNED,
00070 CLIENT_HANDLE_ALL
00071 };
00072
00073 }
00074
00075 }
00076
00077
00078
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00079
namespace Glib
00080 {
00081
00082
template <>
00083
class Value<Gnome::Conf::
ClientErrorHandlingMode> :
public Glib::Value_Enum<Gnome::Conf::ClientErrorHandlingMode>
00084 {
00085
public:
00086
static GType
value_type() G_GNUC_CONST;
00087 };
00088
00089 }
00090 #endif
00091
00092
00093 namespace Gnome
00094 {
00095
00096
namespace Conf
00097 {
00098
00102 enum ClientPreloadType
00103 {
00104 CLIENT_PRELOAD_NONE,
00105 CLIENT_PRELOAD_ONELEVEL,
00106 CLIENT_PRELOAD_RECURSIVE
00107 };
00108
00109 }
00110
00111 }
00112
00113
00114
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00115
namespace Glib
00116 {
00117
00118
template <>
00119
class Value<Gnome::Conf::
ClientPreloadType> :
public Glib::Value_Enum<Gnome::Conf::ClientPreloadType>
00120 {
00121
public:
00122
static GType
value_type() G_GNUC_CONST;
00123 };
00124
00125 }
00126 #endif
00127
00128
00129 namespace Gnome
00130 {
00131
00132
namespace Conf
00133 {
00134
00135
00138 class Error :
public Glib::
Error
00139 {
00140
public:
00141 enum Code
00142 {
00143 SUCCESS = 0,
00144 NO_SERVER = 2,
00145 NO_PERMISSION = 3,
00146 BAD_ADDRESS = 4,
00147 PARSE_ERROR = 6,
00148 CORRUPT = 7,
00149 TYPE_MISMATCH = 8,
00150 IS_DIR = 9,
00151 IS_KEY = 10,
00152 OVERRIDDEN = 11,
00153 OAF_ERROR = 12,
00154 LOCAL_ENGINE = 13,
00155 LOCK_FAILED = 14,
00156 NO_WRITABLE_DATABASE = 15,
00157 IN_SHUTDOWN = 16
00158 };
00159
00160
Error(Code error_code,
const Glib::ustring& error_message);
00161
explicit Error(GError* gobject);
00162 Code code() const;
00163
00164 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00165 private:
00166 static
void throw_func(GError* gobject);
00167 friend
void wrap_init();
00168 #endif
00169 };
00170
00171 }
00172
00173 }
00174
00175 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00176 namespace Glib
00177 {
00178
00179
template <>
00180
class Value<Gnome::Conf::
Error::Code> :
public Glib::Value_Enum<Gnome::Conf::Error::Code>
00181 {
00182
public:
00183
static GType
value_type() G_GNUC_CONST;
00184 };
00185
00186 }
00187 #endif
00188
00189
00190 namespace Gnome
00191 {
00192
00193
namespace Conf
00194 {
00195
00196
00207 class Client :
public Glib::Object,
public SetInterface
00208 {
00209
00210
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00211
00212
public:
00213
typedef Client CppObjectType;
00214
typedef Client_Class CppClassType;
00215
typedef GConfClient BaseObjectType;
00216
typedef GConfClientClass BaseClassType;
00217
00218
private:
friend class Client_Class;
00219
static CppClassType client_class_;
00220
00221
private:
00222
00223
Client(
const Client&);
00224
Client&
operator=(
const Client&);
00225
00226
protected:
00227
explicit Client(
const Glib::ConstructParams& construct_params);
00228
explicit Client(GConfClient* castitem);
00229
00230
#endif
00231
00232
public:
00233
virtual ~
Client();
00234
00235
#ifndef DOXYGEN_SHOULD_SKIP_THIS
00236
static GType get_type() G_GNUC_CONST;
00237
static GType get_base_type() G_GNUC_CONST;
00238
#endif
00239
00241 GConfClient*
gobj() {
return reinterpret_cast<GConfClient*>(gobject_); }
00242
00244 const GConfClient*
gobj()
const {
return reinterpret_cast<GConfClient*>(gobject_); }
00245
00247 GConfClient* gobj_copy();
00248
00249
private:
00250 ;
00251
00252
public:
00253
00257
static Glib::RefPtr<Client> get_default_client();
00258
static Glib::RefPtr<Client> get_client_for_engine(GConfEngine* engine);
00259
00273
void add_dir(
const Glib::ustring& dir, ClientPreloadType preload = CLIENT_PRELOAD_NONE);
00274
00278
void remove_dir(
const Glib::ustring& dir);
00279
00280
00299 guint notify_add(
const Glib::ustring& namespace_section,
Callback callback);
00300
00301
00307
void notify_remove(guint cnxn);
00308
00309
00310
void set_error_handling(ClientErrorHandlingMode mode);
00311
00314
void clear_cache();
00315
00322
void preload(
const Glib::ustring& dirname, ClientPreloadType type);
00323
00330
Value get(
const Glib::ustring& key)
const;
00331
00340
Value get_without_default(
const Glib::ustring& key)
const;
00341
00348
Value get_default_from_schema(
const Glib::ustring& key)
const;
00349
00358
Entry get_entry(
const Glib::ustring& key,
bool use_schema_default =
true)
const;
00359
00369
Entry get_entry(
const Glib::ustring& key,
const char* locale,
bool use_schema_default =
true)
const;
00370
00376
void unset(
const Glib::ustring& key);
00377
00385
Glib::SListHandle<Entry> all_entries(
const Glib::ustring& dir)
const;
00386
00393
Glib::SListHandle<Glib::ustring> all_dirs(
const Glib::ustring& dir)
const;
00394
00400
void suggest_sync();
00401
00407
bool dir_exists(
const Glib::ustring&) const;
00408
00414
bool key_is_writable(const Glib::ustring&) const;
00415
00423
double get_float(const Glib::ustring& key) const;
00424
00428 gint get_int(const Glib::ustring& key) const;
00429
00433
bool get_bool(const Glib::ustring& key) const;
00434
00438 Glib::ustring get_string(const Glib::ustring& key) const;
00439
00443
Schema get_schema(const Glib::ustring& key) const;
00444
00452 SListHandle_ValueInt get_int_list(const Glib::ustring& key) const;
00453
00456 SListHandle_ValueBool get_bool_list(const Glib::ustring& key) const;
00457
00460 SListHandle_ValueFloat get_float_list(const Glib::ustring& key) const;
00461
00464 SListHandle_ValueSchema get_schema_list(const Glib::ustring& key) const;
00465
00468 SListHandle_ValueString get_string_list(const Glib::ustring& key) const;
00469
00470
00479
ValuePair get_pair(const Glib::ustring& key,
ValueTypePair types) const;
00480
00481
00488
void set(const Glib::ustring& key,
int what);
00489
00493
void set(const Glib::ustring& key,
bool what);
00494
00498
void set(const Glib::ustring& key,
double what);
00499
00503
void set(const Glib::ustring& key, const Glib::ustring& what);
00504
00508
void set(const Glib::ustring& key, const
Schema& what);
00509
00514
void set(const Glib::ustring& key, const
Value& what);
00515
00516
00526
ChangeSet change_set_from_current(const Glib::SArray& set);
00527
00528
00540
void change_set_commit(
ChangeSet& set,
bool remove_commited);
00541
00553
ChangeSet change_set_reverse(const
ChangeSet& set);
00554
00560 Glib::SignalProxy2<
void,const Glib::ustring&,const
Value& > signal_value_changed();
00561
00562
00563
void value_changed(const Glib::ustring& key, const
Value& value);
00564
00565 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00566
00567
00568
00569
00570 Glib::SignalProxy1<
void,const Glib::
Error& > signal_unreturned_error();
00571
00572
00573
void unreturned_error(const Glib::
Error& error);
00574 #endif
00575
00581 Glib::SignalProxy1<
void,const Glib::
Error& > signal_error();
00582
00583
00584
void error(const Glib::
Error& error);
00585
00586 private:
00587
void handle_error(GError* pError) const;
00588
00589 GSList* get_list(const Glib::ustring& key, GConfValueType list_type) const;
00590
00591
00592 public:
00593
00594 public:
00595
00596
00597 protected:
00598
00599
00600
00601 virtual
void on_value_changed(const Glib::ustring& key, const
Value& value);
00602 virtual
void on_unreturned_error(const Glib::
Error& error);
00603 virtual
void on_error(const Glib::
Error& error);
00604
00605
00606 };
00607
00608 }
00609 }
00610
00611
00612 namespace Glib
00613 {
00619
Glib::RefPtr<Gnome::Conf::Client> wrap(GConfClient* object,
bool take_copy =
false);
00620 }
00621
00622
00623
#endif
00624