make a private copy of the icon obtained through gtk_icon_them_load_icon
[simple-launcher] / launcher-item.h
index 3b4065e..3d399c7 100644 (file)
@@ -33,16 +33,19 @@ public:
 
   bool load(const std::string&);
 
+  bool valid() const { return myIsGood; }
+
   GdkPixbuf *getIcon(int icon_size) const;
 
   const std::string& getFileName() const { return myFileName; }
-  const std::string& getName() const { return myName; }
-  const std::string& getComment() const { return myComment; }
+  std::string getName(bool translate = true) const { return translate ? translateString(myName) : myName; }
+  std::string getComment(bool translate = true) const { return translate ? translateString(myComment) : myComment; }
   const std::string& getService() const { return myService; }
+  const std::string& getExec() const { return myExec; }
 
   bool isEnabled(void) const { return myEnabled; }
 
-  void enable() { myEnabled = checkSanity(); }
+  void enable() { myEnabled = valid() && checkSanity(); }
   void disable() { myEnabled = false; }
   void toggle() {
     if (myEnabled) {
@@ -53,10 +56,14 @@ public:
   }
 
 private:
-  bool checkSanity(void) { return !(myName.empty() || myIcon.empty() || myService.empty()); }
+  std::string translateString(const std::string& what) const;
+
+  bool checkSanity(void) { return !myName.empty() && (!myService.empty() || !myExec.empty()); }
 
 private:
-  std::string myFileName, myName, myComment, myIcon, myService;
+  bool myIsGood;
+
+  std::string myFileName, myName, myComment, myIcon, myService, myExec, myTextDomain;
   bool myEnabled;
 
   static GtkIconTheme *ourTheme;