From e4d78bee60bee625f7d76f56555d378a797f74b3 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Thu, 20 Dec 2012 22:01:30 +0100 Subject: [PATCH] Made GMenu2X::menu private There was only one outside use; turned that into a new public method on the GMenu2X class. --- src/gmenu2x.cpp | 9 +++++++++ src/gmenu2x.h | 4 ++-- src/linkapp.cpp | 7 +------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index a5010fc..eb45999 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -539,6 +539,15 @@ void GMenu2X::readConfig(string conffile) { resY = constrain( confInt["resolutionY"], 240,1200 ); } +void GMenu2X::saveSelection() { + if (confInt["saveSelection"] && ( + confInt["section"] != menu->selSectionIndex() + || confInt["link"] != menu->selLinkIndex() + )) { + writeConfig(); + } +} + void GMenu2X::writeConfig() { string conffile = getHome() + "/gmenu2x.conf"; ofstream inf(conffile.c_str()); diff --git a/src/gmenu2x.h b/src/gmenu2x.h index 34efec4..f23c879 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -65,6 +65,7 @@ typedef std::tr1::unordered_map > class GMenu2X { private: Touchscreen ts; + Menu *menu; /*! Retrieves the free disk space on the sd @@ -170,6 +171,7 @@ public: void setInputSpeed(); + void saveSelection(); void writeConfig(); void writeSkinConfig(); void writeTmp(int selelem=-1, const std::string &selectordir=""); @@ -189,8 +191,6 @@ public: void drawTopBar(Surface *s=NULL); void drawBottomBar(Surface *s=NULL); - - Menu *menu; }; #endif // GMENU2X_H diff --git a/src/linkapp.cpp b/src/linkapp.cpp index c30818e..474dce1 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -632,12 +632,7 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) { if (dontleave) { system(command.c_str()); } else { - if (gmenu2x->confInt["saveSelection"] && ( - gmenu2x->confInt["section"]!=gmenu2x->menu->selSectionIndex() - || gmenu2x->confInt["link"]!=gmenu2x->menu->selLinkIndex() - )) { - gmenu2x->writeConfig(); - } + gmenu2x->saveSelection(); if (selectedFile == "") { gmenu2x->writeTmp();