update_settings: fix update autocheck on/off handling

Origin commit data
------------------
Branch: ni/coolstream
Commit: 30b47b60ed
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-01-12 (Fri, 12 Jan 2018)

Origin message was:
------------------
- update_settings: fix update autocheck on/off handling

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-01-12 11:31:55 +01:00
parent c08971b83b
commit f8735f6f35
3 changed files with 19 additions and 2 deletions

View File

@@ -79,6 +79,9 @@ void CFlashUpdateCheck::stopThread()
pthread_cancel(c4u_thread); pthread_cancel(c4u_thread);
} }
c4u_thread = 0; c4u_thread = 0;
if (access(C4U_FLAGFILE, F_OK) == 0)
unlink(C4U_FLAGFILE);
} }
void* CFlashUpdateCheck::c4u_proc(void*) void* CFlashUpdateCheck::c4u_proc(void*)

View File

@@ -38,6 +38,7 @@
#include <mymenu.h> #include <mymenu.h>
#include <neutrino_menue.h> #include <neutrino_menue.h>
#include <gui/filebrowser.h> #include <gui/filebrowser.h>
#include <gui/update_check.h>
#include <gui/update_ext.h> #include <gui/update_ext.h>
#include <gui/update_settings.h> #include <gui/update_settings.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
@@ -143,7 +144,7 @@ int CUpdateSettings::initMenu()
OnOffNotifier->addItem(apply_kernel); OnOffNotifier->addItem(apply_kernel);
#endif #endif
CMenuOptionChooser *autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, OnOffNotifier); CMenuOptionChooser *autocheck = new CMenuOptionChooser(LOCALE_FLASHUPDATE_AUTOCHECK, &g_settings.softupdate_autocheck, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this);
// apply_settings->setHint("", LOCALE_MENU_HINT_XXX); // apply_settings->setHint("", LOCALE_MENU_HINT_XXX);
w_upsettings.addItem(fw_update_dir); w_upsettings.addItem(fw_update_dir);
@@ -167,3 +168,15 @@ int CUpdateSettings::initMenu()
return res; return res;
} }
bool CUpdateSettings::changeNotify(const neutrino_locale_t OptionName, void * /* data */)
{
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_FLASHUPDATE_AUTOCHECK))
{
CFlashUpdateCheck::getInstance()->stopThread();
if (g_settings.softupdate_autocheck)
CFlashUpdateCheck::getInstance()->startThread();
}
return false;
}

View File

@@ -55,7 +55,7 @@ class CUrlConfigSetupNotifier : public CChangeObserver
bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL); bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL);
}; };
class CUpdateSettings : public CMenuTarget class CUpdateSettings : public CMenuTarget, CChangeObserver
{ {
private: private:
int width; int width;
@@ -69,6 +69,7 @@ class CUpdateSettings : public CMenuTarget
CUpdateSettings(); CUpdateSettings();
~CUpdateSettings(); ~CUpdateSettings();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
bool changeNotify(const neutrino_locale_t = NONEXISTANT_LOCALE, void *data = NULL);
}; };
#endif #endif