Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.cc

Issue 7003039: ui/base/models: Add empty() accessor to TreeNode class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky review Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bookmarks/bookmark_menu_controller_gtk.h" 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // not the handler that the drag source uses. 190 // not the handler that the drag source uses.
191 if (node->is_folder()) { 191 if (node->is_folder()) {
192 signals_.Connect(menu_item, "button-press-event", 192 signals_.Connect(menu_item, "button-press-event",
193 G_CALLBACK(OnFolderButtonPressedThunk), this); 193 G_CALLBACK(OnFolderButtonPressedThunk), this);
194 } 194 }
195 195
196 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); 196 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
197 node_to_menu_widget_map_[node] = menu_item; 197 node_to_menu_widget_map_[node] = menu_item;
198 } 198 }
199 199
200 if (parent->child_count() == 0) { 200 if (parent->empty()) {
201 GtkWidget* empty_menu = gtk_menu_item_new_with_label( 201 GtkWidget* empty_menu = gtk_menu_item_new_with_label(
202 l10n_util::GetStringUTF8(IDS_MENU_EMPTY_SUBMENU).c_str()); 202 l10n_util::GetStringUTF8(IDS_MENU_EMPTY_SUBMENU).c_str());
203 gtk_widget_set_sensitive(empty_menu, FALSE); 203 gtk_widget_set_sensitive(empty_menu, FALSE);
204 g_object_set_data(G_OBJECT(menu), "parent-node", AsVoid(parent)); 204 g_object_set_data(G_OBJECT(menu), "parent-node", AsVoid(parent));
205 gtk_menu_shell_append(GTK_MENU_SHELL(menu), empty_menu); 205 gtk_menu_shell_append(GTK_MENU_SHELL(menu), empty_menu);
206 } 206 }
207 } 207 }
208 208
209 gboolean BookmarkMenuController::OnMenuButtonPressedOrReleased( 209 gboolean BookmarkMenuController::OnMenuButtonPressedOrReleased(
210 GtkWidget* sender, 210 GtkWidget* sender,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 void BookmarkMenuController::OnMenuItemDragGet( 365 void BookmarkMenuController::OnMenuItemDragGet(
366 GtkWidget* widget, GdkDragContext* context, 366 GtkWidget* widget, GdkDragContext* context,
367 GtkSelectionData* selection_data, 367 GtkSelectionData* selection_data,
368 guint target_type, guint time) { 368 guint target_type, guint time) {
369 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget); 369 const BookmarkNode* node = bookmark_utils::BookmarkNodeForWidget(widget);
370 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type, 370 bookmark_utils::WriteBookmarkToSelection(node, selection_data, target_type,
371 profile_); 371 profile_);
372 } 372 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698