changed the way how option kind is stored/obtained
authormishas <mikhail.sobolev@gmail.com>
Thu, 12 Apr 2007 11:09:37 +0000 (11:09 +0000)
committermishas <mikhail.sobolev@gmail.com>
Thu, 12 Apr 2007 11:09:37 +0000 (11:09 +0000)
git-svn-id: file:///svnroot/simple-launcher/trunk@175 3ba93dab-e023-0410-b42a-de7732cf370a

gconf-wrapper.cc
gconf-wrapper.h

index 233563a..8ad3dda 100644 (file)
@@ -95,7 +95,7 @@ void GConfOption::unsetGConfValue() {
 }
 
 GConfStringOption::GConfStringOption(const GConfKey& key, const std::string& name, const std::string& defaultValue):
-  GConfOption(GCONF_VALUE_STRING, key, name),
+  GConfOption(key, name),
   myDefaultValue(defaultValue) {
 }
 
@@ -140,7 +140,7 @@ const std::string& GConfStringOption::setValue(const std::string& newValue) {
 }
 
 GConfBooleanOption::GConfBooleanOption(const GConfKey& key, const std::string& name, bool defaultValue):
-  GConfOption(GCONF_VALUE_BOOL, key, name),
+  GConfOption(key, name),
   myDefaultValue(defaultValue) {
 }
 
@@ -185,7 +185,7 @@ bool GConfBooleanOption::setValue(bool newValue) {
 }
 
 GConfIntegerOption::GConfIntegerOption(const GConfKey& key, const std::string& name, int defaultValue):
-  GConfOption(GCONF_VALUE_INT, key, name),
+  GConfOption(key, name),
   myDefaultValue(defaultValue) {
 }
 
index 82c62be..be94905 100644 (file)
@@ -52,16 +52,15 @@ private:
 
 class GConfOption : public GConfItem {
 protected:
-  GConfOption(GConfValueType kind, const GConfKey& key, const std::string& path): myKind(kind), myIsSynchronized(false), myPath(key.merge(path)) { }
+  GConfOption(const GConfKey& key, const std::string& path): myIsSynchronized(false), myPath(key.merge(path)) { }
 
-  GConfValueType kind() const { return myKind; }
+  virtual GConfValueType kind() const = 0;
 
   void setGConfValue(const GConfValue *);
   GConfValue *getGConfValue() const;
   void unsetGConfValue();
 
 protected:
-  const GConfValueType myKind;
   mutable bool myIsSynchronized;
   const std::string myPath;
 };
@@ -70,6 +69,8 @@ class GConfStringOption : public GConfOption {
 public:
   GConfStringOption(const GConfKey&, const std::string&, const std::string&);
 
+  virtual GConfValueType kind() const { return GCONF_VALUE_STRING; }
+
   const std::string& value() const;
   const std::string& setValue(const std::string& newValue);
 
@@ -82,6 +83,8 @@ class GConfBooleanOption : public GConfOption {
 public:
   GConfBooleanOption(const GConfKey&, const std::string&, bool);
 
+  virtual GConfValueType kind() const { return GCONF_VALUE_BOOL; }
+
   bool value() const;
   bool setValue(bool newValue);
 
@@ -94,6 +97,8 @@ class GConfIntegerOption : public GConfOption {
 public:
   GConfIntegerOption(const GConfKey&, const std::string&, int);
 
+  virtual GConfValueType kind() const { return GCONF_VALUE_INT; }
+
   int value() const;
   int setValue(int newValue);