diff --git a/data/launch/user b/data/launch/user index 2a3b74faa9..3ddb09e6bd 100644 --- a/data/launch/user +++ b/data/launch/user @@ -12,6 +12,14 @@ target desktop { on initial_volumes_mounted } + job x-vnd.Haiku-LaunchBox { + launch /system/apps/LaunchBox + if setting ~/config/settings/LaunchBox/main_settings autostart + on initial_volumes_mounted + legacy + no_safemode + } + service x-vnd.Be-POST { launch /system/servers/mail_daemon if setting ~/config/settings/Mail/new_mail_daemon DaemonAutoStarts diff --git a/src/apps/launchbox/App.cpp b/src/apps/launchbox/App.cpp index fcf5447852..e2f6a4c4e6 100644 --- a/src/apps/launchbox/App.cpp +++ b/src/apps/launchbox/App.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include "support.h" @@ -19,11 +21,13 @@ #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "LaunchBox" + App::App() : BApplication("application/x-vnd.Haiku-LaunchBox"), fSettingsChanged(false), - fNamePanelSize(200, 50) + fNamePanelSize(200, 50), + fAutoStart(false) { SetPulseRate(3000000); } @@ -69,6 +73,9 @@ App::ReadyToRun() BSize size; if (settings.FindSize("name panel size", &size) == B_OK) fNamePanelSize = size; + bool auto_start; + if (settings.FindBool("autostart", &auto_start) == B_OK) + fAutoStart = auto_start; } if (!windowAdded) { @@ -97,6 +104,9 @@ App::MessageReceived(BMessage* message) fSettingsChanged = true; break; } + case MSG_TOGGLE_AUTOSTART: + ToggleAutoStart(); + break; case MSG_SETTINGS_CHANGED: fSettingsChanged = true; break; @@ -124,6 +134,14 @@ App::SetNamePanelSize(const BSize& size) } +void +App::ToggleAutoStart() +{ + fSettingsChanged = true; + fAutoStart = !AutoStart(); +} + + BSize App::NamePanelSize() { @@ -156,8 +174,9 @@ App::_StoreSettingsIfNeeded() } } settings.AddSize("name panel size", fNamePanelSize); + settings.AddBool("autostart", AutoStart()); save_settings(&settings, "main_settings", "LaunchBox"); fSettingsChanged = false; -} +} \ No newline at end of file diff --git a/src/apps/launchbox/App.h b/src/apps/launchbox/App.h index 12366d19d4..bbb1769f47 100644 --- a/src/apps/launchbox/App.h +++ b/src/apps/launchbox/App.h @@ -26,6 +26,8 @@ public: void SetNamePanelSize(const BSize& size); BSize NamePanelSize(); + void ToggleAutoStart(); + bool AutoStart() { return fAutoStart; } private: void _StoreSettingsIfNeeded(); @@ -33,7 +35,8 @@ private: bool fSettingsChanged; BSize fNamePanelSize; + bool fAutoStart; }; -#endif // APP_H +#endif // APP_H \ No newline at end of file diff --git a/src/apps/launchbox/LaunchButton.cpp b/src/apps/launchbox/LaunchButton.cpp index d22be5eb68..370e4417d4 100644 --- a/src/apps/launchbox/LaunchButton.cpp +++ b/src/apps/launchbox/LaunchButton.cpp @@ -448,4 +448,4 @@ LaunchButton::_DrawFrame(BRect r, rgb_color col1, rgb_color col2, AddLine(BPoint(r.right, r.top + 1.0), BPoint(r.right, r.bottom), col4); AddLine(BPoint(r.right - 1.0, r.bottom), BPoint(r.left + 1.0, r.bottom), col4); EndLineArray(); -} +} \ No newline at end of file diff --git a/src/apps/launchbox/LaunchButton.h b/src/apps/launchbox/LaunchButton.h index e1d095339e..d1eb8fd646 100644 --- a/src/apps/launchbox/LaunchButton.h +++ b/src/apps/launchbox/LaunchButton.h @@ -86,4 +86,4 @@ private: static bool sIgnoreDoubleClick; }; -#endif // LAUNCH_BUTTON_H +#endif // LAUNCH_BUTTON_H \ No newline at end of file diff --git a/src/apps/launchbox/MainWindow.cpp b/src/apps/launchbox/MainWindow.cpp index 404ba14866..237e93a8cf 100644 --- a/src/apps/launchbox/MainWindow.cpp +++ b/src/apps/launchbox/MainWindow.cpp @@ -7,6 +7,8 @@ #include +#include +#include #include #include #include @@ -49,7 +51,6 @@ MainWindow::MainWindow(const char* name, BRect frame, bool addDefaultButtons) else _AddEmptyButtons(); } - SetLayout(new BGroupLayout(B_HORIZONTAL)); AddChild(fPadView); } @@ -652,5 +653,4 @@ void MainWindow::_NotifySettingsChanged() { be_app->PostMessage(MSG_SETTINGS_CHANGED); -} - +} \ No newline at end of file diff --git a/src/apps/launchbox/MainWindow.h b/src/apps/launchbox/MainWindow.h index 50de629b54..8ad785dfe7 100644 --- a/src/apps/launchbox/MainWindow.h +++ b/src/apps/launchbox/MainWindow.h @@ -21,6 +21,7 @@ enum { MSG_ADD_WINDOW = 'addw', MSG_SETTINGS_CHANGED = 'stch', + MSG_TOGGLE_AUTOSTART = 'tast' }; @@ -77,4 +78,4 @@ private: bool fShowOnAllWorkspaces; }; -#endif // MAIN_WINDOW_H +#endif // MAIN_WINDOW_H \ No newline at end of file diff --git a/src/apps/launchbox/PadView.cpp b/src/apps/launchbox/PadView.cpp index 012392388c..92a2d1d81a 100644 --- a/src/apps/launchbox/PadView.cpp +++ b/src/apps/launchbox/PadView.cpp @@ -7,6 +7,8 @@ #include +#include +#include #include #include #include @@ -19,6 +21,7 @@ #include "LaunchButton.h" #include "MainWindow.h" +#include "App.h" #undef B_TRANSLATION_CONTEXT @@ -399,6 +402,11 @@ PadView::DisplayMenu(BPoint where, LaunchButton* button) const item->SetMarked(what == MSG_HIDE_BORDER); settingsM->AddItem(item); + item = new BMenuItem(B_TRANSLATE("Autostart"), new BMessage(MSG_TOGGLE_AUTOSTART)); + item->SetTarget(be_app); + item->SetMarked(((App*)be_app)->AutoStart()); + settingsM->AddItem(item); + item = new BMenuItem(B_TRANSLATE("Auto-raise"), new BMessage(MSG_TOGGLE_AUTORAISE)); item->SetTarget(window); item->SetMarked(window->AutoRaise()); @@ -511,5 +519,4 @@ void PadView::_NotifySettingsChanged() { be_app->PostMessage(MSG_SETTINGS_CHANGED); -} - +} \ No newline at end of file diff --git a/src/apps/launchbox/PadView.h b/src/apps/launchbox/PadView.h index f19a1c3239..035e8931c2 100644 --- a/src/apps/launchbox/PadView.h +++ b/src/apps/launchbox/PadView.h @@ -53,4 +53,4 @@ private: uint32 fIconSize; }; -#endif // PAD_VIEW_H +#endif // PAD_VIEW_H \ No newline at end of file