OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/gtk/global_bookmark_menu.h" | 5 #include "chrome/browser/ui/gtk/global_bookmark_menu.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Only display the other bookmarks folder in the menu if it has items in it. | 106 // Only display the other bookmarks folder in the menu if it has items in it. |
107 const BookmarkNode* other_node = model->other_node(); | 107 const BookmarkNode* other_node = model->other_node(); |
108 if (!other_node->empty()) { | 108 if (!other_node->empty()) { |
109 GtkWidget* submenu = gtk_menu_new(); | 109 GtkWidget* submenu = gtk_menu_new(); |
110 AddNodeToMenu(other_node, submenu); | 110 AddNodeToMenu(other_node, submenu); |
111 | 111 |
112 AddBookmarkMenuItem(bookmark_menu_.get(), gtk_separator_menu_item_new()); | 112 AddBookmarkMenuItem(bookmark_menu_.get(), gtk_separator_menu_item_new()); |
113 | 113 |
114 GtkWidget* menu_item = gtk_image_menu_item_new_with_label( | 114 GtkWidget* menu_item = gtk_image_menu_item_new_with_label( |
115 l10n_util::GetStringUTF8(IDS_BOOMARK_BAR_OTHER_FOLDER_NAME).c_str()); | 115 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_OTHER_FOLDER_NAME).c_str()); |
116 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); | 116 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); |
117 gtk_image_menu_item_set_image( | 117 gtk_image_menu_item_set_image( |
118 GTK_IMAGE_MENU_ITEM(menu_item), | 118 GTK_IMAGE_MENU_ITEM(menu_item), |
119 gtk_image_new_from_pixbuf(default_folder_)); | 119 gtk_image_new_from_pixbuf(default_folder_)); |
120 gtk_util::SetAlwaysShowImage(menu_item); | 120 gtk_util::SetAlwaysShowImage(menu_item); |
121 | 121 |
122 AddBookmarkMenuItem(bookmark_menu_.get(), menu_item); | 122 AddBookmarkMenuItem(bookmark_menu_.get(), menu_item); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 void GlobalBookmarkMenu::OnBookmarkItemActivated(GtkWidget* menu_item) { | 295 void GlobalBookmarkMenu::OnBookmarkItemActivated(GtkWidget* menu_item) { |
296 // The actual mouse event that generated this activated event was in a | 296 // The actual mouse event that generated this activated event was in a |
297 // different process. Go with something default. | 297 // different process. Go with something default. |
298 const BookmarkNode* node = static_cast<const BookmarkNode*>( | 298 const BookmarkNode* node = static_cast<const BookmarkNode*>( |
299 g_object_get_data(G_OBJECT(menu_item), "bookmark-node")); | 299 g_object_get_data(G_OBJECT(menu_item), "bookmark-node")); |
300 | 300 |
301 browser_->OpenURL(node->url(), GURL(), NEW_FOREGROUND_TAB, | 301 browser_->OpenURL(node->url(), GURL(), NEW_FOREGROUND_TAB, |
302 PageTransition::AUTO_BOOKMARK); | 302 PageTransition::AUTO_BOOKMARK); |
303 } | 303 } |
304 | 304 |
OLD | NEW |