From 6f4f96f06e8f65f8a02fd920cd5b63375d786ce0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 14 Nov 2017 22:43:39 +0100 Subject: [PATCH] neutrino: add "need_reboot" feature Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f6253de913c8353d3ca58a7ecea8f3fbde954eac Author: vanhofen Date: 2017-11-14 (Tue, 14 Nov 2017) Origin message was: ------------------ - neutrino: add "need_reboot" feature --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/neutrino.cpp | 6 ++++++ src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/system/setting_helpers.cpp | 2 ++ 6 files changed, 12 insertions(+) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index de10ff850..ef9f8f15b 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1700,6 +1700,7 @@ messagebox.error Fehler messagebox.exit Beenden messagebox.feature_not_supported Funktion wird nicht unterstützt. Bitte wenden Sie sich an Ihren Firmware-Anbieter! messagebox.info Information +messagebox.need_reboot Die Box muss neu gestartet werden, um die Änderungen wirksam zu machen.\nSoll jetzt neu gestartet werden? messagebox.no Nein messagebox.ok OK messagebox.yes Ja diff --git a/data/locale/english.locale b/data/locale/english.locale index 632dea6ba..bcda00429 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1699,6 +1699,7 @@ messagebox.error Error messagebox.exit Exit messagebox.feature_not_supported Feature is not supported. Please contact your firmware provider! messagebox.info Information +messagebox.need_reboot The box must be restarted to make the changes effective.\nRestart now? messagebox.no No messagebox.ok Ok messagebox.yes Yes diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f875f0bbf..a11276833 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4661,6 +4661,12 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) else if(actionKey=="shutdown") { ExitRun(1); } + else if(actionKey=="need_reboot") + { + int reboot_now = ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MESSAGEBOX_NEED_REBOOT, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_SETTINGS); + if (reboot_now == CMsgBox::mbrYes) + CNeutrinoApp::getInstance()->exec(NULL, "reboot"); + } else if(actionKey=="reboot") { FILE *f = fopen("/tmp/.reboot", "w"); diff --git a/src/system/locals.h b/src/system/locals.h index 83b4535f4..543f1b35f 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1726,6 +1726,7 @@ typedef enum LOCALE_MESSAGEBOX_EXIT, LOCALE_MESSAGEBOX_FEATURE_NOT_SUPPORTED, LOCALE_MESSAGEBOX_INFO, + LOCALE_MESSAGEBOX_NEED_REBOOT, LOCALE_MESSAGEBOX_NO, LOCALE_MESSAGEBOX_OK, LOCALE_MESSAGEBOX_YES, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 86a6e14fb..b7049141f 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1726,6 +1726,7 @@ const char * locale_real_names[] = "messagebox.exit", "messagebox.feature_not_supported", "messagebox.info", + "messagebox.need_reboot", "messagebox.no", "messagebox.ok", "messagebox.yes", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index ed074d54c..b97b14b72 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -254,6 +254,8 @@ bool CFlagFileNotifier::changeNotify(const neutrino_locale_t, void * data) } remove(flagfile.c_str()); } + if (strstr(filename, "ciplushelper")) + CNeutrinoApp::getInstance()->exec(NULL, "need_reboot"); return menu_return::RETURN_REPAINT; }