Merge lp:~cimi/overlay-scrollbar/different-thumb-source-handling into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Mirco Müller
Approved revision: 212
Merged at revision: 212
Proposed branch: lp:~cimi/overlay-scrollbar/different-thumb-source-handling
Merge into: lp:overlay-scrollbar
Diff against target: 110 lines (+28/-32)
1 file modified
os/os-thumb.c (+28/-32)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/different-thumb-source-handling
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+57868@code.launchpad.net

Description of the change

changed approach to the source handling

To post a comment you must log in.
213. By Andrea Cimitan

stop the animation *after* calling g_source_remove

Revision history for this message
Mirco Müller (macslow) wrote :

Looking ok, sofar from my side. Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'os/os-thumb.c'
2--- os/os-thumb.c 2011-04-13 14:59:14 +0000
3+++ os/os-thumb.c 2011-04-20 14:54:17 +0000
4@@ -118,12 +118,7 @@
5 if (weight < 1.0f)
6 gtk_window_set_opacity (GTK_WINDOW (thumb), fabs (weight - 1.0f));
7 else
8- {
9- /* Animation ended. */
10- priv->source_id = 0;
11-
12- gtk_widget_hide (GTK_WIDGET (thumb));
13- }
14+ gtk_widget_hide (GTK_WIDGET (thumb));
15 }
16
17 static gboolean
18@@ -137,6 +132,7 @@
19 priv = thumb->priv;
20
21 os_animation_start (priv->animation);
22+ priv->source_id = 0;
23
24 return FALSE;
25 }
26@@ -261,16 +257,16 @@
27 thumb = OS_THUMB (widget);
28 priv = thumb->priv;
29
30+ if (priv->source_id != 0)
31+ {
32+ g_source_remove (priv->source_id);
33+ priv->source_id = 0;
34+ }
35+
36 /* Stop the animation on user interaction,
37 * the button_press_event. */
38- if (priv->source_id != 0)
39- {
40- g_source_remove (priv->source_id);
41- priv->source_id = 0;
42-
43- os_animation_stop (priv->animation);
44- gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
45- }
46+ os_animation_stop (priv->animation);
47+ gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
48
49 if (event->type == GDK_BUTTON_PRESS)
50 {
51@@ -575,9 +571,9 @@
52 {
53 g_source_remove (priv->source_id);
54 priv->source_id = 0;
55-
56- os_animation_stop (priv->animation);
57 }
58+
59+ os_animation_stop (priv->animation);
60 }
61
62 priv->use_tolerance = FALSE;
63@@ -621,15 +617,15 @@
64 thumb = OS_THUMB (widget);
65 priv = thumb->priv;
66
67+ if (priv->source_id != 0)
68+ {
69+ g_source_remove (priv->source_id);
70+ priv->source_id = 0;
71+ }
72+
73 /* On motion, stop the fade-out. */
74- if (priv->source_id != 0)
75- {
76- g_source_remove (priv->source_id);
77- priv->source_id = 0;
78-
79- os_animation_stop (priv->animation);
80- gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
81- }
82+ os_animation_stop (priv->animation);
83+ gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
84
85 /* If you're not dragging, and you're outside
86 * the tolerance pixels, enable the fade-out.
87@@ -683,15 +679,15 @@
88 thumb = OS_THUMB (widget);
89 priv = thumb->priv;
90
91+ if (priv->source_id != 0)
92+ {
93+ g_source_remove (priv->source_id);
94+ priv->source_id = 0;
95+ }
96+
97 /* if started, stop the fade-out. */
98- if (priv->source_id != 0)
99- {
100- g_source_remove (priv->source_id);
101- priv->source_id = 0;
102-
103- os_animation_stop (priv->animation);
104- gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
105- }
106+ os_animation_stop (priv->animation);
107+ gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
108
109 priv->source_id = g_timeout_add (TIMEOUT_FADE_OUT,
110 os_thumb_timeout_fade_out_cb,

Subscribers

People subscribed via source and target branches