diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-07 18:18:50 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-07 18:18:50 +0000 |
commit | cee3a2f265f58be27dc6a2bf5953b16cbe1d31ca (patch) | |
tree | b10f25f94a72237674b6e895b5f32735a705d470 /chrome/browser/gtk | |
parent | ff47e8e0ba804389d927f880034133300f642ade (diff) | |
download | chromium_src-cee3a2f265f58be27dc6a2bf5953b16cbe1d31ca.zip chromium_src-cee3a2f265f58be27dc6a2bf5953b16cbe1d31ca.tar.gz chromium_src-cee3a2f265f58be27dc6a2bf5953b16cbe1d31ca.tar.bz2 |
Connect a menu to the "Other bookmarks" button.
Review URL: http://codereview.chromium.org/113104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/bookmark_bar_gtk.cc | 39 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_bar_gtk.h | 2 |
2 files changed, 16 insertions, 25 deletions
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index 9f4f0ce..8464176 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -126,8 +126,7 @@ void BookmarkBarGtk::Init(Profile* profile) { FALSE, FALSE, 0); other_bookmarks_button_ = gtk_chrome_button_new(); - g_signal_connect(other_bookmarks_button_, "button-press-event", - G_CALLBACK(&OnButtonPressed), this); + ConnectFolderButtonEvents(other_bookmarks_button_); gtk_button_set_label( GTK_BUTTON(other_bookmarks_button_), l10n_util::GetStringUTF8(IDS_BOOMARK_BAR_OTHER_BOOKMARKED).c_str()); @@ -326,28 +325,8 @@ GtkWidget* BookmarkBarGtk::CreateBookmarkButton( g_signal_connect(G_OBJECT(button), "drag-end", G_CALLBACK(&OnButtonDragEnd), this); - - if (node->is_url()) { - // Connect to 'button-release-event' instead of 'clicked' because we need - // access to the modifier keys and we do different things on each - // button. - g_signal_connect(G_OBJECT(button), "button-press-event", - G_CALLBACK(OnButtonPressed), this); - g_signal_connect(G_OBJECT(button), "button-release-event", - G_CALLBACK(OnButtonReleased), this); - GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); - } else { - // TODO(erg): This button can also be a drop target. - - // Connect to 'button-release-event' instead of 'clicked' because we need - // access to the modifier keys and we do different things on each - // button. - g_signal_connect(G_OBJECT(button), "button-press-event", - G_CALLBACK(OnButtonPressed), this); - g_signal_connect(G_OBJECT(button), "button-release-event", - G_CALLBACK(OnFolderButtonReleased), this); - GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); - } + ConnectFolderButtonEvents(button); + GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); return button; } @@ -364,6 +343,16 @@ GtkToolItem* BookmarkBarGtk::CreateBookmarkToolItem(BookmarkNode* node) { return item; } +void BookmarkBarGtk::ConnectFolderButtonEvents(GtkWidget* widget) { + // Connect to 'button-release-event' instead of 'clicked' because we need + // access to the modifier keys and we do different things on each + // button. + g_signal_connect(G_OBJECT(widget), "button-press-event", + G_CALLBACK(OnButtonPressed), this); + g_signal_connect(G_OBJECT(widget), "button-release-event", + G_CALLBACK(OnFolderButtonReleased), this); +} + std::string BookmarkBarGtk::BuildTooltip(BookmarkNode* node) { // TODO(erg): Actually build the tooltip. For now, we punt and just return // the URL. @@ -371,7 +360,7 @@ std::string BookmarkBarGtk::BuildTooltip(BookmarkNode* node) { } BookmarkNode* BookmarkBarGtk::GetNodeForToolButton(GtkWidget* widget) { - // First check to see if |button| is the special cased. + // First check to see if |button| is special cased. if (widget == other_bookmarks_button_) return model_->other_node(); else if (widget == bookmark_toolbar_.get()) diff --git a/chrome/browser/gtk/bookmark_bar_gtk.h b/chrome/browser/gtk/bookmark_bar_gtk.h index 8c02765..93608f8 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.h +++ b/chrome/browser/gtk/bookmark_bar_gtk.h @@ -107,6 +107,8 @@ class BookmarkBarGtk : public BookmarkModelObserver { GtkWidget* CreateBookmarkButton(BookmarkNode* node); GtkToolItem* CreateBookmarkToolItem(BookmarkNode* node); + void ConnectFolderButtonEvents(GtkWidget* widget); + std::string BuildTooltip(BookmarkNode* node); // Finds the BookmarkNode from the model associated with |button|. |