Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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:  friend class Client_Class;
00219   static CppClassType client_class_;
00220 
00221 private:
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 
00241   GConfClient*       gobj()       { return reinterpret_cast<GConfClient*>(gobject_); }
00242 
00244   const GConfClient* gobj() const { return reinterpret_cast<GConfClient*>(gobject_); }
00245 
00246   GConfClient* gobj_copy();
00247 
00248 private:
00249 ;
00250     
00251 public:
00252     
00256     static Glib::RefPtr<Client> get_default_client();
00257     static Glib::RefPtr<Client> get_client_for_engine(GConfEngine* engine);
00258     
00272   void add_dir(const Glib::ustring& dir, ClientPreloadType preload = CLIENT_PRELOAD_NONE);
00273 
00277   void remove_dir(const Glib::ustring& dir);
00278 
00279     // API-TODO: Should this return a Connection ?
00298     guint notify_add(const Glib::ustring& namespace_section, Callback callback);
00299     
00300     
00306   void notify_remove(guint cnxn);
00307     
00308     
00309   void set_error_handling(ClientErrorHandlingMode mode);
00310     
00313   void clear_cache();
00314     
00321   void preload(const Glib::ustring& dirname, ClientPreloadType type);
00322     
00329   Value get(const Glib::ustring& key) const;
00330 
00339   Value get_without_default(const Glib::ustring& key) const;
00340 
00347   Value get_default_from_schema(const Glib::ustring& key) const;
00348 
00357     Entry get_entry(const Glib::ustring& key, bool use_schema_default = true) const;
00358       
00368   Entry get_entry(const Glib::ustring& key, const char* locale, bool use_schema_default = true) const;
00369     
00375   void unset(const Glib::ustring& key);
00376     
00384   Glib::SListHandle<Entry> all_entries(const Glib::ustring& dir) const;
00385 
00392   Glib::SListHandle<Glib::ustring> all_dirs(const Glib::ustring& dir) const;
00393     
00399   void suggest_sync();
00400 
00406   bool dir_exists(const Glib::ustring&) const;
00407 
00413   bool key_is_writable(const Glib::ustring&) const;
00414     
00422   double get_float(const Glib::ustring& key) const;
00423 
00427   gint get_int(const Glib::ustring& key) const;
00428 
00432   bool get_bool(const Glib::ustring& key) const;
00433 
00437   Glib::ustring get_string(const Glib::ustring& key) const;
00438 
00442   Schema get_schema(const Glib::ustring& key) const;
00443 
00451     SListHandle_ValueInt    get_int_list(const Glib::ustring& key) const;
00452 
00455     SListHandle_ValueBool   get_bool_list(const Glib::ustring& key) const;
00456 
00459     SListHandle_ValueFloat  get_float_list(const Glib::ustring& key) const;
00460 
00463     SListHandle_ValueSchema get_schema_list(const Glib::ustring& key) const;
00464 
00467     SListHandle_ValueString get_string_list(const Glib::ustring& key) const;
00468     
00469     
00478     ValuePair get_pair(const Glib::ustring& key, ValueTypePair types) const;
00479     
00480     
00487   void set(const Glib::ustring& key, int what);
00488 
00492   void set(const Glib::ustring& key, bool what);
00493 
00497   void set(const Glib::ustring& key,double what);
00498 
00502   void set(const Glib::ustring& key, const Glib::ustring& what);
00503 
00507   void set(const Glib::ustring& key, const Schema& what);
00508 
00513   void set(const Glib::ustring& key, const Value& what);
00514     
00515     
00525   ChangeSet change_set_from_current(const Glib::SArray& set);
00526     
00527 
00539   void change_set_commit(ChangeSet& set, bool remove_commited);
00540 
00552   ChangeSet change_set_reverse(const ChangeSet& set);
00553 
00562   Glib::SignalProxy2<void,const Glib::ustring&,const Value&> signal_value_changed();
00563 
00564     
00565   void value_changed(const Glib::ustring& key, const Value& value);
00566 
00567 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00568     // unreturned_error will never be called, as gconfmm
00569     // catches all GError's and throw()s them as Gnome::Conf::Error's.
00570     
00575   Glib::SignalProxy1<void,const Glib::Error&> signal_unreturned_error();
00576 
00577     
00578   void unreturned_error(const Glib::Error& error);
00579 #endif
00580 
00589   Glib::SignalProxy1<void,const Glib::Error&> signal_error();
00590 
00591     
00592   void error(const Glib::Error& error);
00593     
00594 private:
00595     void handle_error(GError* pError) const;
00596     
00597     GSList* get_list(const Glib::ustring& key, GConfValueType list_type) const;
00598 
00599 
00600 public:
00601 
00602 public:
00603   //C++ methods used to invoke GTK+ virtual functions:
00604 
00605 protected:
00606   //GTK+ Virtual Functions (override these to change behaviour):
00607 
00608   //Default Signal Handlers::
00609   virtual void on_value_changed(const Glib::ustring& key, const Value& value);
00610   virtual void on_unreturned_error(const Glib::Error& error);
00611   virtual void on_error(const Glib::Error& error);
00612 
00613 
00614 };
00615 
00616 } /* namespace Conf */
00617 } /* namespace Gnome */
00618 
00619 
00620 namespace Glib
00621 {
00623   Glib::RefPtr<Gnome::Conf::Client> wrap(GConfClient* object, bool take_copy = false);
00624 }
00625 
00626 
00627 #endif /* _GCONFMM_CLIENT_H */
00628 

Generated on Fri Nov 5 06:43:01 2004 for gconfmm by  doxygen 1.3.9.1