GNOME Bugzilla – Bug 619858
contacts list should autoscroll when drag-n-dropping
Last modified: 2010-10-28 13:14:05 UTC
Drag-n-dropping contacts is a fast way to move contacts, but it's impossible when the groups contain many contacts: other groups are not visible. Contacts list should scroll when dragging close to the top or bottom of the list.
Good point.
Fixed in repo: git://vminko.org/empathy branch: fix-619858
Created attachment 173270 [details] [review] proposed fix
Review of attachment 173270 [details] [review]: Thanks for the patch. Did you look how other applications do the same thing? Evolution, liferea... ::: empathy-2.32.0.1/libempathy-gtk/empathy-individual-view.c @@ +95,3 @@ EmpathyIndividualView *view; + guint timeout_id; + gint distance; some doc about the semantic of distance would be good. @@ +559,3 @@ + +#define AUTO_SCROLL_MARGIN_SIZE 20 +#define AUTO_SCROLL_PITCH 10 can you please document these constants? @@ +567,3 @@ + gdouble new_value; + + adj = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (data->view)); This API has been deprecated in GTK3, you should use gtk_scrollable_get_vadjustment(). @@ +593,3 @@ GtkTreeIter iter; static DragMotionData *dm = NULL; + static AutoScrollData *as = NULL; As it's static, there is no need to allocate it dynamically. That would save us the memory allocation/free.
Fixed in fix-619858-v2. >Did you look how other applications do the same thing? Evolution, liferea... Liferea uses the native GTK autoscroll feature, but we have to implement this manually since we override drag_motion: widget_class->drag_motion = individual_view_drag_motion; >This API has been deprecated in GTK3, you should use gtk_scrollable_get_vadjustment(). Fixed, but I haven't tested this, because I use a stable version.
Created attachment 173346 [details] [review] updated patch
Created attachment 173347 [details] [review] updated patch
Review of attachment 173347 [details] [review]: Thanks for the fixes. I'll do these changes myself as you don't have a working GTK3 to test. ::: libempathy-gtk/empathy-individual-view.c @@ +571,3 @@ + gdouble new_value; + + adj = gtk_scrollable_get_vadjustment (GTK_TREE_VIEW (data->view)); this should be casted to a GTK_SCROLLABLE @@ +574,3 @@ + + if (data->distance < 0) + new_value = adj->value - AUTO_SCROLL_PITCH; we should use accessors, we can't do that any more with GTK3. @@ +597,3 @@ GtkTreeIter iter; static DragMotionData *dm = NULL; + static AutoScrollData as; You are suppose to init status variables. Just do the assignation here, it will be done just the first time as the var is static.
Created attachment 173392 [details] [review] http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/scroll-619858 libempathy-gtk/empathy-individual-view.c | 56 ++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
Can you take a look on this branch please? I completely removed AutoScrollData, it makes code clearer.
Looks good for me.
Merged to master; thanks ! This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.