- Main Page
- Namespaces
- Classes
- Files

# Client.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2002 Murray Cumming
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library 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 GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the Free
    00016  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017  */
    00018
    00019 #ifndef BAKERY_CONFIGURATION_CONFCLIENT_H
    00020 #define BAKERY_CONFIGURATION_CONFCLIENT_H
    00021
    00022 #include "bakery/Configuration/Association.h"
    00023
    00024 namespace Bakery
    00025 {
    00026
    00027 namespace Conf
    00028 {
    00029
    00050 class Client : public sigc::trackable
    00051 {
    00052 public:
    00053   Client(const Glib::ustring& configuration_directory);
    00054   virtual ~Client();
    00055
    00056 #ifdef GLIBMM_EXCEPTIONS_ENABLED
    00057   virtual void load();
    00058   virtual void save();
    00059 #else
    00060   virtual void load(std::auto_ptr<Glib::Error>& error);
    00061   virtual void save(std::auto_ptr<Glib::Error>& error);
    00062 #endif
    00063
    00065   virtual void add(const Glib::ustring& key, Gtk::Widget& widget);
    00066   virtual void add_instant(const Glib::ustring& key, Gtk::Widget& widget);
    00067
    00068 protected:
    00069
    00075   virtual void add_implementation(const Glib::ustring& key, Gtk::Widget& widget, bool instant);
    00076
    00077   typedef Bakery::Conf::AssociationBase::AssociationPtr AssociationPtr;
    00078
    00079 public:
    00080
    00081 protected:
    00082   template< class T_Widget >
    00083   void add_association(const Glib::ustring& key, T_Widget& widget, bool instant)
    00084   {
    00085     Glib::ustring full_key = m_directory + "/" + key;
    00086     AssociationPtr assoc = Association<T_Widget>::create(full_key, widget, instant);
    00087     m_vecWidgets.push_back(assoc);
    00088     assoc->add(m_refClient);
    00089   }
    00090
    00091 private:
    00092   Glib::RefPtr<Gnome::Conf::Client> m_refClient;
    00093   Glib::ustring m_directory;
    00094
    00095   typedef std::vector<AssociationPtr> type_vecWidgets;
    00096   type_vecWidgets m_vecWidgets;
    00097 };
    00098
    00099 } //namespace Conf
    00100
    00101 } //namespace Bakery
    00102
    00103
    00104 #endif //BAKERY_CONFIGURATION_CONFCLIENT_H