diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 5110225..f231ee7 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -81,10 +81,10 @@ private: #ifdef HAVE_LIBOPK -LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, bool deletable, +LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable, struct OPK *opk, const char *metadata_) #else -LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, bool deletable) +LinkApp::LinkApp(GMenu2X *gmenu2x_, string const& linkfile, bool deletable) #endif : Link(gmenu2x_, bind(&LinkApp::start, this)) , deletable(deletable) @@ -161,8 +161,9 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile, bool deletable) /* Read the icon from the OPK only * if it doesn't exist on the skin */ this->icon = gmenu2x->sc.getSkinFilePath("icons/" + (string) buf + ".png"); - if (this->icon.empty()) - this->icon = (string) linkfile + '#' + buf + ".png"; + if (this->icon.empty()) { + this->icon = linkfile + '#' + buf + ".png"; + } iconPath = this->icon; updateSurfaces(); diff --git a/src/linkapp.h b/src/linkapp.h index 51a27e4..b1e8de7 100644 --- a/src/linkapp.h +++ b/src/linkapp.h @@ -61,10 +61,10 @@ public: bool isOpk() { return isOPK; } const std::string &getOpkFile() { return opkFile; } - LinkApp(GMenu2X *gmenu2x, const char* linkfile, bool deletable, + LinkApp(GMenu2X *gmenu2x, std::string const& linkfile, bool deletable, struct OPK *opk = NULL, const char *metadata = NULL); #else - LinkApp(GMenu2X *gmenu2x, const char* linkfile, bool deletable); + LinkApp(GMenu2X *gmenu2x, std::string const& linkfile, bool deletable); bool isOpk() { return false; } #endif diff --git a/src/menu.cpp b/src/menu.cpp index 1a10d26..e708d49 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -495,7 +495,7 @@ bool Menu::addLink(string path, string file, string section) { INFO("Section: '%s(%i)'\n", sections[isection].c_str(), isection); - LinkApp* link = new LinkApp(gmenu2x, linkpath.c_str(), true); + LinkApp* link = new LinkApp(gmenu2x, linkpath, true); link->setSize(gmenu2x->skinConfInt["linkWidth"],gmenu2x->skinConfInt["linkHeight"]); links[isection].push_back( link ); } @@ -701,7 +701,7 @@ void Menu::openPackage(std::string path, bool order) // Note: OPK links can only be deleted by removing the OPK itself, // but that is not something we want to do in the menu, // so consider this link undeletable. - link = new LinkApp(gmenu2x, path.c_str(), false, opk, name); + link = new LinkApp(gmenu2x, path, false, opk, name); link->setSize(gmenu2x->skinConfInt["linkWidth"], gmenu2x->skinConfInt["linkHeight"]); addSection(link->getCategory()); @@ -851,7 +851,7 @@ void Menu::readLinks() { // Check whether the link file could be deleted. bool deletable = access(parentDir(linkfile).c_str(), W_OK) == 0; - LinkApp *link = new LinkApp(gmenu2x, linkfile.c_str(), deletable); + LinkApp *link = new LinkApp(gmenu2x, linkfile, deletable); link->setSize(gmenu2x->skinConfInt["linkWidth"], gmenu2x->skinConfInt["linkHeight"]); if (link->targetExists()) links[i].push_back(link);