From 6e72a236dcb592a942881e118d6a71888ea1581b Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 4 May 2009 10:10:55 +0530 Subject: ** BUGFIX: 573830 - g_timeout_add_seconds should be preferred to g_timeout_add According to https://wiki.ubuntu.com/SavingTheWorld (and of course according to the gtk docs) using g_timeout_add_seconds is preferred over g_timeout_add if a timeout in seconds is desired. --- calendar/gui/alarm-notify/alarm-queue.c | 2 +- calendar/gui/alarm-notify/alarm.c | 2 +- calendar/gui/e-meeting-time-sel.c | 4 ++-- composer/e-composer-autosave.c | 4 ++-- e-util/e-logger.c | 4 ++-- e-util/gconf-bridge.c | 6 +++--- mail/em-folder-tree.c | 2 +- mail/mail-folder-cache.c | 4 ++-- mail/mail-send-recv.c | 2 +- plugins/bbdb/bbdb.c | 2 +- plugins/bbdb/bbdb.h | 2 +- plugins/publish-calendar/publish-calendar.c | 8 ++++---- shell/e-shell-nm.c | 2 +- shell/e-shell-window.c | 2 +- widgets/table/e-table-search.c | 2 +- widgets/text/e-text.c | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 1ec93f8df1..f3167d813c 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -1864,7 +1864,7 @@ alarm_queue_init (gpointer data) } /* install timeout handler (every 30 mins) for not missing the midnight refresh */ - g_timeout_add (1800000, (GSourceFunc) check_midnight_refresh, NULL); + g_timeout_add_seconds (1800, (GSourceFunc) check_midnight_refresh, NULL); #ifdef HAVE_LIBNOTIFY notify_init("Evolution Alarms"); diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index bf96f1f664..5dca49ae25 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -153,7 +153,7 @@ setup_timeout (void) g_message ("Setting timeout for %d %lu %lu", diff, ar->trigger, now); g_message (" %s", ctime (&ar->trigger)); g_message (" %s", ctime (&now)); - timeout_id = g_timeout_add (diff * 1000, alarm_ready_cb, NULL); + timeout_id = g_timeout_add_seconds (diff, alarm_ready_cb, NULL); } diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index a106a46d49..25c8a86b97 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -2918,7 +2918,7 @@ row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data) } -#define REFRESH_PAUSE 5000 +#define REFRESH_PAUSE 5 static gboolean free_busy_timeout_refresh (gpointer data) @@ -2952,7 +2952,7 @@ free_busy_template_changed_cb (GConfClient *client, g_source_remove (mts->fb_refresh_not); } - mts->fb_refresh_not = g_timeout_add (REFRESH_PAUSE, + mts->fb_refresh_not = g_timeout_add_seconds (REFRESH_PAUSE, free_busy_timeout_refresh, data); } diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c index 78b8134941..842deae9c9 100644 --- a/composer/e-composer-autosave.c +++ b/composer/e-composer-autosave.c @@ -28,7 +28,7 @@ #define AUTOSAVE_PREFIX ".evolution-composer.autosave" #define AUTOSAVE_SEED AUTOSAVE_PREFIX "-XXXXXX" -#define AUTOSAVE_INTERVAL 60000 /* 60 seconds */ +#define AUTOSAVE_INTERVAL 60 /* 60 seconds */ typedef struct _AutosaveState AutosaveState; @@ -222,7 +222,7 @@ e_composer_autosave_register (EMsgComposer *composer) composer_autosave_notify, NULL); if (autosave_source_id == 0) - autosave_source_id = g_timeout_add ( + autosave_source_id = g_timeout_add_seconds ( AUTOSAVE_INTERVAL, (GSourceFunc) composer_autosave_timeout, NULL); } diff --git a/e-util/e-logger.c b/e-util/e-logger.c index 9db0ca0e37..0a458b7444 100644 --- a/e-util/e-logger.c +++ b/e-util/e-logger.c @@ -36,7 +36,7 @@ #include "e-mktemp.h" /* 5 Minutes */ -#define TIMEOUT_INTERVAL 300000 +#define TIMEOUT_INTERVAL 300 #define E_LOGGER_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -219,7 +219,7 @@ set_dirty (ELogger *logger) if (logger->priv->timer) return; - logger->priv->timer = g_timeout_add ( + logger->priv->timer = g_timeout_add_seconds ( TIMEOUT_INTERVAL, (GSourceFunc) flush_logfile, logger); } diff --git a/e-util/gconf-bridge.c b/e-util/gconf-bridge.c index 66dcbc7ea2..81fe08ef14 100644 --- a/e-util/gconf-bridge.c +++ b/e-util/gconf-bridge.c @@ -645,8 +645,8 @@ window_binding_perform_scheduled_sync (WindowBinding *binding) return FALSE; } -#define WINDOW_BINDING_SYNC_DELAY 1000 /* Delay before syncing new window - dimensions to GConf, in ms */ +#define WINDOW_BINDING_SYNC_DELAY 1 /* Delay before syncing new window + dimensions to GConf, in s */ /* Called when the window han been resized or moved */ static gboolean @@ -657,7 +657,7 @@ window_binding_configure_event_cb (GtkWindow *window, /* Schedule a sync */ if (binding->sync_timeout_id == 0) { binding->sync_timeout_id = - g_timeout_add (WINDOW_BINDING_SYNC_DELAY, + g_timeout_add_seconds (WINDOW_BINDING_SYNC_DELAY, (GSourceFunc) window_binding_perform_scheduled_sync, binding); diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index eebb15454c..e7063e9fed 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2641,5 +2641,5 @@ emft_queue_save_state (EMFolderTree *emft) if (priv->save_state_id != 0) return; - priv->save_state_id = g_timeout_add (1000, (GSourceFunc) emft_save_state, emft); + priv->save_state_id = g_timeout_add_seconds (1, (GSourceFunc) emft_save_state, emft); } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 165f5941c2..a1589cec79 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -936,8 +936,8 @@ mail_note_store(CamelStore *store, CamelOperation *op, count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL; count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL; buf = getenv ("EVOLUTION_PING_TIMEOUT"); - timeout = buf ? strtoul (buf, NULL, 10) * 1000 : 600000; - ping_id = g_timeout_add (timeout, ping_cb, NULL); + timeout = buf ? strtoul (buf, NULL, 10) : 600; + ping_id = g_timeout_add_seconds (timeout, ping_cb, NULL); } si = g_hash_table_lookup(stores, store); diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index d957a7d216..0b81fca5ed 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -1027,7 +1027,7 @@ auto_account_commit(struct _auto_data *info) } info->period = period; if (check && info->timeout_id == 0) - info->timeout_id = g_timeout_add(info->period*1000, auto_timeout, info); + info->timeout_id = g_timeout_add_seconds(info->period, auto_timeout, info); } static void diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index 547a779961..adc89dbcb2 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -115,7 +115,7 @@ e_plugin_lib_enable (EPluginLib *ep, int enable) if (bbdb_check_gaim_enabled ()) bbdb_sync_buddy_list_check (); - g_timeout_add (BBDB_BLIST_CHECK_INTERVAL, + g_timeout_add_seconds (BBDB_BLIST_CHECK_INTERVAL, (GSourceFunc) bbdb_timeout, NULL); } diff --git a/plugins/bbdb/bbdb.h b/plugins/bbdb/bbdb.h index e36a7737c3..55c88709b0 100644 --- a/plugins/bbdb/bbdb.h +++ b/plugins/bbdb/bbdb.h @@ -33,7 +33,7 @@ /* How often to poll the buddy list for changes (every two minutes) */ -#define BBDB_BLIST_CHECK_INTERVAL (2 * 60 * 1000) +#define BBDB_BLIST_CHECK_INTERVAL (2 * 60) /* bbdb.c */ EBook *bbdb_open_addressbook (int type); diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c index 4adbe0d726..a901317dfb 100644 --- a/plugins/publish-calendar/publish-calendar.c +++ b/plugins/publish-calendar/publish-calendar.c @@ -352,11 +352,11 @@ add_timeout (EPublishUri *uri) /* Set the timeout for now+frequency */ switch (uri->publish_frequency) { case URI_PUBLISH_DAILY: - id = g_timeout_add (24 * 60 * 60 * 1000, (GSourceFunc) publish_no_succ_info, uri); + id = g_timeout_add_seconds (24 * 60 * 60, (GSourceFunc) publish, uri); g_hash_table_insert (uri_timeouts, uri, GUINT_TO_POINTER (id)); break; case URI_PUBLISH_WEEKLY: - id = g_timeout_add (7 * 24 * 60 * 60 * 1000, (GSourceFunc) publish_no_succ_info, uri); + id = g_timeout_add_seconds (7 * 24 * 60 * 60, (GSourceFunc) publish, uri); g_hash_table_insert (uri_timeouts, uri, GUINT_TO_POINTER (id)); break; } @@ -419,7 +419,7 @@ add_offset_timeout (EPublishUri *uri) publish (uri, FALSE); add_timeout (uri); } else { - id = g_timeout_add (((24 * 60 * 60) - elapsed) * 1000, (GSourceFunc) publish_no_succ_info, uri); + id = g_timeout_add_seconds (24 * 60 * 60 - elapsed, (GSourceFunc) publish, uri); g_hash_table_insert (uri_timeouts, uri, GUINT_TO_POINTER (id)); break; } @@ -429,7 +429,7 @@ add_offset_timeout (EPublishUri *uri) publish (uri, FALSE); add_timeout (uri); } else { - id = g_timeout_add (((7 * 24 * 60 * 60) - elapsed) * 1000, (GSourceFunc) publish_no_succ_info, uri); + id = g_timeout_add_seconds (7 * 24 * 60 * 60 - elapsed, (GSourceFunc) publish, uri); g_hash_table_insert (uri_timeouts, uri, GUINT_TO_POINTER (id)); break; } diff --git a/shell/e-shell-nm.c b/shell/e-shell-nm.c index 5162aa5fea..f7e4d3e63b 100644 --- a/shell/e-shell-nm.c +++ b/shell/e-shell-nm.c @@ -71,7 +71,7 @@ e_shell_network_monitor (DBusConnection *connection G_GNUC_UNUSED, dbus_connection_unref (dbus_connection); dbus_connection = NULL; - g_timeout_add (3000, reinit_dbus, shell); + g_timeout_add_seconds (3, reinit_dbus, shell); return DBUS_HANDLER_RESULT_HANDLED; } diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 516df0cfdb..9d6905203b 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -924,7 +924,7 @@ impl_size_alloc (GtkWidget* widget, GtkAllocation* alloc) if (GTK_WIDGET_REALIZED(widget) && !(gdk_window_get_state(widget->window) & GDK_WINDOW_STATE_MAXIMIZED)) { /* update the size storage timer */ - self->priv->store_window_size_timer = g_timeout_add (1000, (GSourceFunc)store_window_size, self); + self->priv->store_window_size_timer = g_timeout_add_seconds (1, (GSourceFunc)store_window_size, self); } if (GTK_WIDGET_CLASS (e_shell_window_parent_class)->size_allocate) { diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c index 7a51b62f1c..307d28de39 100644 --- a/widgets/table/e-table-search.c +++ b/widgets/table/e-table-search.c @@ -100,7 +100,7 @@ static void add_timeout (ETableSearch *ets) { drop_timeout (ets); - ets->priv->timeout_id = g_timeout_add (1000, ets_accept, ets); + ets->priv->timeout_id = g_timeout_add_seconds (1, ets_accept, ets); } static void diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index f15317b01e..0890b46243 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -2460,7 +2460,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) { if ( text->tooltip_count == 0 && text->clip) { if (!text->tooltip_timeout) - text->tooltip_timeout = g_timeout_add (2000, _do_tooltip, text); + text->tooltip_timeout = g_timeout_add_seconds (2, _do_tooltip, text); } text->tooltip_count ++; } -- cgit v1.2.3