diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-11 23:54:45 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-11 23:54:45 +0000 |
commit | c6bbcb7dcac68ae1830863a3959e61555bf1ceff (patch) | |
tree | d8c35b9b3949db6c79a6e7eb014dca180d14a9e0 /chrome/browser/gtk/bookmark_context_menu_gtk.cc | |
parent | 97e994985302a708c144e6d05d1b8637f92034c1 (diff) | |
download | chromium_src-c6bbcb7dcac68ae1830863a3959e61555bf1ceff.zip chromium_src-c6bbcb7dcac68ae1830863a3959e61555bf1ceff.tar.gz chromium_src-c6bbcb7dcac68ae1830863a3959e61555bf1ceff.tar.bz2 |
Lands 536001 for bryenug:
Add Cut/Copy/Paste items to the bookmark bar menu.
Also, removes Remove. This is a Linux only change.
BUG=25640
TEST=manually
Review URL: http://codereview.chromium.org/545015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_context_menu_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/bookmark_context_menu_gtk.cc | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/chrome/browser/gtk/bookmark_context_menu_gtk.cc b/chrome/browser/gtk/bookmark_context_menu_gtk.cc index 5bf57ac..1afa17b 100644 --- a/chrome/browser/gtk/bookmark_context_menu_gtk.cc +++ b/chrome/browser/gtk/bookmark_context_menu_gtk.cc @@ -241,7 +241,6 @@ BookmarkContextMenuGtk::BookmarkContextMenuGtk( } else { AppendItem(IDS_BOOKMARK_BAR_EDIT); } - AppendItem(IDS_BOOKMARK_BAR_REMOVE); if (configuration == BOOKMARK_MANAGER_TABLE || configuration == BOOKMARK_MANAGER_TABLE_OTHER || @@ -250,16 +249,10 @@ BookmarkContextMenuGtk::BookmarkContextMenuGtk( AppendItem(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) { - AppendSeparator(); - AppendItem(IDS_CUT); - AppendItem(IDS_COPY); - AppendItem(IDS_PASTE); - } + AppendSeparator(); + AppendItem(IDS_CUT); + AppendItem(IDS_COPY); + AppendItem(IDS_PASTE); if (configuration == BOOKMARK_MANAGER_ORGANIZE_MENU) { AppendSeparator(); @@ -418,16 +411,17 @@ void BookmarkContextMenuGtk::ExecuteCommandById(int id) { break; case IDS_PASTE: { - // Always paste to parent. - if (!parent_) + const BookmarkNode* paste_target = GetParentForNewNodes(); + if (!paste_target) return; - int index = (selection_.size() == 1) ? - parent_->IndexOfChild(selection_[0]) : -1; - if (index != -1) - index++; + int index = -1; + if (selection_.size() == 1 && selection_[0]->is_url()) { + index = paste_target->IndexOfChild(selection_[0]) + 1; + } + bookmark_utils::PasteFromClipboard(profile_->GetBookmarkModel(), - parent_, index); + paste_target, index); break; } @@ -480,8 +474,11 @@ bool BookmarkContextMenuGtk::IsCommandEnabled(int id) const { return selection_.size() > 0 && !is_root_node; case IDS_PASTE: - // Always paste to parent. - return bookmark_utils::CanPasteFromClipboard(parent_); + // Paste to selection from the Bookmark Bar, to parent_ everywhere else + return (configuration_ == BOOKMARK_BAR && + !selection_.empty() && + bookmark_utils::CanPasteFromClipboard(selection_[0])) || + bookmark_utils::CanPasteFromClipboard(parent_); } return true; } |