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

Unified Diff: chrome/browser/gtk/bookmark_bar_gtk.cc

Issue 149307: GTK: Allow user to drag onto folder in bookmark bar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_bar_gtk.cc
===================================================================
--- chrome/browser/gtk/bookmark_bar_gtk.cc (revision 20108)
+++ chrome/browser/gtk/bookmark_bar_gtk.cc (working copy)
@@ -440,6 +440,12 @@
}
void BookmarkBarGtk::ConnectFolderButtonEvents(GtkWidget* widget) {
+ gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_MOVE);
+ GtkDndUtil::SetDestTargetListFromCodeMask(widget,
+ GtkDndUtil::X_CHROME_BOOKMARK_ITEM);
+ g_signal_connect(widget, "drag-data-received",
+ G_CALLBACK(&OnFolderDragReceived), this);
+
// Connect to 'button-release-event' instead of 'clicked' because we need
// access to the modifier keys and we do different things on each
// button.
@@ -646,6 +652,31 @@
}
// static
+void BookmarkBarGtk::OnFolderDragReceived(GtkWidget* widget,
+ GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data,
+ guint target_type, guint time, BookmarkBarGtk* bar) {
+ gboolean dnd_success = FALSE;
+ gboolean delete_selection_data = FALSE;
+
+ const BookmarkNode* dest_node = bar->GetNodeForToolButton(widget);
+ DCHECK(dest_node->is_folder());
+ std::vector<const BookmarkNode*> nodes =
+ bookmark_utils::GetNodesFromSelection(context, selection_data,
+ target_type,
+ bar->profile_,
+ &delete_selection_data,
+ &dnd_success);
+ DCHECK(!nodes.empty());
+
+ for (std::vector<const BookmarkNode*>::iterator it = nodes.begin();
+ it != nodes.end(); ++it) {
+ bar->model_->Move(*it, dest_node, dest_node->GetChildCount());
+ }
+
+ gtk_drag_finish(context, dnd_success, delete_selection_data, time);
+}
+
+// static
gboolean BookmarkBarGtk::OnToolbarExpose(GtkWidget* widget,
GdkEventExpose* event,
BookmarkBarGtk* bar) {
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698