From: mishas Date: Thu, 12 Apr 2007 11:09:37 +0000 (+0000) Subject: changed the way how option kind is stored/obtained X-Git-Url: http://git.maemo.org/git/?p=simple-launcher;a=commitdiff_plain;h=500e3fe9c96303716c7ae8d9a909a1df6749535b changed the way how option kind is stored/obtained git-svn-id: file:///svnroot/simple-launcher/trunk@175 3ba93dab-e023-0410-b42a-de7732cf370a --- diff --git a/gconf-wrapper.cc b/gconf-wrapper.cc index 233563a..8ad3dda 100644 --- a/gconf-wrapper.cc +++ b/gconf-wrapper.cc @@ -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) { } diff --git a/gconf-wrapper.h b/gconf-wrapper.h index 82c62be..be94905 100644 --- a/gconf-wrapper.h +++ b/gconf-wrapper.h @@ -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);