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

Issue 149307: GTK: Allow user to drag onto folder in bookmark bar.... (Closed)

Created:
11 years, 5 months ago by Evan Stade
Modified:
9 years, 6 months ago
Reviewers:
Elliot Glaysher
CC:
chromium-reviews_googlegroups.com, Ben Goodger (Google)
Visibility:
Public.

Description

GTK: Allow user to drag onto folder in bookmark bar. This is only half of the bug fix. We also should match windows in that a drag held over a folder for more than a second or so shows the folder's contents and allows the user to continue the drag into the folder. Also, it's kind of hard to use this new feature since the bookmark items float around when you are dragging out of the same bookmark bar you're dragging into, but the fix for that would be separate (and would require some design decisions). BUG=14222 TEST=drag single or multiple bookmarks onto a bookmark bar folder Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=20186

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -1 line) Patch
M chrome/browser/gtk/bookmark_bar_gtk.h View 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/gtk/bookmark_bar_gtk.cc View 2 chunks +31 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
Evan Stade
11 years, 5 months ago (2009-07-08 02:32:41 UTC) #1
Elliot Glaysher
11 years, 5 months ago (2009-07-08 16:35:47 UTC) #2
LGTM.

On Tue, Jul 7, 2009 at 7:32 PM, <estade@chromium.org> wrote:
> Reviewers: Elliot Glaysher,
>
> Description:
> GTK: Allow user to drag onto folder in bookmark bar.
>
> This is only half of the bug fix. We also should match windows in that a
> drag held over a folder for more than a second or so shows the folder's
> contents and allows the user to continue the drag into the folder.
>
> Also, it's kind of hard to use this new feature since the bookmark items
> float around when you are dragging out of the same bookmark bar you're
> dragging into, but the fix for that would be separate (and would require
> some design decisions).
>
> BUG=3D15884
> TEST=3Ddrag single or multiple bookmarks onto a bookmark bar folder
>
>
> Please review this at http://codereview.chromium.org/149307
>
> SVN Base: svn://chrome-svn/chrome/trunk/src/
>
> Affected files:
> =A0M =A0 =A0 chrome/browser/gtk/bookmark_bar_gtk.h
> =A0M =A0 =A0 chrome/browser/gtk/bookmark_bar_gtk.cc
>
>
> Index: chrome/browser/gtk/bookmark_bar_gtk.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- chrome/browser/gtk/bookmark_bar_gtk.h =A0 =A0 =A0 (revision 20108)
> +++ chrome/browser/gtk/bookmark_bar_gtk.h =A0 =A0 =A0 (working copy)
> @@ -120,7 +120,6 @@
> =A0 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0const BookmarkNode* node);
>
> - private:
> =A0 GtkWidget* CreateBookmarkButton(const BookmarkNode* node);
> =A0 GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node);
>
> @@ -158,6 +157,12 @@
> =A0 static gboolean OnFolderButtonReleased(GtkWidget* sender,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0GdkEventButton* event,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0BookmarkBarGtk* bar);
> + =A0static void OnFolderDragReceived(GtkWidget* widget,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Gdk=
DragContext* context,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gin=
t x, gint y,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Gtk=
SelectionData* selection_data,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gui=
nt target_type, guint time,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Boo=
kmarkBarGtk* bar);
>
> =A0 // GtkToolbar callbacks
> =A0 static gboolean OnToolbarExpose(GtkWidget* widget, GdkEventExpose* ev=
ent,
> Index: chrome/browser/gtk/bookmark_bar_gtk.cc
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- chrome/browser/gtk/bookmark_bar_gtk.cc =A0 =A0 =A0(revision 20108)
> +++ chrome/browser/gtk/bookmark_bar_gtk.cc =A0 =A0 =A0(working copy)
> @@ -440,6 +440,12 @@
> =A0}
>
> =A0void BookmarkBarGtk::ConnectFolderButtonEvents(GtkWidget* widget) {
> + =A0gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_ALL, NULL, 0,
> GDK_ACTION_MOVE);
> + =A0GtkDndUtil::SetDestTargetListFromCodeMask(widget,
> +
> =A0GtkDndUtil::X_CHROME_BOOKMARK_ITEM);
> + =A0g_signal_connect(widget, "drag-data-received",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 G_CALLBACK(&OnFolderDragReceived), =
this);
> +
> =A0 // Connect to 'button-release-event' instead of 'clicked' because we =
need
> =A0 // access to the modifier keys and we do different things on each
> =A0 // button.
> @@ -646,6 +652,31 @@
> =A0}
>
> =A0// static
> +void BookmarkBarGtk::OnFolderDragReceived(GtkWidget* widget,
> + =A0 =A0GdkDragContext* context, gint x, gint y, GtkSelectionData*
> selection_data,
> + =A0 =A0guint target_type, guint time, BookmarkBarGtk* bar) {
> + =A0gboolean dnd_success =3D FALSE;
> + =A0gboolean delete_selection_data =3D FALSE;
> +
> + =A0const BookmarkNode* dest_node =3D bar->GetNodeForToolButton(widget);
> + =A0DCHECK(dest_node->is_folder());
> + =A0std::vector<const BookmarkNode*> nodes =3D
> + =A0 =A0 =A0bookmark_utils::GetNodesFromSelection(context, selection_dat=
a,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0target_type,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0bar->profile_,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0&delete_selection_data,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0&dnd_success);
> + =A0DCHECK(!nodes.empty());
> +
> + =A0for (std::vector<const BookmarkNode*>::iterator it =3D nodes.begin()=
;
> + =A0 =A0 =A0 it !=3D nodes.end(); ++it) {
> + =A0 =A0bar->model_->Move(*it, dest_node, dest_node->GetChildCount());
> + =A0}
> +
> + =A0gtk_drag_finish(context, dnd_success, delete_selection_data, time);
> +}
> +
> +// static
> =A0gboolean BookmarkBarGtk::OnToolbarExpose(GtkWidget* widget,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0GdkEventExpose* event,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0BookmarkBarGtk* bar) {
>
>
>

Powered by Google App Engine
This is Rietveld 408576698