Main Page | 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 /*
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   virtual void load();
00057   virtual void save();
00058 
00060   virtual void add(const Glib::ustring& key, Gtk::Widget& widget);
00061   virtual void add_instant(const Glib::ustring& key, Gtk::Widget& widget);
00062 
00063 protected:
00064 
00070   virtual void add_implementation(const Glib::ustring& key, Gtk::Widget& widget, bool instant);
00071 
00072   typedef Bakery::Conf::AssociationBase::AssociationPtr AssociationPtr;
00073 
00074 public:
00075 
00076 protected:
00077   template< class T_Widget >
00078   void add_association(const Glib::ustring& key, T_Widget& widget, bool instant)
00079   {
00080     Glib::ustring full_key = m_directory + "/" + key;
00081     AssociationPtr assoc = Association<T_Widget>::create(full_key, widget, instant);
00082     m_vecWidgets.push_back(assoc);
00083     assoc->add(m_refClient);
00084   }
00085 
00086 private:
00087   Glib::RefPtr<Gnome::Conf::Client> m_refClient;
00088   Glib::ustring m_directory;
00089 
00090   typedef std::vector<AssociationPtr> type_vecWidgets;
00091   type_vecWidgets m_vecWidgets;
00092 };
00093 
00094 } //namespace Conf
00095 
00096 } //namespace Bakery
00097 
00098 
00099 #endif //BAKERY_CONFIGURATION_CONFCLIENT_H

Generated on Tue Jan 4 19:00:07 2005 for bakery by  doxygen 1.3.9.1