Reference Manual

Inti Logo
Main Page | Namespace List | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

client.h

Go to the documentation of this file.
00001 /*  Inti-GConf: Integrated Foundation Classes
00002  *  Copyright (C) 2002-2003 The Inti Development Team.
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00027 
00028 #ifndef INTI_GCONF_CLIENT_H
00029 #define INTI_GCONF_CLIENT_H
00030 
00031 #ifndef INTI_G_OBJECT_H
00032 #include <inti/glib/object.h>
00033 #endif
00034 
00035 #ifndef GCONF_GCONF_CLIENT_H
00036 #include <gconf/gconf-client.h>
00037 #endif
00038 
00039 #ifndef CPP_VECTOR_H
00040 #include <vector>
00041 #endif
00042 
00043 namespace Inti {
00044 
00045 namespace G {
00046 class Error;
00047 }
00048 
00049 namespace GConf {
00050 
00051 class ChangeSet;
00052 class ClientClass;
00053 class Entry;
00054 class Schema;
00055 class Value;
00056 
00062 
00070 
00078 
00079 class Client : public G::Object
00080 {
00081         friend class G::Object;
00082         friend class ClientClass;
00083 
00084         Client(const Client&);
00085         Client& operator=(const Client&);
00086         
00087 protected:
00088         explicit Client(GConfClient *client, bool reference = true);
00095 
00098 
00099         virtual void on_value_changed(const String& key, const Value *value);
00108 
00109         virtual void on_unreturned_error(const G::Error& error);
00116         
00117         virtual void on_error(const G::Error& error);
00123 
00125 //  Signals
00126 
00127         typedef G::Signal2<void, const char*, GConfValue*> ValueChangedSignalType;
00128         typedef G::SignalProxy<G::TypeInstance, ValueChangedSignalType> ValueChangedSignalProxy;
00129         static const ValueChangedSignalType value_changed_signal;
00130 
00131         typedef G::Signal1<void, GError*> UnreturnedErrorSignalType;
00132         typedef G::SignalProxy<G::TypeInstance, UnreturnedErrorSignalType> UnreturnedErrorSignalProxy;
00133         static const UnreturnedErrorSignalType unreturned_error_signal;
00134 
00135         typedef G::Signal1<void, GError*> ErrorSignalType;
00136         typedef G::SignalProxy<G::TypeInstance, ErrorSignalType> ErrorSignalProxy;
00137         static const ErrorSignalType error_signal;
00138 
00139 public:
00140         typedef Slot2<void, unsigned int, const Entry&> NotifySlot;
00153 
00154         enum PreloadType
00155         {
00156                 PRELOAD_NONE = GCONF_CLIENT_PRELOAD_NONE, 
00158 
00159                 PRELOAD_ONELEVEL = GCONF_CLIENT_PRELOAD_ONELEVEL, 
00161 
00162                 PRELOAD_RECURSIVE = GCONF_CLIENT_PRELOAD_RECURSIVE 
00164         };
00165 
00166         enum ErrorHandlingMode
00167         {
00168                 HANDLE_NONE = GCONF_CLIENT_HANDLE_NONE, 
00170 
00171                 HANDLE_UNRETURNED = GCONF_CLIENT_HANDLE_UNRETURNED, 
00173 
00174                 HANDLE_ALL = GCONF_CLIENT_HANDLE_ALL 
00176         };
00177         
00180 
00181         virtual ~Client();
00183         
00185 
00186         static Pointer<Client> get_default();
00194 
00195         static Pointer<Client> get_for_engine(GConfEngine *engine);
00203 
00206 
00207         GConfClient* gconf_client() const { return (GConfClient*)instance; }
00209 
00210         GConfClientClass* gconf_client_class() const;
00212 
00213         operator GConfClient* () const;
00215 
00216         bool is_gconf_client() const;
00218 
00219         Value get(const String& key, G::Error *error = 0) const;
00229 
00230         Value get_without_default(const String& key, G::Error *error = 0) const;
00239 
00240         Entry get_entry(const String& key, const String& locale, bool use_schema_default, G::Error *error = 0) const;
00252 
00253         Value get_default_from_schema(const String& key, G::Error *error = 0) const;
00265 
00266         bool dir_exists(const String& dir, G::Error *error = 0) const;
00271 
00272         bool key_is_writable(const String& key, G::Error *error = 0) const;
00277 
00278         double get_float(const String& key, G::Error *error = 0) const;
00286 
00287         int get_int(const String& key, G::Error *error = 0) const;
00295 
00296         String get_string(const String& key, G::Error *error = 0) const;
00304 
00305         bool get_bool(const String& key, G::Error *error = 0) const;
00313 
00314         Schema get_schema(const String& key, G::Error *error = 0) const;
00323 
00324         bool get_list(const String& key, std::vector<int>& list, G::Error *error = 0) const;
00334 
00335         bool get_list(const String& key, std::vector<bool>& list, G::Error *error = 0) const;
00345 
00346         bool get_list(const String& key, std::vector<double>& list, G::Error *error = 0) const;
00356 
00357         bool get_list(const String& key, std::vector<String>& list, G::Error *error = 0) const;
00367 
00368         bool get_list(const String& key, std::vector<Schema>& list, G::Error *error = 0) const;
00378 
00379         bool get_pair(const String& key, int& car_data, int& cdr_data, G::Error *error = 0) const;
00413 
00414         bool get_pair(const String& key, int& car_data, bool& cdr_data, G::Error *error = 0) const;
00416 
00417         bool get_pair(const String& key, int& car_data, double& cdr_data, G::Error *error = 0) const;
00419 
00420         bool get_pair(const String& key, int& car_data, String& cdr_data, G::Error *error = 0) const;
00422 
00423         bool get_pair(const String& key, int& car_data, Schema &cdr_data, G::Error *error = 0) const;
00425 
00426         bool get_pair(const String& key, bool& car_data, int& cdr_data, G::Error *error = 0) const;
00428 
00429         bool get_pair(const String& key, bool& car_data, bool& cdr_data, G::Error *error = 0) const;
00431 
00432         bool get_pair(const String& key, bool& car_data, double& cdr_data, G::Error *error = 0) const;
00434 
00435         bool get_pair(const String& key, bool& car_data, String& cdr_data, G::Error *error = 0) const;
00437 
00438         bool get_pair(const String& key, bool& car_data, Schema &cdr_data, G::Error *error = 0) const;
00440 
00441         bool get_pair(const String& key, double& car_data, int& cdr_data, G::Error *error = 0) const;
00443 
00444         bool get_pair(const String& key, double& car_data, bool& cdr_data, G::Error *error = 0) const;
00446 
00447         bool get_pair(const String& key, double& car_data, double& cdr_data, G::Error *error = 0) const;
00449 
00450         bool get_pair(const String& key, double& car_data, String& cdr_data, G::Error *error = 0) const;
00452 
00453         bool get_pair(const String& key, double& car_data, Schema &cdr_data, G::Error *error = 0) const;
00455 
00456         bool get_pair(const String& key, String& car_data, int& cdr_data, G::Error *error = 0) const;
00458 
00459         bool get_pair(const String& key, String& car_data, bool& cdr_data, G::Error *error = 0) const;
00461 
00462         bool get_pair(const String& key, String& car_data, double& cdr_data, G::Error *error = 0) const;
00464 
00465         bool get_pair(const String& key, String& car_data, String& cdr_data, G::Error *error = 0) const;
00467 
00468         bool get_pair(const String& key, String& car_data, Schema &cdr_data, G::Error *error = 0) const;
00470 
00471         bool get_pair(const String& key, Schema &car_data, int& cdr_data, G::Error *error = 0) const;
00473 
00474         bool get_pair(const String& key, Schema &car_data, bool& cdr_data, G::Error *error = 0) const;
00476 
00477         bool get_pair(const String& key, Schema &car_data, double& cdr_data, G::Error *error = 0) const;
00479 
00480         bool get_pair(const String& key, Schema &car_data, String& cdr_data, G::Error *error = 0) const;
00482 
00483         bool get_pair(const String& key, Schema &car_data, Schema &cdr_data, G::Error *error = 0) const;
00485 
00489 
00490         void add_dir(const char* dir, PreloadType preload, G::Error *error = 0);
00504 
00505         void add_dir(const String& dir, PreloadType preload, G::Error *error = 0);
00512 
00513         void remove_dir(const char* dir, G::Error *error = 0);
00522 
00523         void remove_dir(const String& dir, G::Error *error = 0);
00529 
00530         unsigned int notify_add(const String& namespace_section, NotifySlot *slot, G::Error *error = 0);
00551 
00552         void notify_remove(unsigned int connect_id);
00555 
00556         void set_error_handling(ErrorHandlingMode mode);
00563 
00564         void clear_cache();
00568 
00569         void preload(const String& dirname, PreloadType type, G::Error *error = 0);
00577 
00578         void set(const String& key, const Value& value, G::Error *error = 0);
00587 
00588         bool unset(const String& key, G::Error *error = 0);
00596 
00597         std::vector<Entry> all_entries(const String& dir, G::Error *error = 0);
00605 
00606         std::vector<String> all_dirs(const String& dir, G::Error *error = 0);
00611 
00612         void suggest_sync(G::Error *error = 0);
00620 
00621         bool set_float(const String& key, double value, G::Error *error = 0);
00629 
00630         bool set_int(const String& key, int value, G::Error *error = 0);
00638 
00639         bool set_string(const String& key, const String& value, G::Error *error = 0);
00647 
00648         bool set_bool(const String& key, bool value, G::Error *error = 0);
00656 
00657         bool set_schema(const String& key, const Schema& value, G::Error *error = 0);
00665 
00666         bool set_list(const String& key, const std::vector<int>& list, G::Error *error = 0);
00672 
00673         bool set_list(const String& key, const std::vector<bool>& list, G::Error *error = 0);
00679 
00680         bool set_list(const String& key, const std::vector<double>& list, G::Error *error = 0);
00686 
00687         bool set_list(const String& key, const std::vector<String>& list, G::Error *error = 0);
00693 
00694         bool set_list(const String& key, const std::vector<Schema>& list, G::Error *error = 0);
00700 
00701         bool set_pair(const String& key, int car_data, int cdr_data, G::Error *error = 0);
00708 
00709         bool set_pair(const String& key, int car_data, bool cdr_data, G::Error *error = 0);
00711 
00712         bool set_pair(const String& key, int car_data, double cdr_data, G::Error *error = 0);
00714 
00715         bool set_pair(const String& key, int car_data, const String& cdr_data, G::Error *error = 0);
00717 
00718         bool set_pair(const String& key, int car_data, const Schema& cdr_data, G::Error *error = 0);
00720 
00721         bool set_pair(const String& key, bool car_data, int cdr_data, G::Error *error = 0);
00723 
00724         bool set_pair(const String& key, bool car_data, bool cdr_data, G::Error *error = 0);
00726 
00727         bool set_pair(const String& key, bool car_data, double cdr_data, G::Error *error = 0);
00729 
00730         bool set_pair(const String& key, bool car_data, const String& cdr_data, G::Error *error = 0);
00732 
00733         bool set_pair(const String& key, bool car_data, const Schema& cdr_data, G::Error *error = 0);
00735 
00736         bool set_pair(const String& key, double car_data, int cdr_data, G::Error *error = 0);
00738 
00739         bool set_pair(const String& key, double car_data, bool cdr_data, G::Error *error = 0);
00741 
00742         bool set_pair(const String& key, double car_data, double cdr_data, G::Error *error = 0);
00744 
00745         bool set_pair(const String& key, double car_data, const String& cdr_data, G::Error *error = 0);
00747 
00748         bool set_pair(const String& key, double car_data, const Schema& cdr_data, G::Error *error = 0);
00750 
00751         bool set_pair(const String& key, const String& car_data, int cdr_data, G::Error *error = 0);
00753 
00754         bool set_pair(const String& key, const String& car_data, bool cdr_data, G::Error *error = 0);
00756 
00757         bool set_pair(const String& key, const String& car_data, double cdr_data, G::Error *error = 0);
00759 
00760         bool set_pair(const String& key, const String& car_data, const String& cdr_data, G::Error *error = 0);
00762 
00763         bool set_pair(const String& key, const String& car_data, const Schema& cdr_data, G::Error *error = 0);
00765 
00766         bool set_pair(const String& key, const Schema& car_data, int cdr_data, G::Error *error = 0);
00768 
00769         bool set_pair(const String& key, const Schema& car_data, bool cdr_data, G::Error *error = 0);
00771 
00772         bool set_pair(const String& key, const Schema& car_data, double cdr_data, G::Error *error = 0);
00774 
00775         bool set_pair(const String& key, const Schema& car_data, const String& cdr_data, G::Error *error = 0);
00777 
00778         bool set_pair(const String& key, const Schema& car_data, const Schema& cdr_data, G::Error *error = 0);
00780 
00781         void error(G::Error& error);
00784 
00785         void unreturned_error(G::Error& error);
00787 
00788         void value_changed(const String& key, Value& value);
00792 
00793         bool commit_change_set(ChangeSet& cs, bool remove_committed, G::Error *error = 0);
00807 
00808         Pointer<ChangeSet> reverse_change_set(ChangeSet& cs, G::Error *error = 0);
00816 
00817         Pointer<ChangeSet> change_set_from_current(const std::vector<String> keys, G::Error *error = 0);
00825 
00829 
00830         const ValueChangedSignalProxy sig_value_changed()
00831         {
00832                 return ValueChangedSignalProxy(this, &value_changed_signal);
00833         }
00836 
00837         const UnreturnedErrorSignalProxy sig_unreturned_error()
00838         {
00839                 return UnreturnedErrorSignalProxy(this, &unreturned_error_signal);
00840         }
00843 
00844         const ErrorSignalProxy sig_error()
00845         {
00846                 return ErrorSignalProxy(this, &error_signal);
00847         }
00849 
00851 };
00852 
00853 } // namespace GConf
00854 
00855 } // namespace Inti
00856 
00857 #endif // INTI_GCONF_CLIENT_H
00858 
Main Page - Footer


Generated on Sun Sep 14 23:52:40 2003 for Inti-GConf by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002