[Spice-devel] [PATCH spice-gtk 1/4] main: rename timer id

Marc-André Lureau marcandre.lureau at redhat.com
Thu Apr 2 14:25:42 PDT 2015


Give it a more descriptive name
---
 gtk/channel-main.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 82169aa..3150208 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -100,7 +100,7 @@ struct _SpiceMainChannelPrivate  {
         gboolean                enabled;
         gboolean                enabled_set;
     } display[MAX_DISPLAY];
-    gint                        timer_id;
+    gint                        display_timer_id;
     GQueue                      *agent_msg_queue;
     GHashTable                  *file_xfer_tasks;
     GSList                      *flushing;
@@ -331,9 +331,9 @@ static void spice_main_channel_dispose(GObject *obj)
 {
     SpiceMainChannelPrivate *c = SPICE_MAIN_CHANNEL(obj)->priv;
 
-    if (c->timer_id) {
-        g_source_remove(c->timer_id);
-        c->timer_id = 0;
+    if (c->display_timer_id > 0) {
+        g_source_remove(c->display_timer_id);
+        c->display_timer_id = 0;
     }
 
     if (c->switch_host_delayed_id) {
@@ -1084,9 +1084,9 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
     g_free(mon);
 
     spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
-    if (c->timer_id != 0) {
-        g_source_remove(c->timer_id);
-        c->timer_id = 0;
+    if (c->display_timer_id > 0) {
+        g_source_remove(c->display_timer_id);
+        c->display_timer_id = 0;
     }
 
     return TRUE;
@@ -1290,7 +1290,6 @@ static gboolean timer_set_display(gpointer data)
     SpiceSession *session;
     gint i;
 
-    c->timer_id = 0;
     if (!c->agent_connected)
         return FALSE;
 
@@ -1314,10 +1313,10 @@ static void update_display_timer(SpiceMainChannel *channel, guint seconds)
 {
     SpiceMainChannelPrivate *c = channel->priv;
 
-    if (c->timer_id)
-        g_source_remove(c->timer_id);
+    if (c->display_timer_id > 0)
+        g_source_remove(c->display_timer_id);
 
-    c->timer_id = g_timeout_add_seconds(seconds, timer_set_display, channel);
+    c->display_timer_id = g_timeout_add_seconds(seconds, timer_set_display, channel);
 }
 
 /* coroutine context  */
-- 
2.1.0



More information about the Spice-devel mailing list