* added myIconSize variable for SimpleLauncherApplet (will be configurable in future)
[simple-launcher] / gconf-wrapper.h
index 6cc0a4c..7d622e5 100644 (file)
 
 #include <string>
 
-class GConfWrapper {
+#include <gconf/gconf-client.h>
+
+class GConfClientWrapper {
+  friend class GConfKey;
+
 public:
-  GConfWrapper(const std::string&);
- ~GConfWrapper();
+  GConfClientWrapper();
+ ~GConfClientWrapper();
+
+  GConfKey getKey(const std::string&);
 
+protected:
   bool getBool(const std::string& name);
   void setBool(const std::string& name, bool);
 
   int getInt(const std::string& name);
   void setInt(const std::string& name, int);
+
+private:
+  GConfClient *myClient;
+};
+
+class GConfKey {
+public:
+  GConfKey(GConfClientWrapper&, const std::string&);
+  GConfKey(const GConfKey& what) : myWrapper(what.myWrapper), myPath(what.myPath) { }
+ ~GConfKey();
+
+  GConfKey& operator = (const GConfKey& what) {
+    myWrapper = what.myWrapper;
+    myPath = what.myPath;
+
+    return *this;
+  }
+
+  bool getBool(const std::string& name, bool defvalue = false);
+  void setBool(const std::string& name, bool value);
+
+  int getInt(const std::string& name, int defvalue = 0);
+  void setInt(const std::string& name, int value);
+
+private:
+  GConfClientWrapper& myWrapper;
+  std::string myPath;
 };
 
 #endif