got rid of an extra method -- valid -- make use of checkSanity instead
authormishas <mikhail.sobolev@gmail.com>
Tue, 17 Apr 2007 07:40:54 +0000 (07:40 +0000)
committermishas <mikhail.sobolev@gmail.com>
Tue, 17 Apr 2007 07:40:54 +0000 (07:40 +0000)
git-svn-id: file:///svnroot/simple-launcher/trunk@192 3ba93dab-e023-0410-b42a-de7732cf370a

launcher-item.cc
launcher-item.h
settings-page-items.cc

index 2b8c79f..42aa00b 100644 (file)
@@ -91,7 +91,7 @@ private:
   GKeyFile *myKeyFile;
 };
 
-LauncherItem::LauncherItem(): myIsGood(false), myEnabled(false) {
+LauncherItem::LauncherItem(): myEnabled(false) {
 }
 
 LauncherItem::~LauncherItem() {
@@ -108,8 +108,6 @@ std::string LauncherItem::translateString(const std::string& what) const {
 bool LauncherItem::load(const std::string& filename) {
   GKeyFileWrapper key_file;
 
-  myIsGood = false;
-
   for (;;) {
     myFileName = filename;
 
@@ -121,8 +119,6 @@ bool LauncherItem::load(const std::string& filename) {
       break;
     }
 
-    myIsGood = true;
-
     myName = key_file.getLocaleString(DESKTOP_ENTRY_GROUP, DESKTOP_ENTRY_NAME_FIELD);
     myComment = key_file.getLocaleString(DESKTOP_ENTRY_GROUP, DESKTOP_ENTRY_COMMENT_FIELD);
     myIcon = key_file.getString(DESKTOP_ENTRY_GROUP, DESKTOP_ENTRY_ICON_FIELD);
index 3d399c7..9aaff81 100644 (file)
@@ -33,8 +33,6 @@ public:
 
   bool load(const std::string&);
 
-  bool valid() const { return myIsGood; }
-
   GdkPixbuf *getIcon(int icon_size) const;
 
   const std::string& getFileName() const { return myFileName; }
@@ -45,7 +43,7 @@ public:
 
   bool isEnabled(void) const { return myEnabled; }
 
-  void enable() { myEnabled = valid() && checkSanity(); }
+  void enable() { myEnabled = checkSanity(); }
   void disable() { myEnabled = false; }
   void toggle() {
     if (myEnabled) {
@@ -55,14 +53,12 @@ public:
     }
   }
 
-private:
-  std::string translateString(const std::string& what) const;
-
   bool checkSanity(void) { return !myName.empty() && (!myService.empty() || !myExec.empty()); }
 
 private:
-  bool myIsGood;
+  std::string translateString(const std::string& what) const;
 
+private:
   std::string myFileName, myName, myComment, myIcon, myService, myExec, myTextDomain;
   bool myEnabled;
 
index 8640afa..28e0074 100644 (file)
@@ -106,7 +106,7 @@ SettingsPageWithItems::SettingsPageWithItems(int icon_size, LauncherItems& items
   for (LauncherItems::Names::const_iterator it = myItems.myNames.begin(); it != myItems.myNames.end(); ++it) {
     LauncherItem *item = myItems.myItems[*it];
 
-    if (item->valid()) {
+    if (item->checkSanity()) {
       GtkTreeIter iter;
 
       gtk_list_store_append(myStore, &iter);