From 015a928b8897265e5c98046e20b8d561a2f0034d Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Tue, 21 Oct 2014 18:46:17 +0200 Subject: [PATCH] Notifications: use a single settings file. There were 3 setting files, each an archived BMessage. Now there is only one with all the data inside. * Rework the SettingsPane class to save and load settings from a message, rather than having each panel pick a file path on its own * Move saving the app filters to the preference app, rather than the server (so it's done at the same place as other settings) * Rework loading prefs in the server so the settings message is read from the file once and all settings are loaded from it. This turns out to be more changes than I anticipated. Fixes #9424. --- headers/private/notification/Notifications.h | 5 +- src/preferences/notifications/DisplayView.cpp | 46 +----- src/preferences/notifications/DisplayView.h | 4 +- src/preferences/notifications/GeneralView.cpp | 58 +------ src/preferences/notifications/GeneralView.h | 4 +- .../notifications/NotificationsView.cpp | 51 ++---- .../notifications/NotificationsView.h | 10 +- src/preferences/notifications/PrefletView.cpp | 2 +- src/preferences/notifications/PrefletWin.cpp | 66 +++++++- src/preferences/notifications/PrefletWin.h | 1 + .../notifications/SettingsPane.cpp | 4 - src/preferences/notifications/SettingsPane.h | 4 +- .../notification/NotificationWindow.cpp | 153 ++++-------------- src/servers/notification/NotificationWindow.h | 7 +- src/servers/notification/Notifications.cpp | 5 +- 15 files changed, 142 insertions(+), 278 deletions(-) diff --git a/headers/private/notification/Notifications.h b/headers/private/notification/Notifications.h index 99a5dc43ab..9d19204af9 100644 --- a/headers/private/notification/Notifications.h +++ b/headers/private/notification/Notifications.h @@ -13,10 +13,7 @@ const uint32 kNotificationMessage = 'nssm'; // Settings constants -extern const char* kSettingsDirectory; -extern const char* kFiltersSettings; -extern const char* kGeneralSettings; -extern const char* kDisplaySettings; +extern const char* kSettingsFile; // General settings extern const char* kAutoStartName; diff --git a/src/preferences/notifications/DisplayView.cpp b/src/preferences/notifications/DisplayView.cpp index 85e4a8589e..98bde3c499 100644 --- a/src/preferences/notifications/DisplayView.cpp +++ b/src/preferences/notifications/DisplayView.cpp @@ -52,9 +52,6 @@ DisplayView::DisplayView(SettingsHost* host) fIconSize->SetLabelFromMarked(true); fIconSizeField = new BMenuField(B_TRANSLATE("Icon size:"), fIconSize); - // Load settings - Load(); - // Calculate inset float inset = ceilf(be_plain_font->Size() * 0.7f); @@ -92,30 +89,20 @@ DisplayView::MessageReceived(BMessage* msg) status_t -DisplayView::Load() +DisplayView::Load(BMessage& settings) { +#if 0 BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) return B_ERROR; - path.Append(kSettingsDirectory); - - if (create_directory(path.Path(), 0755) != B_OK) { - BAlert* alert = new BAlert("", - B_TRANSLATE("There was a problem saving the preferences.\n" - "It's possible you don't have write access to the " - "settings directory."), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - (void)alert->Go(); - } - - path.Append(kDisplaySettings); + path.Append(kSettingsFile); BFile file(path.Path(), B_READ_ONLY); BMessage settings; settings.Unflatten(&file); +#endif char buffer[255]; int32 setting; @@ -144,18 +131,8 @@ DisplayView::Load() status_t -DisplayView::Save() +DisplayView::Save(BMessage& settings) { - BPath path; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) - return B_ERROR; - - path.Append(kSettingsDirectory); - path.Append(kDisplaySettings); - - BMessage settings; - float width = atof(fWindowWidth->Text()); settings.AddFloat(kWidthName, width); @@ -169,19 +146,6 @@ DisplayView::Save() } settings.AddInt32(kIconSizeName, (int32)iconSize); - // Save settings file - BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); - status_t ret = settings.Flatten(&file); - if (ret != B_OK) { - BAlert* alert = new BAlert("", - B_TRANSLATE("Can't save preferenes, you probably don't have " - "write access to the settings directory or the disk is full."), - B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - (void)alert->Go(); - return ret; - } - return B_OK; } diff --git a/src/preferences/notifications/DisplayView.h b/src/preferences/notifications/DisplayView.h index 8c0ebe142f..c651865c82 100644 --- a/src/preferences/notifications/DisplayView.h +++ b/src/preferences/notifications/DisplayView.h @@ -20,8 +20,8 @@ public: virtual void MessageReceived(BMessage* msg); // SettingsPane hooks - status_t Load(); - status_t Save(); + status_t Load(BMessage&); + status_t Save(BMessage&); status_t Revert(); private: diff --git a/src/preferences/notifications/GeneralView.cpp b/src/preferences/notifications/GeneralView.cpp index 7d597570bf..d570afc10c 100644 --- a/src/preferences/notifications/GeneralView.cpp +++ b/src/preferences/notifications/GeneralView.cpp @@ -65,9 +65,6 @@ GeneralView::GeneralView(SettingsHost* host) // TODO: Here will come a screen representation with the four corners // clickable - // Load settings - Load(); - // Calculate inset float inset = ceilf(be_plain_font->Size() * 0.7f); @@ -180,31 +177,8 @@ GeneralView::MessageReceived(BMessage* msg) status_t -GeneralView::Load() +GeneralView::Load(BMessage& settings) { - BPath path; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) - return B_ERROR; - - path.Append(kSettingsDirectory); - - if (create_directory(path.Path(), 0755) != B_OK) { - BAlert* alert = new BAlert("", - B_TRANSLATE("There was a problem saving the preferences.\n" - "It's possible you don't have write access to the " - "settings directory."), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - (void)alert->Go(); - } - - path.Append(kGeneralSettings); - - BMessage settings; - BFile file(path.Path(), B_READ_ONLY); - settings.Unflatten(&file); - char buffer[255]; fNotificationBox->SetValue(_IsServerRunning() ? B_CONTROL_ON : B_CONTROL_OFF); @@ -225,39 +199,14 @@ GeneralView::Load() status_t -GeneralView::Save() +GeneralView::Save(BMessage& settings) { - BPath path; - - status_t ret = B_OK; - ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (ret != B_OK) - return ret; - - path.Append(kSettingsDirectory); - path.Append(kGeneralSettings); - - BMessage settings; - bool autoStart = (fAutoStart->Value() == B_CONTROL_ON); settings.AddBool(kAutoStartName, autoStart); int32 timeout = atol(fTimeout->Text()); settings.AddInt32(kTimeoutName, timeout); - // Save settings file - BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); - ret = settings.Flatten(&file); - if (ret != B_OK) { - BAlert* alert = new BAlert("", - B_TRANSLATE("An error occurred saving the preferences.\n" - "It's possible you are running out of disk space."), - B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - (void)alert->Go(); - return ret; - } - // Find server path entry_ref ref; if (!_CanFindServer(&ref)) { @@ -273,7 +222,8 @@ GeneralView::Save() BPath serverPath(&ref); // Start server at boot time - ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path, true); + BPath path; + status_t ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path, true); if (ret != B_OK) { BAlert* alert = new BAlert("", B_TRANSLATE("Can't save preferences, you probably don't have " diff --git a/src/preferences/notifications/GeneralView.h b/src/preferences/notifications/GeneralView.h index 0464d1cf18..909fbd802e 100644 --- a/src/preferences/notifications/GeneralView.h +++ b/src/preferences/notifications/GeneralView.h @@ -20,8 +20,8 @@ public: virtual void MessageReceived(BMessage* msg); // SettingsPane hooks - status_t Load(); - status_t Save(); + status_t Load(BMessage&); + status_t Save(BMessage&); status_t Revert(); private: diff --git a/src/preferences/notifications/NotificationsView.cpp b/src/preferences/notifications/NotificationsView.cpp index ea1a1b0b62..fcb02dc58b 100644 --- a/src/preferences/notifications/NotificationsView.cpp +++ b/src/preferences/notifications/NotificationsView.cpp @@ -47,12 +47,10 @@ const int32 kDateIndex = 1; const int32 kTypeIndex = 2; const int32 kAllowIndex = 3; -const int32 kSettingChanged = '_STC'; - -NotificationsView::NotificationsView() +NotificationsView::NotificationsView(SettingsHost* host) : - BView("apps", B_WILL_DRAW) + SettingsPane("apps", host) { BRect rect(0, 0, 100, 100); @@ -100,10 +98,6 @@ NotificationsView::NotificationsView() (kCLVTitlePadding * 2), rect.Width(), B_TRUNCATE_END, B_ALIGN_LEFT); fNotifications->AddColumn(fAllowCol, kAllowIndex); - // Load the applications list - _LoadAppUsage(); - _PopulateApplications(); - // Calculate inset float inset = ceilf(be_plain_font->Size() * 0.7f); @@ -169,33 +163,8 @@ NotificationsView::MessageReceived(BMessage* msg) status_t -NotificationsView::_LoadAppUsage() +NotificationsView::Load(BMessage& settings) { - BPath path; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) - return B_ERROR; - - path.Append(kSettingsDirectory); - - if (create_directory(path.Path(), 0755) != B_OK) { - BAlert* alert = new BAlert("", - B_TRANSLATE("There was a problem saving the preferences.\n" - "It's possible you don't have write access to the " - "settings directory."), B_TRANSLATE("OK"), NULL, NULL, - B_WIDTH_AS_USUAL, B_STOP_ALERT); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - (void)alert->Go(); - return B_ERROR; - } - - path.Append(kFiltersSettings); - - BFile file(path.Path(), B_READ_ONLY); - BMessage settings; - if (settings.Unflatten(&file) != B_OK) - return B_ERROR; - type_code type; int32 count = 0; @@ -215,6 +184,20 @@ NotificationsView::_LoadAppUsage() fAppFilters[app->Name()] = app; } + // Load the applications list + _PopulateApplications(); + + return B_OK; +} + + +status_t +NotificationsView::Save(BMessage& storage) +{ + appusage_t::iterator fIt; + for (fIt = fAppFilters.begin(); fIt != fAppFilters.end(); fIt++) + storage.AddFlat("app_usage", fIt->second); + return B_OK; } diff --git a/src/preferences/notifications/NotificationsView.h b/src/preferences/notifications/NotificationsView.h index 45a09eb6d4..b44c7376cf 100644 --- a/src/preferences/notifications/NotificationsView.h +++ b/src/preferences/notifications/NotificationsView.h @@ -10,6 +10,8 @@ #include +#include "SettingsPane.h" + typedef std::map appusage_t; class BCheckBox; @@ -18,15 +20,17 @@ class BColumnListView; class BStringColumn; class BDateColumn; -class NotificationsView : public BView { +class NotificationsView : public SettingsPane { public: - NotificationsView(); + NotificationsView(SettingsHost* host); virtual void AttachedToWindow(); virtual void MessageReceived(BMessage* msg); private: - status_t _LoadAppUsage(); + status_t Load(BMessage&); + status_t Save(BMessage&); + status_t Revert() {return B_OK;} // FIXME implement this void _PopulateApplications(); void _Populate(AppUsage* usage); diff --git a/src/preferences/notifications/PrefletView.cpp b/src/preferences/notifications/PrefletView.cpp index 230054aa08..df155e4672 100644 --- a/src/preferences/notifications/PrefletView.cpp +++ b/src/preferences/notifications/PrefletView.cpp @@ -35,7 +35,7 @@ PrefletView::PrefletView(SettingsHost* host) // Pages GeneralView* general = new GeneralView(host); DisplayView* display = new DisplayView(host); - NotificationsView* apps = new NotificationsView(); + NotificationsView* apps = new NotificationsView(host); // Page selector BTab* tab = new BTab(); diff --git a/src/preferences/notifications/PrefletWin.cpp b/src/preferences/notifications/PrefletWin.cpp index 76a4a1b964..79bdf10f22 100644 --- a/src/preferences/notifications/PrefletWin.cpp +++ b/src/preferences/notifications/PrefletWin.cpp @@ -7,13 +7,19 @@ * Pier Luigi Fiorini, pierluigi.fiorini@gmail.com */ +#include "PrefletWin.h" + +#include #include -#include -#include #include #include +#include +#include +#include +#include + +#include -#include "PrefletWin.h" #include "PrefletView.h" @@ -60,6 +66,8 @@ PrefletWin::PrefletWin() .SetInsets(inset, inset, inset, inset) ); + ReloadSettings(); + // Center this window on screen and show it CenterOnScreen(); Show(); @@ -71,18 +79,44 @@ PrefletWin::MessageReceived(BMessage* msg) { switch (msg->what) { case kApply: + { + BPath path; + + status_t ret = B_OK; + ret = find_directory(B_USER_SETTINGS_DIRECTORY, &path); + if (ret != B_OK) + return; + + path.Append(kSettingsFile); + + BMessage settingsStore; for (int32 i = 0; i < fMainView->CountPages(); i++) { SettingsPane* pane = dynamic_cast(fMainView->PageAt(i)); if (pane) { - if (pane->Save() == B_OK) { + if (pane->Save(settingsStore) == B_OK) { fApply->SetEnabled(false); fRevert->SetEnabled(true); } else break; } } + + // Save settings file + BFile file(path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); + ret = settingsStore.Flatten(&file); + if (ret != B_OK) { + BAlert* alert = new BAlert("", + B_TRANSLATE("An error occurred saving the preferences.\n" + "It's possible you are running out of disk space."), + B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, + B_STOP_ALERT); + alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); + (void)alert->Go(); + } + break; + } case kRevert: for (int32 i = 0; i < fMainView->CountPages(); i++) { SettingsPane* pane = @@ -112,3 +146,27 @@ PrefletWin::SettingChanged() { fApply->SetEnabled(true); } + + +void +PrefletWin::ReloadSettings() +{ + BPath path; + + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) + return; + + // FIXME don't load this again here, share with other tabs! + path.Append(kSettingsFile); + + BMessage settings; + BFile file(path.Path(), B_READ_ONLY); + settings.Unflatten(&file); + + for (int32 i = 0; i < fMainView->CountPages(); i++) { + SettingsPane* pane = + dynamic_cast(fMainView->PageAt(i)); + if (pane) + pane->Load(settings); + } +} diff --git a/src/preferences/notifications/PrefletWin.h b/src/preferences/notifications/PrefletWin.h index c9443d25a7..561c1fb4c8 100644 --- a/src/preferences/notifications/PrefletWin.h +++ b/src/preferences/notifications/PrefletWin.h @@ -22,6 +22,7 @@ public: virtual void MessageReceived(BMessage* msg); virtual void SettingChanged(); + void ReloadSettings(); private: PrefletView* fMainView; diff --git a/src/preferences/notifications/SettingsPane.cpp b/src/preferences/notifications/SettingsPane.cpp index 55e325e2fb..128e7a5521 100644 --- a/src/preferences/notifications/SettingsPane.cpp +++ b/src/preferences/notifications/SettingsPane.cpp @@ -8,10 +8,6 @@ */ #include -#include -#include -#include -#include #include "SettingsPane.h" #include "SettingsHost.h" diff --git a/src/preferences/notifications/SettingsPane.h b/src/preferences/notifications/SettingsPane.h index 6908900755..a14fd62a77 100644 --- a/src/preferences/notifications/SettingsPane.h +++ b/src/preferences/notifications/SettingsPane.h @@ -20,8 +20,8 @@ public: virtual void MessageReceived(BMessage* msg); - virtual status_t Load() = 0; - virtual status_t Save() = 0; + virtual status_t Load(BMessage&) = 0; + virtual status_t Save(BMessage&) = 0; virtual status_t Revert() = 0; protected: diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index 363b62c173..6a37db25b1 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -65,7 +65,6 @@ NotificationWindow::NotificationWindow() SetLayout(new BGroupLayout(B_VERTICAL, 0)); _LoadSettings(true); - _LoadAppFilters(true); // Start the message loop Hide(); @@ -125,7 +124,6 @@ NotificationWindow::MessageReceived(BMessage* message) case B_NODE_MONITOR: { _LoadSettings(); - _LoadAppFilters(); break; } case B_COUNT_PROPERTIES: @@ -407,108 +405,21 @@ NotificationWindow::SetPosition() void NotificationWindow::_LoadSettings(bool startMonitor) -{ - _LoadGeneralSettings(startMonitor); - _LoadDisplaySettings(startMonitor); -} - - -void -NotificationWindow::_LoadAppFilters(bool startMonitor) { BPath path; + BMessage settings; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) return; - path.Append(kSettingsDirectory); - - if (create_directory(path.Path(), 0755) != B_OK) - return; - - path.Append(kFiltersSettings); + path.Append(kSettingsFile); BFile file(path.Path(), B_READ_ONLY); - BMessage settings; - if (settings.Unflatten(&file) != B_OK) - return; + settings.Unflatten(&file); - type_code type; - int32 count = 0; - - if (settings.GetInfo("app_usage", &type, &count) != B_OK) - return; - - for (int32 i = 0; i < count; i++) { - AppUsage* app = new AppUsage(); - settings.FindFlat("app_usage", i, app); - fAppFilters[app->Name()] = app; - } - - if (startMonitor) { - node_ref nref; - BEntry entry(path.Path()); - entry.GetNodeRef(&nref); - - if (watch_node(&nref, B_WATCH_ALL, BMessenger(this)) != B_OK) { - BAlert* alert = new BAlert(B_TRANSLATE("Warning"), - B_TRANSLATE("Couldn't start filter monitor." - " Live filter changes disabled."), B_TRANSLATE("Darn.")); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - alert->Go(); - } - } -} - - -void -NotificationWindow::_SaveAppFilters() -{ - BPath path; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) - return; - - path.Append(kSettingsDirectory); - path.Append(kFiltersSettings); - - BMessage settings; - BFile file(path.Path(), B_WRITE_ONLY); - - appfilter_t::iterator fIt; - for (fIt = fAppFilters.begin(); fIt != fAppFilters.end(); fIt++) - settings.AddFlat("app_usage", fIt->second); - - settings.Flatten(&file); -} - - -void -NotificationWindow::_LoadGeneralSettings(bool startMonitor) -{ - BPath path; - BMessage settings; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) - return; - - path.Append(kSettingsDirectory); - if (create_directory(path.Path(), 0755) == B_OK) { - path.Append(kGeneralSettings); - - BFile file(path.Path(), B_READ_ONLY); - settings.Unflatten(&file); - } - - if (settings.FindInt32(kTimeoutName, &fTimeout) != B_OK) - fTimeout = kDefaultTimeout; - - // Notify the view about the change - views_t::iterator it; - for (it = fViews.begin(); it != fViews.end(); ++it) { - NotificationView* view = (*it); - view->Invalidate(); - } + _LoadGeneralSettings(settings); + _LoadDisplaySettings(settings); + _LoadAppFilters(settings); if (startMonitor) { node_ref nref; @@ -527,22 +438,40 @@ NotificationWindow::_LoadGeneralSettings(bool startMonitor) void -NotificationWindow::_LoadDisplaySettings(bool startMonitor) +NotificationWindow::_LoadAppFilters(BMessage& settings) { - BPath path; - BMessage settings; + type_code type; + int32 count = 0; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) + if (settings.GetInfo("app_usage", &type, &count) != B_OK) return; - path.Append(kSettingsDirectory); - if (create_directory(path.Path(), 0755) == B_OK) { - path.Append(kDisplaySettings); - - BFile file(path.Path(), B_READ_ONLY); - settings.Unflatten(&file); + for (int32 i = 0; i < count; i++) { + AppUsage* app = new AppUsage(); + settings.FindFlat("app_usage", i, app); + fAppFilters[app->Name()] = app; } +} + +void +NotificationWindow::_LoadGeneralSettings(BMessage& settings) +{ + if (settings.FindInt32(kTimeoutName, &fTimeout) != B_OK) + fTimeout = kDefaultTimeout; + + // Notify the view about the change + views_t::iterator it; + for (it = fViews.begin(); it != fViews.end(); ++it) { + NotificationView* view = (*it); + view->Invalidate(); + } +} + + +void +NotificationWindow::_LoadDisplaySettings(BMessage& settings) +{ int32 setting; if (settings.FindFloat(kWidthName, &fWidth) != B_OK) @@ -561,18 +490,4 @@ NotificationWindow::_LoadDisplaySettings(bool startMonitor) NotificationView* view = (*it); view->Invalidate(); } - - if (startMonitor) { - node_ref nref; - BEntry entry(path.Path()); - entry.GetNodeRef(&nref); - - if (watch_node(&nref, B_WATCH_ALL, BMessenger(this)) != B_OK) { - BAlert* alert = new BAlert(B_TRANSLATE("Warning"), - B_TRANSLATE("Couldn't start display settings monitor.\n" - "Live filter changes disabled."), B_TRANSLATE("OK")); - alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); - alert->Go(); - } - } } diff --git a/src/servers/notification/NotificationWindow.h b/src/servers/notification/NotificationWindow.h index 10b2653984..a28dd64751 100644 --- a/src/servers/notification/NotificationWindow.h +++ b/src/servers/notification/NotificationWindow.h @@ -65,10 +65,9 @@ private: void SetPosition(); void _LoadSettings(bool startMonitor = false); - void _LoadAppFilters(bool startMonitor = false); - void _SaveAppFilters(); - void _LoadGeneralSettings(bool startMonitor); - void _LoadDisplaySettings(bool startMonitor); + void _LoadAppFilters(BMessage& settings); + void _LoadGeneralSettings(BMessage& settings); + void _LoadDisplaySettings(BMessage& settings); views_t fViews; appview_t fAppViews; diff --git a/src/servers/notification/Notifications.cpp b/src/servers/notification/Notifications.cpp index cefdc6afd2..3dfcb1e713 100644 --- a/src/servers/notification/Notifications.cpp +++ b/src/servers/notification/Notifications.cpp @@ -8,10 +8,7 @@ // Settings constants -const char* kSettingsDirectory = "system/notifications"; -const char* kFiltersSettings = "filters"; -const char* kGeneralSettings = "general"; -const char* kDisplaySettings = "display"; +const char* kSettingsFile = "system/notifications"; // General settings const char* kAutoStartName = "auto-start";