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 00025 namespace Bakery 00026 { 00027 00028 namespace Conf 00029 { 00030 00033 class AssociationBase : public SigC::Object 00034 { 00035 public: 00036 typedef SigC::Ptr<AssociationBase> AssociationPtr; 00037 00038 void add(const Glib::RefPtr<Gnome::Conf::Client>& conf_client); 00039 void load(); 00040 void save(); 00041 00042 protected: 00043 AssociationBase(const Glib::ustring& full_key, bool instant); 00044 AssociationBase(const AssociationBase& other); // Not implemented 00045 virtual ~AssociationBase(); 00046 00047 bool is_instant() const; 00048 Glib::ustring get_key() const; 00049 Glib::RefPtr<const Gnome::Conf::Client> get_conf_client() const; 00050 Glib::RefPtr<Gnome::Conf::Client> get_conf_client(); 00051 00052 typedef SigC::Slot0<void> Callback; 00053 virtual void connect_widget(Callback on_widget_changed) = 0; 00054 virtual void load_widget() = 0; 00055 virtual void save_widget() = 0; 00056 00057 void on_widget_changed(); 00058 void on_conf_changed(guint cnxn_id, Gnome::Conf::Entry entry); 00059 00060 Glib::ustring m_key; 00061 bool m_instant; 00062 Glib::RefPtr<Gnome::Conf::Client> m_conf_client; 00063 }; 00064 00065 } //namespace Conf 00066 00067 } //namespace Bakery 00068 00069 #endif //BAKERY_CONFIGURATION_ASSOCIATIONBASE_H