aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-view.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 9022e5095..2f4c0d376 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -81,6 +81,12 @@ typedef struct
guint expand_groups_idle_handler;
/* owned string (group name) -> bool (whether to expand/contract) */
GHashTable *expand_groups;
+
+ /* Auto scroll */
+ guint timeout_id;
+ /* Distance between mouse pointer and the nearby border. Negative when
+ scrolling updards.*/
+ gint distance;
} EmpathyIndividualViewPriv;
typedef struct
@@ -93,15 +99,6 @@ typedef struct
typedef struct
{
EmpathyIndividualView *view;
- guint timeout_id;
- /* Distance between mouse pointer and the nearby border. Negative when
- scrolling updards.*/
- gint distance;
-} AutoScrollData;
-
-typedef struct
-{
- EmpathyIndividualView *view;
FolksIndividual *individual;
gboolean remove;
} ShowActiveData;
@@ -565,14 +562,15 @@ individual_view_drag_motion_cb (DragMotionData *data)
#define AUTO_SCROLL_PITCH 10
static gboolean
-individual_view_auto_scroll_cb (AutoScrollData *data)
+individual_view_auto_scroll_cb (EmpathyIndividualView *self)
{
+ EmpathyIndividualViewPriv *priv = GET_PRIV (self);
GtkAdjustment *adj;
gdouble new_value;
- adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (data->view));
+ adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (self));
- if (data->distance < 0)
+ if (priv->distance < 0)
new_value = gtk_adjustment_get_value (adj) - AUTO_SCROLL_PITCH;
else
new_value = gtk_adjustment_get_value (adj) + AUTO_SCROLL_PITCH;
@@ -597,7 +595,6 @@ individual_view_drag_motion (GtkWidget *widget,
GdkAtom target;
GtkTreeIter iter;
static DragMotionData *dm = NULL;
- static AutoScrollData as;
GtkTreePath *path;
gboolean is_row;
gboolean is_different = FALSE;
@@ -608,11 +605,12 @@ individual_view_drag_motion (GtkWidget *widget,
priv = GET_PRIV (EMPATHY_INDIVIDUAL_VIEW (widget));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
- if (!as.view)
- as.view = EMPATHY_INDIVIDUAL_VIEW (widget);
- if (as.timeout_id)
- g_source_remove (as.timeout_id);
+ if (priv->timeout_id != 0)
+ {
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = 0;
+ }
gtk_widget_get_allocation (widget, &allocation);
@@ -620,12 +618,12 @@ individual_view_drag_motion (GtkWidget *widget,
y > (allocation.height - AUTO_SCROLL_MARGIN_SIZE))
{
if (y < AUTO_SCROLL_MARGIN_SIZE)
- as.distance = MIN (-y, -1);
+ priv->distance = MIN (-y, -1);
else
- as.distance = MAX (allocation.height - y, 1);
+ priv->distance = MAX (allocation.height - y, 1);
- as.timeout_id = g_timeout_add (10 * ABS (as.distance),
- (GSourceFunc) individual_view_auto_scroll_cb, &as);
+ priv->timeout_id = g_timeout_add (10 * ABS (priv->distance),
+ (GSourceFunc) individual_view_auto_scroll_cb, widget);
}
is_row = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),