diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-30 02:04:54 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-10-30 03:22:35 +0800 |
commit | bc0d5d40ed39c92dcdf62ae891a2e99c25237d74 (patch) | |
tree | a07763eeaa20602bd4c0620b2fe67c443c52d29c /e-util | |
parent | d3e0f96c73dde49acde92f6347b9e362d85e94aa (diff) | |
download | gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.gz gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.bz2 gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.lz gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.xz gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.tar.zst gsoc2013-evolution-bc0d5d40ed39c92dcdf62ae891a2e99c25237d74.zip |
Bug 710797 - Name all the timeouts added with g_timeout_add()
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-activity-bar.c | 8 | ||||
-rw-r--r-- | e-util/e-activity-proxy.c | 9 | ||||
-rw-r--r-- | e-util/e-alert.c | 12 | ||||
-rw-r--r-- | e-util/e-attachment.c | 9 | ||||
-rw-r--r-- | e-util/e-calendar.c | 22 | ||||
-rw-r--r-- | e-util/e-canvas-utils.c | 12 | ||||
-rw-r--r-- | e-util/e-canvas.c | 9 | ||||
-rw-r--r-- | e-util/e-cell-text.c | 3 | ||||
-rw-r--r-- | e-util/e-cell-tree.c | 4 | ||||
-rw-r--r-- | e-util/e-map.c | 12 | ||||
-rw-r--r-- | e-util/e-misc-utils.c | 7 | ||||
-rw-r--r-- | e-util/e-name-selector-entry.c | 26 | ||||
-rw-r--r-- | e-util/e-proxy-preferences.c | 2 | ||||
-rw-r--r-- | e-util/e-table-header-item.c | 3 | ||||
-rw-r--r-- | e-util/e-table-search.c | 15 | ||||
-rw-r--r-- | e-util/e-table.c | 3 | ||||
-rw-r--r-- | e-util/e-text.c | 17 | ||||
-rw-r--r-- | e-util/e-timezone-dialog.c | 8 | ||||
-rw-r--r-- | e-util/e-tree.c | 6 |
19 files changed, 108 insertions, 79 deletions
diff --git a/e-util/e-activity-bar.c b/e-util/e-activity-bar.c index 51435d3dda..700f3fe9cf 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 aeef5d2cd8..620d81a1b7 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 e1d8ba26e9..a09e5817b8 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 bad4e0b460..b446d0a47a 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 38336cb618..c4c5693ffc 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 ec3aad3858..780db8075f 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 d39f9f7684..93304065e3 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 577d41ccf2..6026185e9a 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 c23be558bf..feb23f8985 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 a419626b8d..17ae1e96a3 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 ae034d6a3b..1ae9301aa3 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 12dddb83c1..949459e55b 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 57c3d328b8..12dd2cc26c 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 9d5a6d36ef..06d003007b 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 5b6a7bd8d6..f21b5aa0b8 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 19298a90ab..5e9643ee26 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 574f5e1903..d13b4a637e 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 431287c2df..658ae68337 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 60f1d272ab..dda2ad29a4 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 |