diff --git a/src/kits/tracker/Commands.h b/src/kits/tracker/Commands.h index 208cbb68ff..869270be48 100644 --- a/src/kits/tracker/Commands.h +++ b/src/kits/tracker/Commands.h @@ -78,6 +78,7 @@ const uint32 kLoadAddOn = 'Tlda'; const uint32 kEmptyTrash = 'Tetr'; const uint32 kAddPrinter = 'Tadp'; const uint32 kMakeActivePrinter = 'Tmap'; +const uint32 kRestartDeskbar = 'DBar'; const uint32 kRunAutomounterSettings = 'Tram'; diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index fe161831e0..574cc2349a 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -873,34 +873,36 @@ BContainerWindow::RepopulateMenus() fWindowContextMenu->SetFont(be_plain_font); AddWindowContextMenus(fWindowContextMenu); - fMenuBar->RemoveItem(fFileMenu); - delete fFileMenu; - fFileMenu = new BMenu(B_TRANSLATE("File")); - AddFileMenu(fFileMenu); - fMenuBar->AddItem(fFileMenu); + if (fMenuBar != NULL) { + fMenuBar->RemoveItem(fFileMenu); + delete fFileMenu; + fFileMenu = new BMenu(B_TRANSLATE("File")); + AddFileMenu(fFileMenu); + fMenuBar->AddItem(fFileMenu); - fMenuBar->RemoveItem(fWindowMenu); - delete fWindowMenu; - fWindowMenu = new BMenu(B_TRANSLATE("Window")); - fMenuBar->AddItem(fWindowMenu); - AddWindowMenu(fWindowMenu); + fMenuBar->RemoveItem(fWindowMenu); + delete fWindowMenu; + fWindowMenu = new BMenu(B_TRANSLATE("Window")); + fMenuBar->AddItem(fWindowMenu); + AddWindowMenu(fWindowMenu); - // just create the attribute, decide to add it later - fMenuBar->RemoveItem(fAttrMenu); - delete fAttrMenu; - fAttrMenu = new BMenu(B_TRANSLATE("Attributes")); - NewAttributeMenu(fAttrMenu); - if (PoseView()->ViewMode() == kListMode) - ShowAttributeMenu(); + // just create the attribute, decide to add it later + fMenuBar->RemoveItem(fAttrMenu); + delete fAttrMenu; + fAttrMenu = new BMenu(B_TRANSLATE("Attributes")); + NewAttributeMenu(fAttrMenu); + if (PoseView()->ViewMode() == kListMode) + ShowAttributeMenu(); - PopulateArrangeByMenu(fArrangeByMenu); + PopulateArrangeByMenu(fArrangeByMenu); - int32 selectCount = PoseView()->SelectionList()->CountItems(); + int32 selectCount = PoseView()->SelectionList()->CountItems(); - SetupOpenWithMenu(fFileMenu); - SetupMoveCopyMenus(selectCount ? PoseView()->SelectionList()-> - FirstItem()->TargetModel()->EntryRef() : NULL, - fFileMenu); + SetupOpenWithMenu(fFileMenu); + SetupMoveCopyMenus(selectCount ? PoseView()->SelectionList() + ->FirstItem()->TargetModel()->EntryRef() : NULL, + fFileMenu); + } } @@ -1526,6 +1528,13 @@ BContainerWindow::MessageReceived(BMessage* message) (new FindWindow())->Show(); break; + case kRestartDeskbar: + { + BRoster roster; + roster.Launch(kDeskbarSignature); + break; + } + case kQuitTracker: be_app->PostMessage(B_QUIT_REQUESTED); break; @@ -2713,6 +2722,10 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref* ref, BView*) if (fWindowContextMenu->Window()) return; + // Repopulate desktop menu if IsDesktop + if (dynamic_cast(this)) + RepopulateMenus(); + MenusEnded(); // clicked on a window, show window context menu diff --git a/src/kits/tracker/DeskWindow.cpp b/src/kits/tracker/DeskWindow.cpp index a4ac77579a..5ad22a8376 100644 --- a/src/kits/tracker/DeskWindow.cpp +++ b/src/kits/tracker/DeskWindow.cpp @@ -39,6 +39,7 @@ All rights reserved. #include #include #include +#include #include #include #include @@ -274,6 +275,16 @@ BDeskWindow::CreatePoseView(Model* model) void BDeskWindow::AddWindowContextMenus(BMenu* menu) { + BMenuItem* item; + + BRoster roster; + if (!roster.IsRunning(kDeskbarSignature)) { + item = new BMenuItem(B_TRANSLATE("Restart Deskbar"), + new BMessage(kRestartDeskbar)); + menu->AddItem(item); + menu->AddSeparatorItem(); + } + TemplatesMenu* tempateMenu = new TemplatesMenu(PoseView(), B_TRANSLATE("New")); @@ -287,7 +298,7 @@ BDeskWindow::AddWindowContextMenus(BMenu* menu) BMessage* message = new BMessage(kIconMode); message->AddInt32("size", 32); - BMenuItem* item = new BMenuItem(B_TRANSLATE("32 x 32"), message); + item = new BMenuItem(B_TRANSLATE("32 x 32"), message); item->SetMarked(PoseView()->IconSizeInt() == 32); item->SetTarget(PoseView()); iconSizeMenu->AddItem(item);