1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-02 18:05:26 +03:00

Converted public fields of LinkApp to private.

Although exposing a read/write reference to a private field is not much better than having a public field.
Well, at least we are explicit about the nasty stuff now.
This commit is contained in:
Maarten ter Huurne 2010-07-27 21:26:02 +02:00
parent 8a9aac028b
commit 0cd6b8264c
4 changed files with 19 additions and 11 deletions

View File

@ -1404,7 +1404,7 @@ void GMenu2X::editLink() {
if (menu->selLinkApp()==NULL) return;
vector<string> pathV;
split(pathV,menu->selLinkApp()->file,"/");
split(pathV,menu->selLinkApp()->getFile(),"/");
string oldSection = "";
if (pathV.size()>1)
oldSection = pathV[pathV.size()-2];
@ -1447,8 +1447,8 @@ void GMenu2X::editLink() {
sd.addSetting(new MenuSettingDir(this,tr["Selector Screenshots"],tr["Directory of the screenshots for the selector"],&linkSelScreens));
sd.addSetting(new MenuSettingFile(this,tr["Selector Aliases"],tr["File containing a list of aliases for the selector"],&linkSelAliases));
//G
sd.addSetting(new MenuSettingBool(this,tr["Wrapper"],tr["Explicitly relaunch GMenu2X after this link's execution ends"],&menu->selLinkApp()->wrapper));
sd.addSetting(new MenuSettingBool(this,tr["Don't Leave"],tr["Don't quit GMenu2X when launching this link"],&menu->selLinkApp()->dontleave));
sd.addSetting(new MenuSettingBool(this,tr["Wrapper"],tr["Explicitly relaunch GMenu2X after this link's execution ends"],&menu->selLinkApp()->needsWrapperRef()));
sd.addSetting(new MenuSettingBool(this,tr["Don't Leave"],tr["Don't quit GMenu2X when launching this link"],&menu->selLinkApp()->runsInBackgroundRef()));
if (sd.exec() && sd.edited()) {
ledOn();
@ -1484,8 +1484,8 @@ void GMenu2X::editLink() {
newFileName = "sections/"+newSection+"/"+linkTitle+id;
x++;
}
rename(menu->selLinkApp()->file.c_str(),newFileName.c_str());
menu->selLinkApp()->file = newFileName;
rename(menu->selLinkApp()->getFile().c_str(),newFileName.c_str());
menu->selLinkApp()->renameFile(newFileName);
#ifdef DEBUG
cout << "New section index: " << newSectionIndex - menu->getSections().begin() << endl;
#endif

View File

@ -575,3 +575,7 @@ void LinkApp::setAliasFile(const string &aliasfile) {
edited = true;
}
}
void LinkApp::renameFile(const string &name) {
file = name;
}

View File

@ -49,6 +49,10 @@ private:
void drawRun();
string aliasfile;
string file;
bool wrapper;
bool dontleave;
public:
LinkApp(GMenu2X *gmenu2x, const char* linkfile);
@ -75,8 +79,6 @@ public:
const string &getAliasFile();
void setAliasFile(const string &aliasfile);
string file;
int clock();
const string &clockStr(int maxClock);
void setClock(int mhz);
@ -95,15 +97,17 @@ public:
void setBacklight(int val);
// /G
bool wrapper;
bool dontleave;
bool save();
void run();
void showManual();
void selector(int startSelection=0, const string &selectorDir="");
void launch(const string &selectedFile="", const string &selectedDir="");
bool targetExists();
const string &getFile() { return file; }
void renameFile(const string &name);
bool &needsWrapperRef() { return wrapper; }
bool &runsInBackgroundRef() { return dontleave; }
};
#endif

View File

@ -299,7 +299,7 @@ void Menu::deleteSelectedLink() {
cout << "\033[0;34mGMENU2X:\033[0m Deleting link " << selLink()->getTitle() << endl;
#endif
if (selLinkApp()!=NULL)
unlink(selLinkApp()->file.c_str());
unlink(selLinkApp()->getFile().c_str());
gmenu2x->sc.del(selLink()->getIconPath());
sectionLinks()->erase( sectionLinks()->begin() + selLinkIndex() );
setLinkIndex(selLinkIndex());