1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 22:37:30 +02:00

Reduce use of HAVE_LIBOPK inside LinkApp class as well

In commit de30b3f9 several outside uses were removed by always defining
isOpk(), this commit does the same for LinkApp itself.
This commit is contained in:
Maarten ter Huurne 2013-08-14 09:25:06 +02:00
parent 9c497e7867
commit ea85b10d31

View File

@ -219,10 +219,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
setSelectorScreens( value ); setSelectorScreens( value );
} else if (name == "selectoraliases") { } else if (name == "selectoraliases") {
setAliasFile( value ); setAliasFile( value );
} else } else if (!isOpk()) {
#ifdef HAVE_LIBOPK
if (!isOPK) {
#endif
if (name == "title") { if (name == "title") {
title = value; title = value;
} else if (name == "description") { } else if (name == "description") {
@ -244,10 +241,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
} else if (name == "editable") { } else if (name == "editable") {
if (value == "false") if (value == "false")
editable = false; editable = false;
#ifdef HAVE_LIBOPK
} else } else
WARNING("Unrecognized option: '%s'\n", name.c_str()); WARNING("Unrecognized option: '%s'\n", name.c_str());
#endif
} else } else
WARNING("Unrecognized option: '%s'\n", name.c_str()); WARNING("Unrecognized option: '%s'\n", name.c_str());
} }
@ -324,9 +319,7 @@ bool LinkApp::save() {
ofstream f(file.c_str()); ofstream f(file.c_str());
if (f.is_open()) { if (f.is_open()) {
#ifdef HAVE_LIBOPK if (!isOpk()) {
if (!isOPK) {
#endif
if (title!="" ) f << "title=" << title << endl; if (title!="" ) f << "title=" << title << endl;
if (description!="" ) f << "description=" << description << endl; if (description!="" ) f << "description=" << description << endl;
if (icon!="" ) f << "icon=" << icon << endl; if (icon!="" ) f << "icon=" << icon << endl;
@ -337,9 +330,7 @@ bool LinkApp::save() {
if (consoleApp ) f << "consoleapp=true" << endl; if (consoleApp ) f << "consoleapp=true" << endl;
#endif #endif
if (selectorfilter!="*" ) f << "selectorfilter=" << selectorfilter << endl; if (selectorfilter!="*" ) f << "selectorfilter=" << selectorfilter << endl;
#ifdef HAVE_LIBOPK
} }
#endif
if (iclock!=0 ) f << "clock=" << iclock << endl; if (iclock!=0 ) f << "clock=" << iclock << endl;
if (selectordir!="" ) f << "selectordir=" << selectordir << endl; if (selectordir!="" ) f << "selectordir=" << selectordir << endl;
if (!selectorbrowser ) f << "selectorbrowser=false" << endl; if (!selectorbrowser ) f << "selectorbrowser=false" << endl;
@ -566,8 +557,8 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
selectordir = selectedDir; selectordir = selectedDir;
save(); save();
if (isOpk()) {
#ifdef HAVE_LIBOPK #ifdef HAVE_LIBOPK
if (isOPK) {
int err; int err;
/* To be sure... */ /* To be sure... */
@ -589,21 +580,17 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) {
if (fileExists(tmp)) if (fileExists(tmp))
exec = opkMount + exec; exec = opkMount + exec;
} }
}
else {
#endif #endif
//Set correct working directory } else {
string::size_type pos = exec.rfind("/"); //Set correct working directory
if (pos != string::npos) { string::size_type pos = exec.rfind("/");
string wd = exec.substr(0, pos + 1); if (pos != string::npos) {
chdir(wd.c_str()); string wd = exec.substr(0, pos + 1);
exec = wd + exec.substr(pos + 1); chdir(wd.c_str());
DEBUG("Changed working directory to %s\n", wd.c_str()); exec = wd + exec.substr(pos + 1);
DEBUG("Changed working directory to %s\n", wd.c_str());
}
} }
#ifdef HAVE_LIBOPK
}
#endif
if (selectedFile != "") { if (selectedFile != "") {
string path = cmdclean(selectordir + selectedFile); string path = cmdclean(selectordir + selectedFile);