After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 619858 - contacts list should autoscroll when drag-n-dropping
contacts list should autoscroll when drag-n-dropping
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: Contact List
unspecified
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2010-05-27 18:37 UTC by Jussi Kukkonen
Modified: 2010-10-28 13:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (2.32 KB, patch)
2010-10-26 15:43 UTC, Vitaly Minko
reviewed Details | Review
updated patch (3.61 KB, patch)
2010-10-27 19:51 UTC, Vitaly Minko
none Details | Review
updated patch (2.70 KB, patch)
2010-10-27 19:53 UTC, Vitaly Minko
reviewed Details | Review
http://git.collabora.co.uk/?p=user/cassidy/empathy;a=shortlog;h=refs/heads/scroll-619858 (2.65 KB, patch)
2010-10-28 12:31 UTC, Guillaume Desmottes
none Details | Review

Description Jussi Kukkonen 2010-05-27 18:37:16 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.
Comment 1 Guillaume Desmottes 2010-05-28 07:43:10 UTC
Good point.
Comment 2 Vitaly Minko 2010-10-26 15:40:27 UTC
Fixed in
repo: git://vminko.org/empathy
branch: fix-619858
Comment 3 Vitaly Minko 2010-10-26 15:43:03 UTC
Created attachment 173270 [details] [review]
proposed fix
Comment 4 Guillaume Desmottes 2010-10-27 07:19:57 UTC
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.
Comment 5 Vitaly Minko 2010-10-27 19:50:34 UTC
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.
Comment 6 Vitaly Minko 2010-10-27 19:51:05 UTC
Created attachment 173346 [details] [review]
updated patch
Comment 7 Vitaly Minko 2010-10-27 19:53:03 UTC
Created attachment 173347 [details] [review]
updated patch
Comment 8 Guillaume Desmottes 2010-10-28 08:04:10 UTC
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.
Comment 9 Guillaume Desmottes 2010-10-28 12:31:09 UTC
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(-)
Comment 10 Guillaume Desmottes 2010-10-28 12:31:39 UTC
Can you take a look on this branch please? I completely removed AutoScrollData, it makes code clearer.
Comment 11 Vitaly Minko 2010-10-28 13:06:04 UTC
Looks good for me.
Comment 12 Guillaume Desmottes 2010-10-28 13:14:05 UTC
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.