Tracker: Style fixes to DeskWindow

This commit is contained in:
John Scipione
2014-06-14 16:21:05 -04:00
parent 00922c9989
commit 6cf062b93d
2 changed files with 15 additions and 9 deletions
+12 -7
View File
@@ -71,6 +71,7 @@ const char* kShortcutsSettings = "shortcuts_settings";
const char* kDefaultShortcut = "BEOS:default_shortcut"; const char* kDefaultShortcut = "BEOS:default_shortcut";
const uint32 kDefaultModifiers = B_OPTION_KEY | B_COMMAND_KEY; const uint32 kDefaultModifiers = B_OPTION_KEY | B_COMMAND_KEY;
static struct AddonShortcut* static struct AddonShortcut*
MatchOne(struct AddonShortcut* item, void* castToName) MatchOne(struct AddonShortcut* item, void* castToName)
{ {
@@ -88,6 +89,7 @@ AddOneShortcut(Model* model, char key, uint32 modifiers, BDeskWindow* window)
{ {
if (key == '\0') if (key == '\0')
return; return;
BMessage* runAddon = new BMessage(kLoadAddOn); BMessage* runAddon = new BMessage(kLoadAddOn);
runAddon->AddRef("refs", model->EntryRef()); runAddon->AddRef("refs", model->EntryRef());
window->AddShortcut(key, modifiers, runAddon); window->AddShortcut(key, modifiers, runAddon);
@@ -107,6 +109,7 @@ RevertToDefault(struct AddonShortcut* item, void* castToWindow)
AddOneShortcut(item->model, item->key, item->modifiers, window); AddOneShortcut(item->model, item->key, item->modifiers, window);
} }
} }
return 0; return 0;
} }
@@ -182,19 +185,21 @@ LoadAddOnDir(directory_which dirName, BDeskWindow* window,
} }
// #pragma mark - // #pragma mark - BDeskWindow
#undef B_TRANSLATION_CONTEXT #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "DeskWindow" #define B_TRANSLATION_CONTEXT "DeskWindow"
BDeskWindow::BDeskWindow(LockingList<BWindow>* windowList) BDeskWindow::BDeskWindow(LockingList<BWindow>* windowList)
: :
BContainerWindow(windowList, 0, kPrivateDesktopWindowLook, BContainerWindow(windowList, 0, kPrivateDesktopWindowLook,
kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK
| B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_NOT_MINIMIZABLE
| B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES), | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES),
fDeskShelf(0), fDeskShelf(NULL),
fTrashContextMenu(0), fTrashContextMenu(NULL),
fNodeRef(NULL), fNodeRef(NULL),
fShortcutsSettings(NULL) fShortcutsSettings(NULL)
{ {
@@ -309,10 +314,9 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
} }
shortcutSettings.GetNodeRef(fNodeRef); shortcutSettings.GetNodeRef(fNodeRef);
int i = 0; int32 i = 0;
BMessage message; BMessage message;
while (fileMsg.FindMessage("spec", i++, &message) == B_OK) { while (fileMsg.FindMessage("spec", i++, &message) == B_OK) {
int32 key; int32 key;
if (message.FindInt32("key", &key) == B_OK) { if (message.FindInt32("key", &key) == B_OK) {
// only handle shortcuts referring add-ons // only handle shortcuts referring add-ons
@@ -389,13 +393,14 @@ BDeskWindow::ApplyShortcutPreferences(bool update)
void void
BDeskWindow::Quit() BDeskWindow::Quit()
{ {
if (fNavigationItem) { if (fNavigationItem != NULL) {
// this duplicates BContainerWindow::Quit because // this duplicates BContainerWindow::Quit because
// fNavigationItem can be part of fTrashContextMenu // fNavigationItem can be part of fTrashContextMenu
// and would get deleted with it // and would get deleted with it
BMenu* menu = fNavigationItem->Menu(); BMenu* menu = fNavigationItem->Menu();
if (menu) if (menu != NULL)
menu->RemoveItem(fNavigationItem); menu->RemoveItem(fNavigationItem);
delete fNavigationItem; delete fNavigationItem;
fNavigationItem = 0; fNavigationItem = 0;
} }
+3 -2
View File
@@ -31,7 +31,7 @@ of Be Incorporated in the United States and other countries. Other brand product
names are registered trademarks or trademarks of their respective holders. names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#ifndef _DESK_WINDOW_H #ifndef _DESK_WINDOW_H
#define _DESK_WINDOW_H #define _DESK_WINDOW_H
@@ -104,4 +104,5 @@ BDeskWindow::PoseView() const
using namespace BPrivate; using namespace BPrivate;
#endif
#endif // _DESK_WINDOW_H