X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=gconf-wrapper.h;h=be949059e0cc5fbeee5b3c067fee2b6e5ff619b7;hb=refs%2Fheads%2Fsvn%2Ftags%2F0.9.5;hp=68f192ac212fffee9981751fbd6ab352b3200f2b;hpb=61531564db56aba46ec4225bf0eb5edd43ea2c11;p=simple-launcher diff --git a/gconf-wrapper.h b/gconf-wrapper.h index 68f192a..be94905 100644 --- a/gconf-wrapper.h +++ b/gconf-wrapper.h @@ -32,6 +32,7 @@ protected: static void allocateClient(); protected: + // TODO: should I count the references and unref the client when the last user is gone?? static GConfClient *ourClient; }; @@ -43,62 +44,67 @@ public: const std::string& path() const { return myKeyPath; } - static std::string mergePath(const std::string&, const std::string); + std::string merge(const std::string&) const; private: - std::string myKeyPath; + const std::string myKeyPath; }; class GConfOption : public GConfItem { protected: - GConfOption(const GConfKey& key, const std::string& path): myIsSynchronized(false), myPath(GConfKey::mergePath(key.path(), path)) { } + GConfOption(const GConfKey& key, const std::string& path): myIsSynchronized(false), myPath(key.merge(path)) { } + + virtual GConfValueType kind() const = 0; void setGConfValue(const GConfValue *); - GConfValue *getGConfValue(GConfValueType) const; + GConfValue *getGConfValue() const; void unsetGConfValue(); protected: mutable bool myIsSynchronized; - std::string myPath; + const std::string myPath; }; -class GConfStringValue : public GConfOption { +class GConfStringOption : public GConfOption { public: - GConfStringValue(const GConfKey&, const std::string&, const std::string& = ""); - ~GConfStringValue(); + 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); private: mutable std::string myValue; - std::string myDefaultValue; + const std::string myDefaultValue; }; -class GConfBooleanValue : public GConfOption { +class GConfBooleanOption : public GConfOption { public: - GConfBooleanValue(const GConfKey&, const std::string&, bool = false); - ~GConfBooleanValue(); + GConfBooleanOption(const GConfKey&, const std::string&, bool); + + virtual GConfValueType kind() const { return GCONF_VALUE_BOOL; } bool value() const; bool setValue(bool newValue); private: mutable bool myValue; - bool myDefaultValue; + const bool myDefaultValue; }; -class GConfIntegerValue : public GConfOption { +class GConfIntegerOption : public GConfOption { public: - GConfIntegerValue(const GConfKey&, const std::string&, int = false); - ~GConfIntegerValue(); + GConfIntegerOption(const GConfKey&, const std::string&, int); + + virtual GConfValueType kind() const { return GCONF_VALUE_INT; } int value() const; int setValue(int newValue); private: mutable int myValue; - int myDefaultValue; + const int myDefaultValue; }; #endif