Tracker: Introduce "Restart Deskbar" option (+alpha3)
* Matches "Restart Tracker" option in Deskbar * Only shows up when 0 Deskbar processes exist * Don't dereference fFileMenu if RepopulateMenus called on desktop (no menu bar) * Regenerate desktop menu on each click * Resolves #9039
This commit is contained in:
parent
9af3b83575
commit
ff09527e4f
@ -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';
|
||||
|
||||
|
@ -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<BDeskWindow*>(this))
|
||||
RepopulateMenus();
|
||||
|
||||
MenusEnded();
|
||||
|
||||
// clicked on a window, show window context menu
|
||||
|
@ -39,6 +39,7 @@ All rights reserved.
|
||||
#include <NodeMonitor.h>
|
||||
#include <Path.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Roster.h>
|
||||
#include <Screen.h>
|
||||
#include <Volume.h>
|
||||
#include <VolumeRoster.h>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user