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

Side by Side Diff: chrome/browser/gtk/bookmark_bar_gtk.cc

Issue 463056: GTK: hook up drag and drop of browser actions (for reordering).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/gtk/bookmark_bar_gtk.h" 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/gfx/gtk_util.h" 9 #include "app/gfx/gtk_util.h"
10 #include "app/gfx/canvas_paint.h" 10 #include "app/gfx/canvas_paint.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 g_signal_connect(instructions_, "drag-data-received", 228 g_signal_connect(instructions_, "drag-data-received",
229 G_CALLBACK(&OnDragReceived), this); 229 G_CALLBACK(&OnDragReceived), this);
230 230
231 g_signal_connect(event_box_.get(), "expose-event", 231 g_signal_connect(event_box_.get(), "expose-event",
232 G_CALLBACK(&OnEventBoxExpose), this); 232 G_CALLBACK(&OnEventBoxExpose), this);
233 UpdateEventBoxPaintability(); 233 UpdateEventBoxPaintability();
234 234
235 bookmark_toolbar_.Own(gtk_toolbar_new()); 235 bookmark_toolbar_.Own(gtk_toolbar_new());
236 SetToolBarStyle(); 236 SetToolBarStyle();
237 gtk_widget_set_name(bookmark_toolbar_.get(), "chrome-bookmark-toolbar"); 237 gtk_widget_set_name(bookmark_toolbar_.get(), "chrome-bookmark-toolbar");
238 gtk_widget_set_app_paintable(bookmark_toolbar_.get(), TRUE); 238 gtk_util::SuppressDefaultPainting(bookmark_toolbar_.get());
239 g_signal_connect(bookmark_toolbar_.get(), "expose-event",
240 G_CALLBACK(&OnToolbarExpose), this);
241 g_signal_connect(bookmark_toolbar_.get(), "size-allocate", 239 g_signal_connect(bookmark_toolbar_.get(), "size-allocate",
242 G_CALLBACK(&OnToolbarSizeAllocate), this); 240 G_CALLBACK(&OnToolbarSizeAllocate), this);
243 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), bookmark_toolbar_.get(), 241 gtk_box_pack_start(GTK_BOX(bookmark_hbox_), bookmark_toolbar_.get(),
244 TRUE, TRUE, 0); 242 TRUE, TRUE, 0);
245 243
246 overflow_button_ = theme_provider_->BuildChromeButton(); 244 overflow_button_ = theme_provider_->BuildChromeButton();
247 g_object_set_data(G_OBJECT(overflow_button_), "left-align-popup", 245 g_object_set_data(G_OBJECT(overflow_button_), "left-align-popup",
248 reinterpret_cast<void*>(true)); 246 reinterpret_cast<void*>(true));
249 SetOverflowButtonAppearance(); 247 SetOverflowButtonAppearance();
250 ConnectFolderButtonEvents(overflow_button_); 248 ConnectFolderButtonEvents(overflow_button_);
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 bar->profile_); 965 bar->profile_);
968 } 966 }
969 967
970 // static 968 // static
971 void BookmarkBarGtk::OnFolderClicked(GtkWidget* sender, 969 void BookmarkBarGtk::OnFolderClicked(GtkWidget* sender,
972 BookmarkBarGtk* bar) { 970 BookmarkBarGtk* bar) {
973 bar->PopupForButton(sender); 971 bar->PopupForButton(sender);
974 } 972 }
975 973
976 // static 974 // static
977 gboolean BookmarkBarGtk::OnToolbarExpose(GtkWidget* widget,
978 GdkEventExpose* event,
979 BookmarkBarGtk* bar) {
980 // A GtkToolbar's expose handler first draws a box. We don't want that so we
981 // need to propagate the expose event to all the container's children.
982 GList* children = gtk_container_get_children(GTK_CONTAINER(widget));
983 for (GList* item = children; item; item = item->next) {
984 gtk_container_propagate_expose(GTK_CONTAINER(widget),
985 GTK_WIDGET(item->data),
986 event);
987 }
988 g_list_free(children);
989
990 return TRUE;
991 }
992
993 // static
994 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkToolbar* toolbar, 975 gboolean BookmarkBarGtk::OnToolbarDragMotion(GtkToolbar* toolbar,
995 GdkDragContext* context, 976 GdkDragContext* context,
996 gint x, 977 gint x,
997 gint y, 978 gint y,
998 guint time, 979 guint time,
999 BookmarkBarGtk* bar) { 980 BookmarkBarGtk* bar) {
1000 GdkAtom target_type = 981 GdkAtom target_type =
1001 gtk_drag_dest_find_target(GTK_WIDGET(toolbar), context, NULL); 982 gtk_drag_dest_find_target(GTK_WIDGET(toolbar), context, NULL);
1002 if (target_type == GDK_NONE) { 983 if (target_type == GDK_NONE) {
1003 // We shouldn't act like a drop target when something that we can't deal 984 // We shouldn't act like a drop target when something that we can't deal
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 string16 link_text; 1304 string16 link_text;
1324 sync_ui_util::MessageType sync_status; 1305 sync_ui_util::MessageType sync_status;
1325 sync_status = sync_ui_util::GetStatusLabels( 1306 sync_status = sync_ui_util::GetStatusLabels(
1326 sync_service_, &status_text, &link_text); 1307 sync_service_, &status_text, &link_text);
1327 if (sync_status == sync_ui_util::SYNC_ERROR) { 1308 if (sync_status == sync_ui_util::SYNC_ERROR) {
1328 show_sync_error_button = true; 1309 show_sync_error_button = true;
1329 } 1310 }
1330 } 1311 }
1331 return show_sync_error_button; 1312 return show_sync_error_button;
1332 } 1313 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698