00001 /* 00002 * Copyright 2002 The Bakery team 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_ASSOCIATIONBASE_H 00020 #define BAKERY_CONFIGURATION_ASSOCIATIONBASE_H 00021 00022 #include <gconfmm.h> 00023 #include <gtkmm/widget.h> 00024 #include <bakery/Utilities/sharedptr.h> 00025 00026 namespace Bakery 00027 { 00028 00029 namespace Conf 00030 { 00031 00034 class AssociationBase : public sigc::trackable 00035 { 00036 public: 00037 typedef sharedptr<AssociationBase> AssociationPtr; 00038 00039 void add(const Glib::RefPtr<Gnome::Conf::Client>& conf_client); 00040 void load(); 00041 void save(); 00042 00043 virtual ~AssociationBase(); 00044 00045 protected: 00046 AssociationBase(const Glib::ustring& full_key, bool instant); 00047 AssociationBase(const AssociationBase& other); // Not implemented 00048 00049 00050 bool is_instant() const; 00051 Glib::ustring get_key() const; 00052 Glib::RefPtr<const Gnome::Conf::Client> get_conf_client() const; 00053 Glib::RefPtr<Gnome::Conf::Client> get_conf_client(); 00054 00055 typedef sigc::slot<void> Callback; 00056 virtual void connect_widget(Callback on_widget_changed) = 0; 00057 virtual void load_widget() = 0; 00058 virtual void save_widget() = 0; 00059 00060 void on_widget_changed(); 00061 void on_conf_changed(guint cnxn_id, Gnome::Conf::Entry entry); 00062 00063 Glib::ustring m_key; 00064 bool m_instant; 00065 Glib::RefPtr<Gnome::Conf::Client> m_conf_client; 00066 }; 00067 00068 } //namespace Conf 00069 00070 } //namespace Bakery 00071 00072 #endif //BAKERY_CONFIGURATION_ASSOCIATIONBASE_H