[evolution] Bug 710797 - Name all the timeouts added with g_timeout_add()



commit bc0d5d40ed39c92dcdf62ae891a2e99c25237d74
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Oct 29 14:04:54 2013 -0400

    Bug 710797 - Name all the timeouts added with g_timeout_add()

 addressbook/gui/widgets/e-addressbook-model.c   |    6 +++-
 calendar/alarm-notify/alarm-queue.c             |   15 +++++++----
 calendar/alarm-notify/alarm.c                   |    3 +-
 calendar/gui/e-cal-model.c                      |    2 +-
 calendar/gui/e-day-view.c                       |   10 +++++--
 calendar/gui/e-meeting-time-sel.c               |    5 ++-
 calendar/gui/e-week-view.c                      |    8 ++++--
 calendar/gui/gnome-cal.c                        |   11 +++++---
 e-util/e-activity-bar.c                         |    8 +++---
 e-util/e-activity-proxy.c                       |    9 +++----
 e-util/e-alert.c                                |   12 ++++++---
 e-util/e-attachment.c                           |    9 ++++--
 e-util/e-calendar.c                             |   22 ++++++++--------
 e-util/e-canvas-utils.c                         |   12 ++++----
 e-util/e-canvas.c                               |    9 +++----
 e-util/e-cell-text.c                            |    3 +-
 e-util/e-cell-tree.c                            |    4 ++-
 e-util/e-map.c                                  |   12 ++++----
 e-util/e-misc-utils.c                           |    7 +++--
 e-util/e-name-selector-entry.c                  |   26 ++++++++++++++-----
 e-util/e-proxy-preferences.c                    |    2 +-
 e-util/e-table-header-item.c                    |    3 +-
 e-util/e-table-search.c                         |   15 ++++++-----
 e-util/e-table.c                                |    3 +-
 e-util/e-text.c                                 |   17 +++++++------
 e-util/e-timezone-dialog.c                      |    8 ++++--
 e-util/e-tree.c                                 |    6 +++-
 libemail-engine/mail-folder-cache.c             |    9 ++++--
 mail/e-mail-backend.c                           |   12 +++++----
 mail/e-mail-reader.c                            |   25 +++++++++++-------
 mail/em-folder-tree.c                           |   30 +++++++++++++----------
 mail/em-subscription-editor.c                   |   14 +++++++----
 mail/importers/elm-importer.c                   |    3 +-
 mail/importers/evolution-mbox-importer.c        |    3 +-
 mail/importers/pine-importer.c                  |    7 +++--
 mail/mail-send-recv.c                           |   14 ++++++----
 modules/backup-restore/evolution-backup-tool.c  |   13 ++++++----
 modules/calendar/e-task-shell-view-private.c    |   10 ++++---
 modules/composer-autosave/e-composer-autosave.c |   11 +++++---
 modules/mail/e-mail-shell-backend.c             |   12 ++++++---
 plugins/bbdb/bbdb.c                             |    6 +++-
 plugins/dbx-import/dbx-importer.c               |    4 +-
 plugins/mail-notification/mail-notification.c   |    2 +-
 plugins/pst-import/pst-importer.c               |    4 +-
 plugins/publish-calendar/publish-calendar.c     |   19 ++++++++++----
 shell/e-shell-view.c                            |    9 ++++--
 shell/killev.c                                  |    6 ++--
 47 files changed, 275 insertions(+), 185 deletions(-)
---
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 1cd1329..9f63ca0 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -821,9 +821,11 @@ e_addressbook_model_stop (EAddressbookModel *model)
        g_signal_emit (model, signals[STOP_STATE_CHANGED], 0);
        g_signal_emit (model, signals[STATUS_MESSAGE], 0, message, -1);
 
-       if (!model->priv->remove_status_id)
+       if (model->priv->remove_status_id == 0) {
                model->priv->remove_status_id =
-                       g_timeout_add_seconds (3, remove_status_cb, model);
+                       e_named_timeout_add_seconds (
+                       3, remove_status_cb, model);
+       }
 }
 
 gboolean
diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c
index d4c335f..0c3cf71 100644
--- a/calendar/alarm-notify/alarm-queue.c
+++ b/calendar/alarm-notify/alarm-queue.c
@@ -1774,7 +1774,8 @@ display_notification (time_t trigger,
        } else {
                if (tray_blink_id == -1) {
                        tray_blink_countdown = 30;
-                       tray_blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data);
+                       tray_blink_id = e_named_timeout_add (
+                               500, tray_icon_blink_cb, tray_data);
                }
        }
 }
@@ -2134,12 +2135,14 @@ alarm_queue_init (gpointer data)
                config_data_set_last_notification_time (NULL, tmval);
        }
 
-       /* install timeout handler (every 30 mins) for not missing the midnight refresh */
-       g_timeout_add_seconds (1800, check_midnight_refresh, NULL);
+       /* Install timeout handler (every 30 mins) for not missing the
+        * midnight refresh. */
+       e_named_timeout_add_seconds (1800, check_midnight_refresh, NULL);
 
-       /* monotonic time doesn't change during hibernation, while the wall clock time does,
-        * thus check for wall clock time changes and reschedule alarms when it changes */
-       g_timeout_add_seconds (60, check_wall_clock_time_changed, NULL);
+       /* Monotonic time doesn't change during hibernation, while the
+        * wall clock time does, thus check for wall clock time changes
+        * and reschedule alarms when it changes. */
+       e_named_timeout_add_seconds (60, check_wall_clock_time_changed, NULL);
 
 #ifdef HAVE_LIBNOTIFY
        notify_init (_("Evolution Reminders"));
diff --git a/calendar/alarm-notify/alarm.c b/calendar/alarm-notify/alarm.c
index 1c4f01a..77aae15 100644
--- a/calendar/alarm-notify/alarm.c
+++ b/calendar/alarm-notify/alarm.c
@@ -157,8 +157,7 @@ setup_timeout (void)
                diff / 60, diff % 60, (gint64) ar->trigger, (gint64) now));
        debug ((" %s", ctime (&ar->trigger)));
        debug ((" %s", ctime (&now)));
-       timeout_id = g_timeout_add_seconds (diff, alarm_ready_cb, NULL);
-
+       timeout_id = e_named_timeout_add_seconds (diff, alarm_ready_cb, NULL);
 }
 
 /* Used from g_list_insert_sorted(); compares the
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 02020ae..5748e23 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -3735,7 +3735,7 @@ redo_queries (ECalModel *model)
 
        if (!g_main_context_is_owner (g_main_context_default ())) {
                /* function called from other than main thread */
-               g_timeout_add (10, cleanup_content_cb, &data);
+               e_named_timeout_add (10, cleanup_content_cb, &data);
                e_flag_wait (data.eflag);
        } else {
                cleanup_content_cb (&data);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 65f3855..93f6640 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -7102,7 +7102,7 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
                        data->day = day;
                        data->event_num = event_num;
                        data->get_view_event = (ECalendarViewEvent * (*)(ECalendarView *, int, gint)) 
tooltip_get_view_event;
-                       pevent->timeout = g_timeout_add_full (
+                       pevent->timeout = e_named_timeout_add_full (
                                G_PRIORITY_DEFAULT, 500,
                                (GSourceFunc) e_calendar_view_get_tooltips,
                                data, (GDestroyNotify) g_free);
@@ -7773,7 +7773,9 @@ e_day_view_start_auto_scroll (EDayView *day_view,
                               gboolean scroll_up)
 {
        if (day_view->auto_scroll_timeout_id == 0) {
-               day_view->auto_scroll_timeout_id = g_timeout_add (E_DAY_VIEW_AUTO_SCROLL_TIMEOUT, 
e_day_view_auto_scroll_handler, day_view);
+               day_view->auto_scroll_timeout_id = e_named_timeout_add (
+                       E_DAY_VIEW_AUTO_SCROLL_TIMEOUT,
+                       e_day_view_auto_scroll_handler, day_view);
                day_view->auto_scroll_delay = E_DAY_VIEW_AUTO_SCROLL_DELAY;
        }
        day_view->auto_scroll_up = scroll_up;
@@ -9287,7 +9289,9 @@ static void
 e_day_view_queue_layout (EDayView *day_view)
 {
        if (day_view->layout_timeout_id == 0) {
-               day_view->layout_timeout_id = g_timeout_add (E_DAY_VIEW_LAYOUT_TIMEOUT, 
e_day_view_layout_timeout_cb, day_view);
+               day_view->layout_timeout_id = e_named_timeout_add (
+                       E_DAY_VIEW_LAYOUT_TIMEOUT,
+                       e_day_view_layout_timeout_cb, day_view);
        }
 }
 
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index e896abe..674059d 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -2721,7 +2721,8 @@ e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts,
        if (x < scroll_x || x > scroll_x + canvas_width) {
                /* If we haven't added a timeout function, add one. */
                if (mts->auto_scroll_timeout_id == 0) {
-                       mts->auto_scroll_timeout_id = g_timeout_add (60, 
e_meeting_time_selector_timeout_handler, mts);
+                       mts->auto_scroll_timeout_id = e_named_timeout_add (
+                               60, e_meeting_time_selector_timeout_handler, mts);
                        mts->scroll_count = 0;
 
                        /* Call the handler to start scrolling now. */
@@ -3297,6 +3298,6 @@ free_busy_template_changed_cb (EMeetingTimeSelector *mts)
        if (mts->fb_refresh_not != 0)
                g_source_remove (mts->fb_refresh_not);
 
-       mts->fb_refresh_not = g_timeout_add_seconds (
+       mts->fb_refresh_not = e_named_timeout_add_seconds (
                REFRESH_PAUSE, free_busy_timeout_refresh, mts);
 }
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 92fca66..a45cb0c 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3301,7 +3301,7 @@ tooltip_event_cb (GnomeCanvasItem *item,
                        data->day = -1;
                        data->event_num = event_num;
                        data->get_view_event = (ECalendarViewEvent * (*)(ECalendarView *, int, gint)) 
tooltip_get_view_event;
-                       pevent->timeout = g_timeout_add_full (
+                       pevent->timeout = e_named_timeout_add_full (
                                G_PRIORITY_DEFAULT, 500,
                                (GSourceFunc) e_calendar_view_get_tooltips,
                                data, (GDestroyNotify) g_free);
@@ -3982,7 +3982,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
                data->day = -1;
                data->event_num = nevent;
                data->get_view_event = (ECalendarViewEvent * (*)(ECalendarView *, int, gint)) 
tooltip_get_view_event;
-               pevent->timeout = g_timeout_add_full (
+               pevent->timeout = e_named_timeout_add_full (
                        G_PRIORITY_DEFAULT, 500,
                        (GSourceFunc) e_calendar_view_get_tooltips,
                        data, (GDestroyNotify) g_free);
@@ -4915,7 +4915,9 @@ static void
 e_week_view_queue_layout (EWeekView *week_view)
 {
        if (week_view->layout_timeout_id == 0) {
-               week_view->layout_timeout_id = g_timeout_add (E_WEEK_VIEW_LAYOUT_TIMEOUT, 
e_week_view_layout_timeout_cb, week_view);
+               week_view->layout_timeout_id = e_named_timeout_add (
+                       E_WEEK_VIEW_LAYOUT_TIMEOUT,
+                       e_week_view_layout_timeout_cb, week_view);
        }
 }
 
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index a686dc2..5911530 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1470,12 +1470,14 @@ update_task_and_memo_views (GnomeCalendar *gcal)
 }
 
 static gboolean
-update_marcus_bains_line_cb (GnomeCalendar *gcal)
+update_marcus_bains_line_cb (gpointer user_data)
 {
+       GnomeCalendar *gcal;
        GnomeCalendarViewType view_type;
        ECalendarView *view;
        time_t now, day_begin;
 
+       gcal = GNOME_CALENDAR (user_data);
        view_type = gnome_calendar_get_view (gcal);
        view = gnome_calendar_get_calendar_view (gcal, view_type);
 
@@ -1518,9 +1520,10 @@ setup_widgets (GnomeCalendar *gcal)
 #endif
 
        /* The Marcus Bains line */
-       priv->update_marcus_bains_line_timeout = g_timeout_add_full (
-               G_PRIORITY_LOW, 60000, (GSourceFunc)
-               update_marcus_bains_line_cb, gcal, NULL);
+       priv->update_marcus_bains_line_timeout =
+               e_named_timeout_add_seconds_full (
+                       G_PRIORITY_LOW, 60,
+                       update_marcus_bains_line_cb, gcal, NULL);
 
        /* update_memo_view (gcal); */
 }
diff --git a/e-util/e-activity-bar.c b/e-util/e-activity-bar.c
index 51435d3..700f3fe 100644
--- a/e-util/e-activity-bar.c
+++ b/e-util/e-activity-bar.c
@@ -16,11 +16,11 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
+#include "e-activity-bar.h"
+
 #include <config.h>
-#endif
 
-#include "e-activity-bar.h"
+#include <libedataserver/libedataserver.h>
 
 #define E_ACTIVITY_BAR_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -70,7 +70,7 @@ activity_bar_feedback (EActivityBar *bar)
 
        /* Hold a reference on the EActivity for a short
         * period so the activity bar stays visible. */
-       bar->priv->timeout_id = g_timeout_add_seconds_full (
+       bar->priv->timeout_id = e_named_timeout_add_seconds_full (
                G_PRIORITY_LOW, FEEDBACK_PERIOD, (GSourceFunc) gtk_false,
                g_object_ref (activity), (GDestroyNotify) g_object_unref);
 }
diff --git a/e-util/e-activity-proxy.c b/e-util/e-activity-proxy.c
index aeef5d2..620d81a 100644
--- a/e-util/e-activity-proxy.c
+++ b/e-util/e-activity-proxy.c
@@ -19,14 +19,13 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "e-activity-proxy.h"
 
+#include <config.h>
 #include <glib/gi18n.h>
 
+#include <libedataserver/libedataserver.h>
+
 #define E_ACTIVITY_PROXY_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_ACTIVITY_PROXY, EActivityProxyPrivate))
@@ -75,7 +74,7 @@ activity_proxy_feedback (EActivityProxy *proxy)
 
        /* Hold a reference on the EActivity for a short
         * period so the activity proxy stays visible. */
-       proxy->priv->timeout_id = g_timeout_add_seconds_full (
+       proxy->priv->timeout_id = e_named_timeout_add_seconds_full (
                G_PRIORITY_LOW, FEEDBACK_PERIOD, (GSourceFunc) gtk_false,
                g_object_ref (activity), (GDestroyNotify) g_object_unref);
 }
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index e1d8ba2..a09e581 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -428,8 +428,10 @@ alert_set_tag (EAlert *alert,
 }
 
 static gboolean
-alert_timeout_cb (EAlert *alert)
+alert_timeout_cb (gpointer user_data)
 {
+       EAlert *alert = E_ALERT (user_data);
+
        e_alert_response (alert, alert->priv->default_response);
 
        return FALSE;
@@ -968,9 +970,11 @@ e_alert_start_timer (EAlert *alert,
                alert->priv->timeout_id = 0;
        }
 
-       if (seconds > 0)
-               alert->priv->timeout_id = g_timeout_add_seconds (
-                       seconds, (GSourceFunc) alert_timeout_cb, alert);
+       if (seconds > 0) {
+               alert->priv->timeout_id =
+                       e_named_timeout_add_seconds (
+                       seconds, alert_timeout_cb, alert);
+       }
 }
 
 void
diff --git a/e-util/e-attachment.c b/e-util/e-attachment.c
index bad4e0b..b446d0a 100644
--- a/e-util/e-attachment.c
+++ b/e-util/e-attachment.c
@@ -585,8 +585,11 @@ attachment_progress_cb (goffset current_num_bytes,
 }
 
 static gboolean
-attachment_cancelled_timeout_cb (EAttachment *attachment)
+attachment_cancelled_timeout_cb (gpointer user_data)
 {
+       EAttachment *attachment;
+
+       attachment = E_ATTACHMENT (user_data);
        attachment->priv->emblem_timeout_id = 0;
        g_cancellable_reset (attachment->priv->cancellable);
 
@@ -605,8 +608,8 @@ attachment_cancelled_cb (EAttachment *attachment)
        if (attachment->priv->emblem_timeout_id > 0)
                g_source_remove (attachment->priv->emblem_timeout_id);
 
-       attachment->priv->emblem_timeout_id = g_timeout_add_seconds (
-               1, (GSourceFunc) attachment_cancelled_timeout_cb, attachment);
+       attachment->priv->emblem_timeout_id = e_named_timeout_add_seconds (
+               1, attachment_cancelled_timeout_cb, attachment);
 
        attachment_update_icon_column (attachment);
 }
diff --git a/e-util/e-calendar.c b/e-util/e-calendar.c
index 38336cb..c4c5693 100644
--- a/e-util/e-calendar.c
+++ b/e-util/e-calendar.c
@@ -29,15 +29,15 @@
  * to got to the current day.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "e-calendar.h"
 
+#include <config.h>
+#include <glib/gi18n.h>
+
 #include <gtk/gtk.h>
+#include <libedataserver/libedataserver.h>
+
 #include <libgnomecanvas/gnome-canvas-widget.h>
-#include <glib/gi18n.h>
 
 #define E_CALENDAR_SMALL_FONT_PTSIZE 6
 
@@ -586,11 +586,11 @@ e_calendar_start_auto_move (ECalendar *cal,
                             gboolean moving_forward)
 {
        if (cal->timeout_id == 0) {
-               cal->timeout_id = g_timeout_add (
+               cal->timeout_id = e_named_timeout_add (
                        E_CALENDAR_AUTO_MOVE_TIMEOUT,
-                       e_calendar_auto_move_handler,
-                       cal);
+                       e_calendar_auto_move_handler, cal);
        }
+
        cal->timeout_delay = E_CALENDAR_AUTO_MOVE_TIMEOUT_DELAY;
        cal->moving_forward = moving_forward;
 
@@ -601,11 +601,11 @@ e_calendar_start_auto_move_year (ECalendar *cal,
                                  gboolean moving_forward)
 {
        if (cal->timeout_id == 0) {
-               cal->timeout_id = g_timeout_add (
+               cal->timeout_id = e_named_timeout_add (
                        E_CALENDAR_AUTO_MOVE_TIMEOUT,
-                       e_calendar_auto_move_year_handler,
-                       cal);
+                       e_calendar_auto_move_year_handler, cal);
        }
+
        cal->timeout_delay = E_CALENDAR_AUTO_MOVE_TIMEOUT_DELAY;
        cal->moving_forward = moving_forward;
 }
diff --git a/e-util/e-canvas-utils.c b/e-util/e-canvas-utils.c
index ec3aad3..780db80 100644
--- a/e-util/e-canvas-utils.c
+++ b/e-util/e-canvas-utils.c
@@ -21,11 +21,11 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
+#include "e-canvas-utils.h"
+
 #include <config.h>
-#endif
 
-#include "e-canvas-utils.h"
+#include <libedataserver/libedataserver.h>
 
 void
 e_canvas_item_move_absolute (GnomeCanvasItem *item,
@@ -216,7 +216,7 @@ e_canvas_item_show_area_delayed (GnomeCanvasItem *item,
        dac->y1 = y1;
        dac->x2 = x2;
        dac->y2 = y2;
-       dac->canvas = item->canvas;
-       g_object_ref (item->canvas);
-       g_timeout_add (delay, show_area_timeout, dac);
+       dac->canvas = g_object_ref (item->canvas);
+
+       e_named_timeout_add (delay, show_area_timeout, dac);
 }
diff --git a/e-util/e-canvas.c b/e-util/e-canvas.c
index d39f9f7..9330406 100644
--- a/e-util/e-canvas.c
+++ b/e-util/e-canvas.c
@@ -20,13 +20,12 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
+#include "e-canvas.h"
+
 #include <config.h>
-#endif
 
 #include <gtk/gtk.h>
-
-#include "e-canvas.h"
+#include <libedataserver/libedataserver.h>
 
 #define d(x)
 
@@ -851,7 +850,7 @@ e_canvas_item_grab (ECanvas *canvas,
                item, event_mask, cursor, device, etime);
        if (grab_status == GDK_GRAB_SUCCESS) {
                canvas->grab_cancelled_cb = cancelled_cb;
-               canvas->grab_cancelled_check_id = g_timeout_add_full (
+               canvas->grab_cancelled_check_id = e_named_timeout_add_full (
                        G_PRIORITY_LOW, 100,
                        grab_cancelled_check, canvas, NULL);
                canvas->grab_cancelled_time = etime;
diff --git a/e-util/e-cell-text.c b/e-util/e-cell-text.c
index 577d41c..6026185 100644
--- a/e-util/e-cell-text.c
+++ b/e-util/e-cell-text.c
@@ -1121,7 +1121,8 @@ ect_enter_edit (ECellView *ecell_view,
        edit->selection_end = 0;
        edit->select_by_word = FALSE;
 
-       edit->timeout_id = g_timeout_add (10, _blink_scroll_timeout, text_view);
+       edit->timeout_id = e_named_timeout_add (
+               10, _blink_scroll_timeout, text_view);
        edit->timer = g_timer_new ();
        g_timer_elapsed (edit->timer, &(edit->scroll_start));
        g_timer_start (edit->timer);
diff --git a/e-util/e-cell-tree.c b/e-util/e-cell-tree.c
index c23be55..feb23f8 100644
--- a/e-util/e-cell-tree.c
+++ b/e-util/e-cell-tree.c
@@ -461,7 +461,9 @@ ect_event (ECellView *ecell_view,
                                closure->node = node;
                                closure->expanded = expanded;
                                closure->area = area;
-                               tree_view->animate_timeout = g_timeout_add (50, animate_expander, closure);
+                               tree_view->animate_timeout =
+                                       e_named_timeout_add (
+                                       50, animate_expander, closure);
                                return TRUE;
                        }
                }
diff --git a/e-util/e-map.c b/e-util/e-map.c
index a419626..17ae1e9 100644
--- a/e-util/e-map.c
+++ b/e-util/e-map.c
@@ -22,16 +22,16 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "e-map.h"
 
+#include <config.h>
 #include <math.h>
 #include <stdlib.h>
-#include <gdk/gdkkeysyms.h>
+
 #include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
 
-#include "e-map.h"
+#include <libedataserver/libedataserver.h>
 
 #include "e-util-private.h"
 
@@ -203,7 +203,7 @@ e_map_start_tweening (EMap *map)
 
        map->priv->timer = g_timer_new ();
        map->priv->timer_current_ms = 0;
-       map->priv->tween_id = g_timeout_add (
+       map->priv->tween_id = e_named_timeout_add (
                E_MAP_TWEEN_TIMEOUT_MSECS, e_map_do_tween_cb, map);
        g_timer_start (map->priv->timer);
 }
diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c
index ae034d6..1ae9301 100644
--- a/e-util/e-misc-utils.c
+++ b/e-util/e-misc-utils.c
@@ -77,8 +77,9 @@ window_data_free (WindowData *data)
 }
 
 static gboolean
-window_update_settings (WindowData *data)
+window_update_settings (gpointer user_data)
 {
+       WindowData *data = user_data;
        GSettings *settings = data->settings;
 
        if (data->flags & E_RESTORE_WINDOW_SIZE) {
@@ -122,8 +123,8 @@ window_delayed_update_settings (WindowData *data)
        if (data->timeout_id > 0)
                g_source_remove (data->timeout_id);
 
-       data->timeout_id = g_timeout_add_seconds (
-               1, (GSourceFunc) window_update_settings, data);
+       data->timeout_id = e_named_timeout_add_seconds (
+               1, window_update_settings, data);
 }
 
 static gboolean
diff --git a/e-util/e-name-selector-entry.c b/e-util/e-name-selector-entry.c
index 12dddb8..949459e 100644
--- a/e-util/e-name-selector-entry.c
+++ b/e-util/e-name-selector-entry.c
@@ -98,7 +98,7 @@ G_DEFINE_TYPE_WITH_CODE (
 #define re_set_timeout(id,func,ptr,tout) G_STMT_START {                \
        if (id)                                                 \
                g_source_remove (id);                           \
-       id = g_timeout_add (tout, (GSourceFunc) func, ptr);     \
+       id = e_named_timeout_add (tout, func, ptr);             \
        } G_STMT_END
 
 static void destination_row_inserted (ENameSelectorEntry *name_selector_entry, GtkTreePath *path, 
GtkTreeIter *iter);
@@ -1194,18 +1194,26 @@ update_completion_model (ENameSelectorEntry *name_selector_entry)
 }
 
 static gboolean
-type_ahead_complete_on_timeout_cb (ENameSelectorEntry *name_selector_entry)
+type_ahead_complete_on_timeout_cb (gpointer user_data)
 {
+       ENameSelectorEntry *name_selector_entry;
+
+       name_selector_entry = E_NAME_SELECTOR_ENTRY (user_data);
        type_ahead_complete (name_selector_entry);
        name_selector_entry->priv->type_ahead_complete_cb_id = 0;
+
        return FALSE;
 }
 
 static gboolean
-update_completions_on_timeout_cb (ENameSelectorEntry *name_selector_entry)
+update_completions_on_timeout_cb (gpointer user_data)
 {
+       ENameSelectorEntry *name_selector_entry;
+
+       name_selector_entry = E_NAME_SELECTOR_ENTRY (user_data);
        update_completion_model (name_selector_entry);
        name_selector_entry->priv->update_completions_cb_id = 0;
+
        return FALSE;
 }
 
@@ -1518,10 +1526,12 @@ user_insert_text (ENameSelectorEntry *name_selector_entry,
                /* If the user inserted one character, kick off completion */
                re_set_timeout (
                        name_selector_entry->priv->update_completions_cb_id,
-                       update_completions_on_timeout_cb,  name_selector_entry, AUTOCOMPLETE_TIMEOUT);
+                       update_completions_on_timeout_cb,  name_selector_entry,
+                       AUTOCOMPLETE_TIMEOUT);
                re_set_timeout (
                        name_selector_entry->priv->type_ahead_complete_cb_id,
-                       type_ahead_complete_on_timeout_cb, name_selector_entry, AUTOCOMPLETE_TIMEOUT);
+                       type_ahead_complete_on_timeout_cb, name_selector_entry,
+                       AUTOCOMPLETE_TIMEOUT);
        }
 
        g_signal_handlers_unblock_by_func (name_selector_entry, user_delete_text, name_selector_entry);
@@ -1566,7 +1576,8 @@ user_delete_text (ENameSelectorEntry *name_selector_entry,
                /* Might be backspace; update completion model so dropdown is accurate */
                re_set_timeout (
                        name_selector_entry->priv->update_completions_cb_id,
-                       update_completions_on_timeout_cb, name_selector_entry, AUTOCOMPLETE_TIMEOUT);
+                       update_completions_on_timeout_cb, name_selector_entry,
+                       AUTOCOMPLETE_TIMEOUT);
        }
 
        index_start = get_index_at_position (text, start_pos);
@@ -2181,7 +2192,8 @@ ensure_type_ahead_complete_on_timeout (ENameSelectorEntry *name_selector_entry)
        if (!name_selector_entry->priv->type_ahead_complete_cb_id) {
                re_set_timeout (
                        name_selector_entry->priv->type_ahead_complete_cb_id,
-                       type_ahead_complete_on_timeout_cb, name_selector_entry, SHOW_RESULT_TIMEOUT);
+                       type_ahead_complete_on_timeout_cb, name_selector_entry,
+                       SHOW_RESULT_TIMEOUT);
        }
 }
 
diff --git a/e-util/e-proxy-preferences.c b/e-util/e-proxy-preferences.c
index 57c3d32..12dd2cc 100644
--- a/e-util/e-proxy-preferences.c
+++ b/e-util/e-proxy-preferences.c
@@ -105,7 +105,7 @@ proxy_preferences_commit_stash (EProxyPreferences *preferences,
 
        if (start_timeout) {
                preferences->priv->commit_timeout_id =
-                       g_timeout_add_seconds (
+                       e_named_timeout_add_seconds (
                                COMMIT_DELAY_SECS,
                                proxy_preferences_commit_timeout_cb,
                                preferences);
diff --git a/e-util/e-table-header-item.c b/e-util/e-table-header-item.c
index 9d5a6d3..06d0030 100644
--- a/e-util/e-table-header-item.c
+++ b/e-util/e-table-header-item.c
@@ -667,7 +667,8 @@ scroll_on (ETableHeaderItem *ethi,
                if (ethi->scroll_idle_id != 0)
                        g_source_remove (ethi->scroll_idle_id);
                ethi->scroll_direction = scroll_direction;
-               ethi->scroll_idle_id = g_timeout_add (100, scroll_timeout, ethi);
+               ethi->scroll_idle_id = e_named_timeout_add (
+                       100, scroll_timeout, ethi);
        }
 }
 
diff --git a/e-util/e-table-search.c b/e-util/e-table-search.c
index 5b6a7bd..f21b5aa 100644
--- a/e-util/e-table-search.c
+++ b/e-util/e-table-search.c
@@ -20,14 +20,13 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "e-table-search.h"
 
+#include <config.h>
 #include <string.h>
 
+#include <libedataserver/libedataserver.h>
+
 #include "e-marshal.h"
 
 #define d(x)
@@ -98,17 +97,19 @@ ets_accept (gpointer data)
 static void
 drop_timeout (ETableSearch *ets)
 {
-       if (ets->priv->timeout_id) {
+       if (ets->priv->timeout_id > 0) {
                g_source_remove (ets->priv->timeout_id);
+               ets->priv->timeout_id = 0;
        }
-       ets->priv->timeout_id = 0;
 }
 
 static void
 add_timeout (ETableSearch *ets)
 {
        drop_timeout (ets);
-       ets->priv->timeout_id = g_timeout_add_seconds (1, ets_accept, ets);
+
+       ets->priv->timeout_id =
+               e_named_timeout_add_seconds (1, ets_accept, ets);
 }
 
 static void
diff --git a/e-util/e-table.c b/e-util/e-table.c
index 19298a9..5e9643e 100644
--- a/e-util/e-table.c
+++ b/e-util/e-table.c
@@ -2981,7 +2981,8 @@ scroll_on (ETable *et,
                if (et->scroll_idle_id != 0)
                        g_source_remove (et->scroll_idle_id);
                et->scroll_direction = scroll_direction;
-               et->scroll_idle_id = g_timeout_add (100, scroll_timeout, et);
+               et->scroll_idle_id = e_named_timeout_add (
+                       100, scroll_timeout, et);
        }
 }
 
diff --git a/e-util/e-text.c b/e-util/e-text.c
index 574f5e1..d13b4a6 100644
--- a/e-util/e-text.c
+++ b/e-util/e-text.c
@@ -35,12 +35,9 @@
  * 02110-1301, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "e-text.h"
 
+#include <config.h>
 #include <math.h>
 #include <ctype.h>
 #include <string.h>
@@ -49,6 +46,8 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
+#include <libedataserver/libedataserver.h>
+
 #include "e-canvas-utils.h"
 #include "e-canvas.h"
 #include "e-marshal.h"
@@ -1549,8 +1548,10 @@ start_editing (EText *text)
        text->select_by_word = FALSE;
        text->xofs_edit = 0;
        text->yofs_edit = 0;
-       if (text->timeout_id == 0)
-               text->timeout_id = g_timeout_add (10, _blink_scroll_timeout, text);
+       if (text->timeout_id == 0) {
+               text->timeout_id = e_named_timeout_add (
+                       10, _blink_scroll_timeout, text);
+       }
        text->timer = g_timer_new ();
        g_timer_elapsed (text->timer, &(text->scroll_start));
        g_timer_start (text->timer);
@@ -1765,12 +1766,12 @@ e_text_event (GnomeCanvasItem *item,
                if (event->type == GDK_BUTTON_PRESS) {
                        if (text->dbl_timeout == 0 &&
                            text->tpl_timeout == 0) {
-                               text->dbl_timeout = g_timeout_add (
+                               text->dbl_timeout = e_named_timeout_add (
                                        200, _click, &(text->dbl_timeout));
                        } else {
                                if (text->tpl_timeout == 0) {
                                        e_tep_event.type = GDK_2BUTTON_PRESS;
-                                       text->tpl_timeout = g_timeout_add (
+                                       text->tpl_timeout = e_named_timeout_add (
                                                200, _click, &(text->tpl_timeout));
                                } else {
                                        e_tep_event.type = GDK_3BUTTON_PRESS;
diff --git a/e-util/e-timezone-dialog.c b/e-util/e-timezone-dialog.c
index 431287c..658ae68 100644
--- a/e-util/e-timezone-dialog.c
+++ b/e-util/e-timezone-dialog.c
@@ -586,11 +586,13 @@ on_map_visibility_changed (GtkWidget *w,
        if (event->state != GDK_VISIBILITY_FULLY_OBSCURED) {
                /* Map is visible, at least partly, so make sure we flash the
                 * selected point. */
-               if (!priv->timeout_id)
-                       priv->timeout_id = g_timeout_add (100, on_map_timeout, etd);
+               if (priv->timeout_id == 0) {
+                       priv->timeout_id = e_named_timeout_add (
+                               100, on_map_timeout, etd);
+               }
        } else {
                /* Map is invisible, so don't waste resources on the timeout.*/
-               if (priv->timeout_id) {
+               if (priv->timeout_id > 0) {
                        g_source_remove (priv->timeout_id);
                        priv->timeout_id = 0;
                }
diff --git a/e-util/e-tree.c b/e-util/e-tree.c
index 60f1d27..dda2ad2 100644
--- a/e-util/e-tree.c
+++ b/e-util/e-tree.c
@@ -2487,7 +2487,8 @@ scroll_on (ETree *tree,
                if (tree->priv->scroll_idle_id != 0)
                        g_source_remove (tree->priv->scroll_idle_id);
                tree->priv->scroll_direction = scroll_direction;
-               tree->priv->scroll_idle_id = g_timeout_add (100, scroll_timeout, tree);
+               tree->priv->scroll_idle_id =
+                       e_named_timeout_add (100, scroll_timeout, tree);
        }
 }
 
@@ -2536,7 +2537,8 @@ hover_on (ETree *tree,
        tree->priv->hover_y = y;
        if (tree->priv->hover_idle_id != 0)
                g_source_remove (tree->priv->hover_idle_id);
-       tree->priv->hover_idle_id = g_timeout_add (500, hover_timeout, tree);
+       tree->priv->hover_idle_id =
+               e_named_timeout_add (500, hover_timeout, tree);
 }
 
 static void
diff --git a/libemail-engine/mail-folder-cache.c b/libemail-engine/mail-folder-cache.c
index c7c95df..af5d2b9 100644
--- a/libemail-engine/mail-folder-cache.c
+++ b/libemail-engine/mail-folder-cache.c
@@ -1284,10 +1284,13 @@ static MailMsgInfo ping_store_info = {
 };
 
 static gboolean
-ping_cb (MailFolderCache *cache)
+ping_cb (gpointer user_data)
 {
+       MailFolderCache *cache;
        GList *list, *link;
 
+       cache = MAIL_FOLDER_CACHE (user_data);
+
        list = mail_folder_cache_list_stores (cache);
 
        for (link = list; link != NULL; link = g_list_next (link)) {
@@ -1732,8 +1735,8 @@ mail_folder_cache_init (MailFolderCache *cache)
 
        buf = getenv ("EVOLUTION_PING_TIMEOUT");
        timeout = buf ? strtoul (buf, NULL, 10) : 600;
-       cache->priv->ping_id = g_timeout_add_seconds (
-               timeout, (GSourceFunc) ping_cb, cache);
+       cache->priv->ping_id = e_named_timeout_add_seconds (
+               timeout, ping_cb, cache);
 
        g_queue_init (&cache->priv->local_folder_uris);
        g_queue_init (&cache->priv->remote_folder_uris);
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index f15e7f8..0d1c4bf 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -265,7 +265,7 @@ mail_backend_delete_junk (CamelService *service,
 
 /* Helper for mail_backend_prepare_for_quit_cb() */
 static gboolean
-mail_backend_poll_to_quit (EActivity *activity)
+mail_backend_poll_to_quit (gpointer user_data)
 {
        return mail_msg_active ();
 }
@@ -358,12 +358,14 @@ mail_backend_prepare_for_quit_cb (EShell *shell,
        /* Now we poll until all activities are actually cancelled or finished.
         * Reffing the activity delays quitting; the reference count
         * acts like a counting semaphore. */
-       if (mail_msg_active ())
-               g_timeout_add_seconds_full (
-                       G_PRIORITY_DEFAULT, QUIT_POLL_INTERVAL,
-                       (GSourceFunc) mail_backend_poll_to_quit,
+       if (mail_msg_active ()) {
+               e_named_timeout_add_seconds_full (
+                       G_PRIORITY_DEFAULT,
+                       QUIT_POLL_INTERVAL,
+                       mail_backend_poll_to_quit,
                        g_object_ref (activity),
                        (GDestroyNotify) g_object_unref);
+       }
 }
 
 static void
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 761fa58..24ef087 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2556,8 +2556,9 @@ mail_reader_key_press_cb (EMailReader *reader,
 }
 
 static gboolean
-mail_reader_message_seen_cb (EMailReaderClosure *closure)
+mail_reader_message_seen_cb (gpointer user_data)
 {
+       EMailReaderClosure *closure = user_data;
        EMailReader *reader;
        GtkWidget *message_list;
        EMailPartList *parts;
@@ -2631,11 +2632,12 @@ schedule_timeout_mark_seen (EMailReader *reader)
                timeout_closure->reader = g_object_ref (reader);
                timeout_closure->message_uid = g_strdup (message_uid);
 
-               MESSAGE_LIST (message_list)->seen_id = g_timeout_add_full (
-                       G_PRIORITY_DEFAULT, timeout_interval,
-                       (GSourceFunc) mail_reader_message_seen_cb,
-                       timeout_closure, (GDestroyNotify)
-                       mail_reader_closure_free);
+               MESSAGE_LIST (message_list)->seen_id =
+                       e_named_timeout_add_full (
+                               G_PRIORITY_DEFAULT, timeout_interval,
+                               mail_reader_message_seen_cb,
+                               timeout_closure, (GDestroyNotify)
+                               mail_reader_closure_free);
        }
 
        return schedule_timeout;
@@ -2731,8 +2733,9 @@ exit:
 }
 
 static gboolean
-mail_reader_message_selected_timeout_cb (EMailReader *reader)
+mail_reader_message_selected_timeout_cb (gpointer user_data)
 {
+       EMailReader *reader;
        EMailReaderPrivate *priv;
        EMailDisplay *display;
        GtkWidget *message_list;
@@ -2740,6 +2743,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
        const gchar *format_uid;
        EMailPartList *parts;
 
+       reader = E_MAIL_READER (user_data);
        priv = E_MAIL_READER_GET_PRIVATE (reader);
 
        message_list = e_mail_reader_get_message_list (reader);
@@ -2845,15 +2849,16 @@ mail_reader_message_selected_cb (EMailReader *reader,
                display = e_mail_reader_get_mail_display (reader);
                e_mail_display_set_part_list (display, NULL);
                e_web_view_clear (E_WEB_VIEW (display));
+
        } else if (priv->restoring_message_selection) {
                /* Skip the timeout if we're restoring the previous message
                 * selection.  The timeout is there for when we're scrolling
                 * rapidly through the message list. */
                mail_reader_message_selected_timeout_cb (reader);
+
        } else {
-               priv->message_selected_timeout_id = g_timeout_add (
-                       100, (GSourceFunc)
-                       mail_reader_message_selected_timeout_cb, reader);
+               priv->message_selected_timeout_id = e_named_timeout_add (
+                       100, mail_reader_message_selected_timeout_cb, reader);
        }
 
        e_mail_reader_changed (reader);
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 16bb94d..fb2441b 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2677,8 +2677,9 @@ tree_drag_leave (GtkWidget *widget,
 #define SCROLL_EDGE_SIZE 15
 
 static gboolean
-tree_autoscroll (EMFolderTree *folder_tree)
+tree_autoscroll (gpointer user_data)
 {
+       EMFolderTree *folder_tree;
        GtkAdjustment *adjustment;
        GtkTreeView *tree_view;
        GtkScrollable *scrollable;
@@ -2690,6 +2691,8 @@ tree_autoscroll (EMFolderTree *folder_tree)
        gdouble value;
        gint offset, y;
 
+       folder_tree = EM_FOLDER_TREE (user_data);
+
        /* Get the y pointer position relative to the treeview. */
        tree_view = GTK_TREE_VIEW (folder_tree);
        window = gtk_tree_view_get_bin_window (tree_view);
@@ -2723,13 +2726,15 @@ tree_autoscroll (EMFolderTree *folder_tree)
 }
 
 static gboolean
-tree_autoexpand (EMFolderTree *folder_tree)
+tree_autoexpand (gpointer user_data)
 {
-       EMFolderTreePrivate *priv = folder_tree->priv;
+       EMFolderTreePrivate *priv;
        GtkTreeView *tree_view;
        GtkTreePath *path;
 
-       tree_view = GTK_TREE_VIEW (folder_tree);
+       tree_view = GTK_TREE_VIEW (user_data);
+       priv = EM_FOLDER_TREE_GET_PRIVATE (tree_view);
+
        path = gtk_tree_row_reference_get_path (priv->autoexpand_row);
        gtk_tree_view_expand_row (tree_view, path, FALSE);
        gtk_tree_path_free (path);
@@ -2763,9 +2768,10 @@ tree_drag_motion (GtkWidget *widget,
        if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &path, &pos))
                return FALSE;
 
-       if (priv->autoscroll_id == 0)
-               priv->autoscroll_id = g_timeout_add (
-                       150, (GSourceFunc) tree_autoscroll, folder_tree);
+       if (priv->autoscroll_id == 0) {
+               priv->autoscroll_id = e_named_timeout_add (
+                       150, tree_autoscroll, folder_tree);
+       }
 
        gtk_tree_model_get_iter (model, &iter, path);
 
@@ -2783,16 +2789,14 @@ tree_drag_motion (GtkWidget *widget,
                                priv->autoexpand_row =
                                        gtk_tree_row_reference_new (model, path);
                                g_source_remove (priv->autoexpand_id);
-                               priv->autoexpand_id = g_timeout_add (
-                                       600, (GSourceFunc)
-                                       tree_autoexpand, folder_tree);
+                               priv->autoexpand_id = e_named_timeout_add (
+                                       600, tree_autoexpand, folder_tree);
                        }
 
                        gtk_tree_path_free (autoexpand_path);
                } else {
-                       priv->autoexpand_id = g_timeout_add (
-                               600, (GSourceFunc)
-                               tree_autoexpand, folder_tree);
+                       priv->autoexpand_id = e_named_timeout_add (
+                               600, tree_autoexpand, folder_tree);
                        priv->autoexpand_row =
                                gtk_tree_row_reference_new (model, path);
                }
diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c
index e210652..77fb6b2 100644
--- a/mail/em-subscription-editor.c
+++ b/mail/em-subscription-editor.c
@@ -1187,8 +1187,11 @@ subscription_editor_update_view (EMSubscriptionEditor *editor)
 }
 
 static gboolean
-subscription_editor_timeout_cb (EMSubscriptionEditor *editor)
+subscription_editor_timeout_cb (gpointer user_data)
 {
+       EMSubscriptionEditor *editor;
+
+       editor = EM_SUBSCRIPTION_EDITOR (user_data);
        subscription_editor_update_view (editor);
        editor->priv->timeout_id = 0;
 
@@ -1234,11 +1237,12 @@ subscription_editor_entry_changed_cb (GtkEntry *entry,
 
        text = gtk_entry_get_text (entry);
 
-       if (text != NULL && *text != '\0')
-               editor->priv->timeout_id = g_timeout_add_seconds (
-                       1, (GSourceFunc) subscription_editor_timeout_cb, editor);
-       else
+       if (text != NULL && *text != '\0') {
+               editor->priv->timeout_id = e_named_timeout_add_seconds (
+                       1, subscription_editor_timeout_cb, editor);
+       } else {
                subscription_editor_update_view (editor);
+       }
 }
 
 static void
diff --git a/mail/importers/elm-importer.c b/mail/importers/elm-importer.c
index 6a20bf4..97ee58d 100644
--- a/mail/importers/elm-importer.c
+++ b/mail/importers/elm-importer.c
@@ -292,7 +292,8 @@ mail_importer_elm_import (EImport *ei,
        m->import = ei;
        g_object_ref (m->import);
        m->target = (EImportTargetHome *) target;
-       m->status_timeout_id = g_timeout_add (100, elm_status_timeout, m);
+       m->status_timeout_id =
+               e_named_timeout_add (100, elm_status_timeout, m);
        g_mutex_init (&m->status_lock);
        m->status = camel_operation_new ();
 
diff --git a/mail/importers/evolution-mbox-importer.c b/mail/importers/evolution-mbox-importer.c
index 1e8a094..3149441 100644
--- a/mail/importers/evolution-mbox-importer.c
+++ b/mail/importers/evolution-mbox-importer.c
@@ -274,7 +274,8 @@ mbox_import (EImport *ei,
        importer->import = ei;
        importer->target = target;
        g_mutex_init (&importer->status_lock);
-       importer->status_timeout_id = g_timeout_add (100, mbox_status_timeout, importer);
+       importer->status_timeout_id =
+               e_named_timeout_add (100, mbox_status_timeout, importer);
        importer->cancellable = camel_operation_new ();
 
        g_signal_connect (
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c
index c37d3bd..4fd5f37 100644
--- a/mail/importers/pine-importer.c
+++ b/mail/importers/pine-importer.c
@@ -318,8 +318,9 @@ pine_status (CamelOperation *op,
 }
 
 static gboolean
-pine_status_timeout (struct _pine_import_msg *importer)
+pine_status_timeout (gpointer user_data)
 {
+       struct _pine_import_msg *importer = user_data;
        gint pc;
        gchar *what;
 
@@ -358,8 +359,8 @@ mail_importer_pine_import (EImport *ei,
        m->import = ei;
        g_object_ref (m->import);
        m->target = target;
-       m->status_timeout_id = g_timeout_add (
-               100, (GSourceFunc) pine_status_timeout, m);
+       m->status_timeout_id = e_named_timeout_add (
+               100, pine_status_timeout, m);
        g_mutex_init (&m->status_lock);
        m->cancellable = camel_operation_new ();
 
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 072641b..76859c6 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -616,7 +616,7 @@ build_dialog (GtkWindow *parent,
                        info->keep_on_server = get_keep_on_server (service);
                        info->cancellable = camel_operation_new ();
                        info->state = allow_send ? SEND_ACTIVE : SEND_COMPLETE;
-                       info->timeout_id = g_timeout_add (
+                       info->timeout_id = e_named_timeout_add (
                                STATUS_TIMEOUT, operation_status_timeout, info);
 
                        g_signal_connect (
@@ -631,9 +631,10 @@ build_dialog (GtkWindow *parent,
                        /* incase we get the same source pop up again */
                        continue;
 
-               } else if (info->timeout_id == 0)
-                       info->timeout_id = g_timeout_add (
+               } else if (info->timeout_id == 0) {
+                       info->timeout_id = e_named_timeout_add (
                                STATUS_TIMEOUT, operation_status_timeout, info);
+               }
 
                recv_icon = gtk_image_new_from_icon_name (
                        "mail-inbox", SEND_RECV_ICON_SIZE);
@@ -704,7 +705,7 @@ build_dialog (GtkWindow *parent,
                        info->keep_on_server = FALSE;
                        info->cancellable = camel_operation_new ();
                        info->state = SEND_ACTIVE;
-                       info->timeout_id = g_timeout_add (
+                       info->timeout_id = e_named_timeout_add (
                                STATUS_TIMEOUT, operation_status_timeout, info);
 
                        g_signal_connect (
@@ -714,9 +715,10 @@ build_dialog (GtkWindow *parent,
                        g_hash_table_insert (
                                data->active, g_strdup (SEND_URI_KEY), info);
                        list = g_list_prepend (list, info);
-               } else if (info->timeout_id == 0)
-                       info->timeout_id = g_timeout_add (
+               } else if (info->timeout_id == 0) {
+                       info->timeout_id = e_named_timeout_add (
                                STATUS_TIMEOUT, operation_status_timeout, info);
+               }
 
                send_icon = gtk_image_new_from_icon_name (
                        "mail-outbox", SEND_RECV_ICON_SIZE);
diff --git a/modules/backup-restore/evolution-backup-tool.c b/modules/backup-restore/evolution-backup-tool.c
index 4b8ad9f..3ca07ec 100644
--- a/modules/backup-restore/evolution-backup-tool.c
+++ b/modules/backup-restore/evolution-backup-tool.c
@@ -785,8 +785,10 @@ check (const gchar *filename,
 }
 
 static gboolean
-pbar_update (GCancellable *cancellable)
+pbar_update (gpointer user_data)
 {
+       GCancellable *cancellable = G_CANCELLABLE (user_data);
+
        gtk_progress_bar_pulse ((GtkProgressBar *) pbar);
        gtk_progress_bar_set_text ((GtkProgressBar *) pbar, txt);
 
@@ -1070,12 +1072,13 @@ main (gint argc,
                exit (result == 0 ? 0 : 1);
        }
 
-       if (gui_arg)
-               g_timeout_add_full (
-                       G_PRIORITY_DEFAULT, 50,
-                       (GSourceFunc) pbar_update,
+       if (gui_arg) {
+               e_named_timeout_add_full (
+                       G_PRIORITY_DEFAULT,
+                       50, pbar_update,
                        g_object_ref (cancellable),
                        (GDestroyNotify) g_object_unref);
+       }
 
        g_io_scheduler_push_job (
                start_job, NULL,
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 820339f..39b90b5 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -77,7 +77,7 @@ task_shell_view_process_completed_tasks (ETaskShellView *task_shell_view)
        if (source_id > 0)
                g_source_remove (source_id);
 
-       source_id = g_timeout_add_seconds (
+       source_id = e_named_timeout_add_seconds (
                1, task_shell_view_process_completed_tasks_cb,
                task_shell_view);
 
@@ -146,12 +146,14 @@ task_shell_view_selector_popup_event_cb (EShellView *shell_view,
 }
 
 static gboolean
-task_shell_view_update_timeout_cb (ETaskShellView *task_shell_view)
+task_shell_view_update_timeout_cb (gpointer user_data)
 {
+       ETaskShellView *task_shell_view;
        ETaskShellContent *task_shell_content;
        ETaskTable *task_table;
        ECalModel *model;
 
+       task_shell_view = E_TASK_SHELL_VIEW (user_data);
        task_shell_content = task_shell_view->priv->task_shell_content;
        task_table = e_task_shell_content_get_task_table (task_shell_content);
        model = e_task_table_get_model (task_table);
@@ -389,8 +391,8 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
        /* Call this when everything is ready, like actions in
         * action groups and such. */
        task_shell_view_update_timeout_cb (task_shell_view);
-       priv->update_timeout = g_timeout_add_full (
-               G_PRIORITY_LOW, 60000, (GSourceFunc)
+       priv->update_timeout = e_named_timeout_add_full (
+               G_PRIORITY_LOW, 60000,
                task_shell_view_update_timeout_cb,
                task_shell_view, NULL);
 }
diff --git a/modules/composer-autosave/e-composer-autosave.c b/modules/composer-autosave/e-composer-autosave.c
index cf0dd3b..97c0a3c 100644
--- a/modules/composer-autosave/e-composer-autosave.c
+++ b/modules/composer-autosave/e-composer-autosave.c
@@ -107,10 +107,12 @@ composer_autosave_finished_cb (EMsgComposer *composer,
 }
 
 static gboolean
-composer_autosave_timeout_cb (EComposerAutosave *autosave)
+composer_autosave_timeout_cb (gpointer user_data)
 {
+       EComposerAutosave *autosave;
        EExtensible *extensible;
 
+       autosave = E_COMPOSER_AUTOSAVE (user_data);
        extensible = e_extension_get_extensible (E_EXTENSION (autosave));
 
        /* User may have reverted or explicitly saved
@@ -148,10 +150,11 @@ composer_autosave_changed_cb (EComposerAutosave *autosave)
        editor = GTKHTML_EDITOR (extensible);
        autosave->changed = gtkhtml_editor_get_changed (editor);
 
-       if (autosave->changed && autosave->timeout_id == 0)
-               autosave->timeout_id = g_timeout_add_seconds (
-                       AUTOSAVE_INTERVAL, (GSourceFunc)
+       if (autosave->changed && autosave->timeout_id == 0) {
+               autosave->timeout_id = e_named_timeout_add_seconds (
+                       AUTOSAVE_INTERVAL,
                        composer_autosave_timeout_cb, autosave);
+       }
 }
 
 static void
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c
index 1ec00a3..e71f149 100644
--- a/modules/mail/e-mail-shell-backend.c
+++ b/modules/mail/e-mail-shell-backend.c
@@ -266,14 +266,17 @@ mail_shell_backend_sync_store_done_cb (CamelStore *store,
 }
 
 static gboolean
-mail_shell_backend_mail_sync (EMailShellBackend *mail_shell_backend)
+mail_shell_backend_mail_sync (gpointer user_data)
 {
+       EMailShellBackend *mail_shell_backend;
        EShell *shell;
        EShellBackend *shell_backend;
        EMailBackend *backend;
        EMailSession *session;
        GList *list, *link;
 
+       mail_shell_backend = E_MAIL_SHELL_BACKEND (user_data);
+
        shell_backend = E_SHELL_BACKEND (mail_shell_backend);
        shell = e_shell_backend_get_shell (shell_backend);
 
@@ -632,11 +635,12 @@ mail_shell_backend_start (EShellBackend *shell_backend)
                g_error_free (error);
        }
 
-       if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL)
-               priv->mail_sync_source_id = g_timeout_add_seconds (
+       if (g_getenv ("CAMEL_FLUSH_CHANGES") != NULL) {
+               priv->mail_sync_source_id = e_named_timeout_add_seconds (
                        mail_config_get_sync_timeout (),
-                       (GSourceFunc) mail_shell_backend_mail_sync,
+                       mail_shell_backend_mail_sync,
                        shell_backend);
+       }
 }
 
 static gboolean
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 31aebce..7eccb31 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -91,8 +91,10 @@ e_plugin_lib_enable (EPlugin *ep,
                g_idle_add (bbdb_timeout, ep);
 
                interval = get_check_interval ();
-               if (interval > 0)
-                       update_source = g_timeout_add_seconds (interval, (GSourceFunc) bbdb_timeout, NULL);
+               if (interval > 0) {
+                       update_source = e_named_timeout_add_seconds (
+                               interval, bbdb_timeout, NULL);
+               }
        }
 
        return 0;
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 53060b7..e21c59f 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -808,8 +808,8 @@ org_gnome_evolution_readdbx_import (EImport *ei,
        m->folder_name = NULL;
        m->folder_uri = NULL;
 
-       m->status_timeout_id = g_timeout_add (100, dbx_status_timeout, m);
-       /*m->status_timeout_id = NULL;*/
+       m->status_timeout_id =
+               e_named_timeout_add (100, dbx_status_timeout, m);
        g_mutex_init (&m->status_lock);
        m->cancellable = camel_operation_new ();
 
diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c
index f68cf35..1d26f74 100644
--- a/plugins/mail-notification/mail-notification.c
+++ b/plugins/mail-notification/mail-notification.c
@@ -190,7 +190,7 @@ connection_closed_cb (GDBusConnection *pconnection,
        g_object_unref (connection);
        connection = NULL;
 
-       g_timeout_add (3000, reinit_gdbus, NULL);
+       e_named_timeout_add (3000, reinit_gdbus, NULL);
 }
 
 static gboolean
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 0e4d1f6..914ceb7 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -2157,8 +2157,8 @@ pst_import (EImport *ei,
        m->journal = NULL;
        m->waiting_open = 0;
 
-       m->status_timeout_id = g_timeout_add (100, pst_status_timeout, m);
-       /*m->status_timeout_id = NULL;*/
+       m->status_timeout_id =
+               e_named_timeout_add (100, pst_status_timeout, m);
        g_mutex_init (&m->status_lock);
        m->cancellable = camel_operation_new ();
 
diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c
index 2713f00..b5dab40 100644
--- a/plugins/publish-calendar/publish-calendar.c
+++ b/plugins/publish-calendar/publish-calendar.c
@@ -151,7 +151,7 @@ update_publish_notification (GtkMessageType msg_type,
                        notify_notification_set_hint (
                                notify, "desktop-entry",
                                g_variant_new_string (PACKAGE));
-                       g_timeout_add (500, show_notify_cb, NULL);
+                       e_named_timeout_add (500, show_notify_cb, NULL);
 
                        g_signal_connect (
                                notify, "closed",
@@ -160,7 +160,8 @@ update_publish_notification (GtkMessageType msg_type,
        }
 #endif
 
-       status_icon_timeout_id = g_timeout_add_seconds (15, remove_notification, NULL);
+       status_icon_timeout_id =
+               e_named_timeout_add_seconds (15, remove_notification, NULL);
 
        if (new_icon) {
                g_signal_connect (
@@ -509,11 +510,13 @@ add_timeout (EPublishUri *uri)
        /* Set the timeout for now+frequency */
        switch (uri->publish_frequency) {
        case URI_PUBLISH_DAILY:
-               id = g_timeout_add_seconds (24 * 60 * 60, (GSourceFunc) publish, uri);
+               id = e_named_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_seconds (7 * 24 * 60 * 60, (GSourceFunc) publish, uri);
+               id = e_named_timeout_add_seconds (
+                       7 * 24 * 60 * 60, (GSourceFunc) publish, uri);
                g_hash_table_insert (uri_timeouts, uri, GUINT_TO_POINTER (id));
                break;
        }
@@ -587,7 +590,9 @@ add_offset_timeout (EPublishUri *uri)
                        publish (uri, FALSE);
                        add_timeout (uri);
                } else {
-                       id = g_timeout_add_seconds (24 * 60 * 60 - elapsed, (GSourceFunc) publish, uri);
+                       id = e_named_timeout_add_seconds (
+                               24 * 60 * 60 - elapsed,
+                               (GSourceFunc) publish, uri);
                        g_hash_table_insert (uri_timeouts, uri, GUINT_TO_POINTER (id));
                        break;
                }
@@ -597,7 +602,9 @@ add_offset_timeout (EPublishUri *uri)
                        publish (uri, FALSE);
                        add_timeout (uri);
                } else {
-                       id = g_timeout_add_seconds (7 * 24 * 60 * 60 - elapsed, (GSourceFunc) publish, uri);
+                       id = e_named_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-view.c b/shell/e-shell-view.c
index b7813ea..fe9724c 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -299,10 +299,13 @@ shell_view_save_state (EShellView *shell_view,
 }
 
 static gboolean
-shell_view_state_timeout_cb (EShellView *shell_view)
+shell_view_state_timeout_cb (gpointer user_data)
 {
+       EShellView *shell_view;
        EActivity *activity;
 
+       shell_view = E_SHELL_VIEW (user_data);
+
        /* If a save is still in progress, check back later. */
        if (shell_view->priv->state_save_activity != NULL)
                return TRUE;
@@ -1697,8 +1700,8 @@ e_shell_view_set_state_dirty (EShellView *shell_view)
        if (shell_view->priv->state_save_timeout_id > 0)
                return;
 
-       source_id = g_timeout_add_seconds (
-               STATE_SAVE_TIMEOUT_SECONDS, (GSourceFunc)
+       source_id = e_named_timeout_add_seconds (
+               STATE_SAVE_TIMEOUT_SECONDS,
                shell_view_state_timeout_cb, shell_view);
 
        shell_view->priv->state_save_timeout_id = source_id;
diff --git a/shell/killev.c b/shell/killev.c
index 8cd773e..ea4ad2a 100644
--- a/shell/killev.c
+++ b/shell/killev.c
@@ -54,7 +54,7 @@ file_monitor_changed_cb (GFileMonitor *monitor,
 }
 
 static gboolean
-evolution_not_responding_cb (void)
+evolution_not_responding_cb (gpointer user_data)
 {
        g_print ("No response from Evolution -- killing the process\n");
 
@@ -149,8 +149,8 @@ main (gint argc,
                monitor, "changed",
                G_CALLBACK (file_monitor_changed_cb), NULL);
 
-       g_timeout_add_seconds (
-               EVOLUTION_SHUTDOWN_TIMEOUT, (GSourceFunc)
+       e_named_timeout_add_seconds (
+               EVOLUTION_SHUTDOWN_TIMEOUT,
                evolution_not_responding_cb, NULL);
 
        /* Start the clock. */


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