Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

client.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // Generated by gtkmmproc -- DO NOT MODIFY!
00003 #ifndef _GCONFMM_CLIENT_H
00004 #define _GCONFMM_CLIENT_H
00005 
00006 #include <glibmm.h>
00007 
00008 // -*- Mode: C++; c-basic-offset: 4 -*-
00009 /* $Id: client.hg,v 1.15 2002/12/10 23:26:01 murrayc Exp $ */
00010 
00011 /* client.hg
00012  * 
00013  * Copyright (C) 2000-2002 GConfmm Development Team
00014  *
00015  * This library is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU Library General Public
00017  * License as published by the Free Software Foundation; either
00018  * version 2 of the License, or (at your option) any later version.
00019  *
00020  * This library is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023  * Library General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU Library General Public
00026  * License along with this library; if not, write to the Free
00027  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 /* DOXYGEN_SHOULD_SKIP_THIS */
00047 
00048 
00049 namespace Gnome
00050 {
00051 
00052 namespace Conf
00053 { class Client_Class; } // namespace Conf
00054 
00055 } // namespace Gnome
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 } // namespace Conf
00074 
00075 } // namespace Gnome
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 } // namespace Glib
00090 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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 } // namespace Conf
00110 
00111 } // namespace Gnome
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 } // namespace Glib
00126 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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(); // uses throw_func()
00168 #endif
00169 };
00170 
00171 } // namespace Conf
00172 
00173 } // namespace Gnome
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 } // namespace Glib
00187 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
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:
00219   friend class Client_Class;
00220   static CppClassType client_class_;
00221 
00222   // noncopyable
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 /* DOXYGEN_SHOULD_SKIP_THIS */
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 
00240   GConfClient*       gobj()       { return reinterpret_cast<GConfClient*>(gobject_); }
00241   const GConfClient* gobj() const { return reinterpret_cast<GConfClient*>(gobject_); }
00242 
00243   GConfClient* gobj_copy();
00244 
00245 private:
00246 ;
00247     
00248 public:
00249     
00253     static Glib::RefPtr<Client> get_default_client();
00254     static Glib::RefPtr<Client> get_client_for_engine(GConfEngine* engine);
00255     
00269   void add_dir(const Glib::ustring& dir, ClientPreloadType preload = CLIENT_PRELOAD_NONE);
00270 
00274   void remove_dir(const Glib::ustring& dir);
00275 
00276     // API-TODO: Should this return a Connection ?
00295     guint notify_add(const Glib::ustring& namespace_section, Callback callback);
00296     
00297     
00303   void notify_remove(guint cnxn);
00304     
00305     
00306   void set_error_handling(ClientErrorHandlingMode mode);
00307     
00310   void clear_cache();
00311     
00318   void preload(const Glib::ustring& dirname, ClientPreloadType type);
00319     
00326   Value get(const Glib::ustring& key) const;
00327 
00336   Value get_without_default(const Glib::ustring& key) const;
00337 
00344   Value get_default_from_schema(const Glib::ustring& key) const;
00345 
00354     Entry get_entry(const Glib::ustring& key, bool use_schema_default = true) const;
00355       
00365   Entry get_entry(const Glib::ustring& key, const char* locale, bool use_schema_default = true) const;
00366     
00372   void unset(const Glib::ustring& key);
00373     
00381   Glib::SListHandle<Entry> all_entries(const Glib::ustring& dir) const;
00382 
00389   Glib::SListHandle<Glib::ustring> all_dirs(const Glib::ustring& dir) const;
00390     
00396   void suggest_sync();
00397 
00403   bool dir_exists(const Glib::ustring&) const;
00404 
00410   bool key_is_writable(const Glib::ustring&) const;
00411     
00419   double get_float(const Glib::ustring& key) const;
00420 
00424   gint get_int(const Glib::ustring& key) const;
00425 
00429   bool get_bool(const Glib::ustring& key) const;
00430 
00434   Glib::ustring get_string(const Glib::ustring& key) const;
00435 
00439   Schema get_schema(const Glib::ustring& key) const;
00440 
00448     SListHandle_ValueInt    get_int_list(const Glib::ustring& key) const;
00449 
00452     SListHandle_ValueBool   get_bool_list(const Glib::ustring& key) const;
00453 
00456     SListHandle_ValueFloat  get_float_list(const Glib::ustring& key) const;
00457 
00460     SListHandle_ValueSchema get_schema_list(const Glib::ustring& key) const;
00461 
00464     SListHandle_ValueString get_string_list(const Glib::ustring& key) const;
00465     
00466     
00475     ValuePair get_pair(const Glib::ustring& key, ValueTypePair types) const;
00476     
00477     
00484   void set(const Glib::ustring& key, int what);
00485 
00489   void set(const Glib::ustring& key, bool what);
00490 
00494   void set(const Glib::ustring& key,double what);
00495 
00499   void set(const Glib::ustring& key, const Glib::ustring& what);
00500 
00504   void set(const Glib::ustring& key, const Schema& what);
00505 
00510   void set(const Glib::ustring& key, const Value& what);
00511     
00512     
00522   ChangeSet change_set_from_current(const Glib::SArray& set);
00523     
00524 
00536   void change_set_commit(ChangeSet& set, bool remove_commited);
00537 
00549   ChangeSet change_set_reverse(const ChangeSet& set);
00550 
00559   Glib::SignalProxy2<void,const Glib::ustring&,const Value&> signal_value_changed();
00560 
00561     
00562   void value_changed(const Glib::ustring& key, const Value& value);
00563 
00564 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00565     // unreturned_error will never be called, as gconfmm
00566     // catches all GError's and throw()s them as Gnome::Conf::Error's.
00567     
00572   Glib::SignalProxy1<void,const Glib::Error&> signal_unreturned_error();
00573 
00574     
00575   void unreturned_error(const Glib::Error& error);
00576 #endif
00577 
00586   Glib::SignalProxy1<void,const Glib::Error&> signal_error();
00587 
00588     
00589   void error(const Glib::Error& error);
00590     
00591 private:
00592     void handle_error(GError* pError) const;
00593     
00594     GSList* get_list(const Glib::ustring& key, GConfValueType list_type) const;
00595 
00596 
00597 public:
00598 
00599 public:
00600   //C++ methods used to invoke GTK+ virtual functions:
00601 
00602 protected:
00603   //GTK+ Virtual Functions (override these to change behaviour):
00604 
00605   //Default Signal Handlers::
00606   virtual void on_value_changed(const Glib::ustring& key, const Value& value);
00607   virtual void on_unreturned_error(const Glib::Error& error);
00608   virtual void on_error(const Glib::Error& error);
00609 
00610 
00611 };
00612 
00613 } /* namespace Conf */
00614 } /* namespace Gnome */
00615 
00616 
00617 namespace Glib
00618 {
00620   Glib::RefPtr<Gnome::Conf::Client> wrap(GConfClient* object, bool take_copy = false);
00621 }
00622 
00623 
00624 #endif /* _GCONFMM_CLIENT_H */
00625 

Generated on Wed Oct 29 12:42:56 2003 for gconfmm by doxygen 1.3.4