X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=launcher-item.h;h=ec53bb915fd81ef89c073eb99c4eb263a3bc319f;hb=952b600ae0e448cf78aa712137a7175202fe8056;hp=e55ea3598d86e7f535067956748b0248784ba222;hpb=6950b9b0ec533750c31a74dc1f1c6ecbb45567cc;p=simple-launcher diff --git a/launcher-item.h b/launcher-item.h index e55ea35..ec53bb9 100644 --- a/launcher-item.h +++ b/launcher-item.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -35,8 +36,8 @@ public: 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; } bool isEnabled(void) const { return myEnabled; } @@ -52,16 +53,18 @@ public: } private: + std::string translateString(const std::string& what) const; + bool checkSanity(void) { return !(myName.empty() || myIcon.empty() || myService.empty()); } private: - std::string myFileName, myName, myComment, myIcon, myService; + std::string myFileName, myName, myComment, myIcon, myService, myTextDomain; bool myEnabled; static GtkIconTheme *ourTheme; }; -typedef struct { +typedef struct LauncherItems { typedef std::vector Names; typedef std::map Items; @@ -69,7 +72,7 @@ typedef struct { Items myItems; bool exists(const std::string& name) { - return myNames.find(name) != myNames.end(); + return std::find(myNames.begin(), myNames.end(), name) != myNames.end(); } size_t size() { return myNames.size(); } @@ -102,7 +105,14 @@ typedef struct { myNames.resize(0); myItems.clear(); } -} LauncherItems; + + LauncherItems& operator=(const LauncherItems& that) { + myNames = that.myNames; + myItems = that.myItems; + + return *this; + } +}; #endif