diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 23:09:10 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-08 23:09:10 +0000 |
commit | 335edaa2600a50a88831cde6aa03112dc49b7779 (patch) | |
tree | cd3afd46df292c517fe1e55e100dc7ebc481925d /chrome | |
parent | fd4fe0b5f640e9a06b9fcf740a0e465f79bfe7d1 (diff) | |
download | chromium_src-335edaa2600a50a88831cde6aa03112dc49b7779.zip chromium_src-335edaa2600a50a88831cde6aa03112dc49b7779.tar.gz chromium_src-335edaa2600a50a88831cde6aa03112dc49b7779.tar.bz2 |
GTK: use appropriate bookmark manager menus
also, always show cut/copy/paste for bookmark menus (see bug 32064)
also, don't add "Show in folder" on menus that aren't going to enable it anyway
BUG=32830
TEST=manual
Review URL: http://codereview.chromium.org/580018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38409 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_context_menu_controller.cc | 18 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.cc | 20 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.h | 4 |
3 files changed, 27 insertions, 15 deletions
diff --git a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc index 325f341..3386f3f 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu_controller.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu_controller.cc @@ -245,23 +245,15 @@ void BookmarkContextMenuController::BuildMenu() { } AddItem(IDS_BOOKMARK_BAR_REMOVE); - if (configuration_ == BOOKMARK_MANAGER_TABLE || - configuration_ == BOOKMARK_MANAGER_TABLE_OTHER || - configuration_ == BOOKMARK_MANAGER_ORGANIZE_MENU || + if (configuration_ == BOOKMARK_MANAGER_TABLE_OTHER || configuration_ == BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER) { AddItem(IDS_BOOKMARK_MANAGER_SHOW_IN_FOLDER); } - if (configuration_ == BOOKMARK_MANAGER_TABLE || - configuration_ == BOOKMARK_MANAGER_TABLE_OTHER || - configuration_ == BOOKMARK_MANAGER_TREE || - configuration_ == BOOKMARK_MANAGER_ORGANIZE_MENU || - configuration_ == BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER) { - AddSeparator(); - AddItem(IDS_CUT); - AddItem(IDS_COPY); - AddItem(IDS_PASTE); - } + AddSeparator(); + AddItem(IDS_CUT); + AddItem(IDS_COPY); + AddItem(IDS_PASTE); if (configuration_ == BOOKMARK_MANAGER_ORGANIZE_MENU) { AddSeparator(); diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc index 927436f..b21365f 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.cc +++ b/chrome/browser/gtk/bookmark_manager_gtk.cc @@ -626,6 +626,9 @@ void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { else if (parent) nodes.push_back(parent); + // Whether the "recently added" or "search" options are selected on the left. + bool is_other = !parent; + // We DeleteSoon on the old one to give any reference holders (e.g. // the event that caused this reset) a chance to release their refs. MenuGtk* old_menu = organize_menu_.release(); @@ -639,12 +642,25 @@ void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { organize_menu_controller_.reset( new BookmarkContextMenuController(GTK_WINDOW(window_), this, profile_, - NULL, parent, nodes, + NULL, parent, nodes, is_other ? + BookmarkContextMenuController::BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER : BookmarkContextMenuController::BOOKMARK_MANAGER_ORGANIZE_MENU)); organize_menu_.reset( new MenuGtk(NULL, organize_menu_controller_->menu_model())); gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->widget()); + + // Also rebuild the context menu. + old_controller = context_menu_controller_.release(); + if (old_controller) + MessageLoop::current()->DeleteSoon(FROM_HERE, old_controller); + context_menu_controller_.reset( + new BookmarkContextMenuController(GTK_WINDOW(window_), this, profile_, + NULL, parent, nodes, is_other ? + BookmarkContextMenuController::BOOKMARK_MANAGER_TABLE_OTHER : + BookmarkContextMenuController::BOOKMARK_MANAGER_TABLE)); + context_menu_.reset( + new MenuGtk(NULL, context_menu_controller_->menu_model())); } void BookmarkManagerGtk::BuildLeftStore() { @@ -1305,7 +1321,7 @@ gboolean BookmarkManagerGtk::OnTreeViewButtonPress( bm->ignore_rightclicks_ = false; } - bm->organize_menu_->PopupAsContext(button->time); + bm->context_menu_->PopupAsContext(button->time); return TRUE; } diff --git a/chrome/browser/gtk/bookmark_manager_gtk.h b/chrome/browser/gtk/bookmark_manager_gtk.h index ec27be1..2b45bc4 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.h +++ b/chrome/browser/gtk/bookmark_manager_gtk.h @@ -350,6 +350,10 @@ class BookmarkManagerGtk : public BookmarkModelObserver, // Whether the menu refers to the left selection. bool organize_is_for_left_; + // The context menu view and controller. + scoped_ptr<BookmarkContextMenuController> context_menu_controller_; + scoped_ptr<MenuGtk> context_menu_; + // The sync status menu item that notifies the user about the current status // of bookmarks synchronization. GtkWidget* sync_status_menu_; |