mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 11:46:14 +02:00
Pass C++ string to LinkApp constructor
All callers already had C++ strings and LinkApp wants a C++ string, but because of the argument type the strings had to be converted.
This commit is contained in:
parent
79ef176831
commit
7992d83e10
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user