[gnome-dictionary] Use g_timeout_add_seconds() for multi-second timeouts



commit 597ff92a28f42ed187adc9727d91cef2e226a383
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Nov 2 11:22:25 2014 +0000

    Use g_timeout_add_seconds() for multi-second timeouts
    
    Based on a patch by: Matthias Clasen <mclasen redhat com>

 libgdict/gdict-client-context.c |    8 ++++----
 libgdict/gdict-defbox.c         |   10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/libgdict/gdict-client-context.c b/libgdict/gdict-client-context.c
index 62a57da..ef8e65b 100644
--- a/libgdict/gdict-client-context.c
+++ b/libgdict/gdict-client-context.c
@@ -135,7 +135,7 @@ typedef struct
 #define HOSTNAME_LOOKUP_EXPIRE         300
 
 /* wait 30 seconds between connection and receiving data on the line */
-#define CONNECTION_TIMEOUT      30
+#define CONNECTION_TIMEOUT_SEC  30
 
 enum
 {
@@ -1989,9 +1989,9 @@ gdict_client_context_connect (GdictClientContext  *context,
       return FALSE;
     }
 
-  priv->timeout_id = g_timeout_add (CONNECTION_TIMEOUT * 1000,
-                                    check_for_connection,
-                                    context);
+  priv->timeout_id = g_timeout_add_seconds (CONNECTION_TIMEOUT_SEC,
+                                            check_for_connection,
+                                            context);
   
   /* XXX - remember that g_io_add_watch() increases the reference count
    * of the GIOChannel we are using.
diff --git a/libgdict/gdict-defbox.c b/libgdict/gdict-defbox.c
index ea46962..1f373a7 100644
--- a/libgdict/gdict-defbox.c
+++ b/libgdict/gdict-defbox.c
@@ -1133,7 +1133,7 @@ find_prev_clicked_cb (GtkWidget *widget,
   if (priv->hide_timeout)
     {
       g_source_remove (priv->hide_timeout);
-      priv->hide_timeout = g_timeout_add (5000, hide_find_pane, defbox);
+      priv->hide_timeout = g_timeout_add_seconds (5, hide_find_pane, defbox);
     }
 }
 
@@ -1227,7 +1227,7 @@ find_next_clicked_cb (GtkWidget *widget,
   if (priv->hide_timeout)
     {
       g_source_remove (priv->hide_timeout);
-      priv->hide_timeout = g_timeout_add (5000, hide_find_pane, defbox);
+      priv->hide_timeout = g_timeout_add_seconds (5, hide_find_pane, defbox);
     }
 }
 
@@ -1263,7 +1263,7 @@ find_entry_changed_cb (GtkWidget *widget,
   if (priv->hide_timeout)
     {
       g_source_remove (priv->hide_timeout);
-      priv->hide_timeout = g_timeout_add (5000, hide_find_pane, defbox);
+      priv->hide_timeout = g_timeout_add_seconds (5, hide_find_pane, defbox);
     }
 }
 
@@ -1726,7 +1726,7 @@ gdict_defbox_real_show_find (GdictDefbox *defbox)
   
   gtk_widget_grab_focus (defbox->priv->find_entry);
 
-  defbox->priv->hide_timeout = g_timeout_add (5000, hide_find_pane, defbox);
+  defbox->priv->hide_timeout = g_timeout_add_seconds (5, hide_find_pane, defbox);
 }
 
 static void
@@ -2098,7 +2098,7 @@ gdict_defbox_set_show_find (GdictDefbox *defbox,
       gtk_widget_grab_focus (priv->find_entry);
 
       if (!priv->hide_timeout)
-        priv->hide_timeout = g_timeout_add (5000, hide_find_pane, defbox);
+        priv->hide_timeout = g_timeout_add_seconds (5, hide_find_pane, defbox);
     }
   else
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]