# HG changeset patch # User Sadrul Habib Chowdhury # Date 1238920920 0 # Node ID 8df78c06d10e42bd6b6f95a0d16dab04f88d7c26 # Parent c67d43408daaae98b86429a134ff06f2f60d4b5b Save the world. Patch from Arunan Bala to save the world. But instead of saving the cheerleader, he's using g_timeout_add_seconds where possible in place of g_timeout_add. Closes #8831. diff -r c67d43408daa -r 8df78c06d10e COPYRIGHT --- a/COPYRIGHT Sun Apr 05 08:22:22 2009 +0000 +++ b/COPYRIGHT Sun Apr 05 08:42:00 2009 +0000 @@ -19,6 +19,7 @@ Christopher Ayoup Alex Badea John Bailey +Arunan Bala R. Tyler Ballance Chris Banal Luca Barbato diff -r c67d43408daa -r 8df78c06d10e finch/gntblist.c --- a/finch/gntblist.c Sun Apr 05 08:22:22 2009 +0000 +++ b/finch/gntblist.c Sun Apr 05 08:42:00 2009 +0000 @@ -61,7 +61,7 @@ #include #define PREF_ROOT "/finch/blist" -#define TYPING_TIMEOUT 4000 +#define TYPING_TIMEOUT_S 4 #define SHOW_EMPTY_GROUP_TIMEOUT 60 @@ -2016,7 +2016,7 @@ } if (ggblist->typing) - g_source_remove(ggblist->typing); + purple_timeout_remove(ggblist->typing); remove_peripherals(ggblist); if (ggblist->tagged) g_list_free(ggblist->tagged); @@ -2253,7 +2253,7 @@ end: g_free(escnewmessage); if (ggblist->typing) - g_source_remove(ggblist->typing); + purple_timeout_remove(ggblist->typing); ggblist->typing = 0; return FALSE; } @@ -2272,7 +2272,7 @@ /* Move the focus to the entry box */ /* XXX: Make sure the selected status can have a message */ gnt_box_move_focus(GNT_BOX(ggblist->window), 1); - ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); + ggblist->typing = purple_timeout_add_seconds(TYPING_TIMEOUT_S, (GSourceFunc)remove_typing_cb, NULL); } else if (now->type == STATUS_SAVED_ALL) { @@ -2298,7 +2298,7 @@ return FALSE; if (ggblist->typing) - g_source_remove(ggblist->typing); + purple_timeout_remove(ggblist->typing); ggblist->typing = 0; if (text[0] == '\r' && text[1] == 0) @@ -2308,7 +2308,7 @@ return TRUE; } - ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); + ggblist->typing = purple_timeout_add_seconds(TYPING_TIMEOUT_S, (GSourceFunc)remove_typing_cb, NULL); return FALSE; } diff -r c67d43408daa -r 8df78c06d10e finch/libgnt/gnt.h --- a/finch/libgnt/gnt.h Sun Apr 05 08:22:22 2009 +0000 +++ b/finch/libgnt/gnt.h Sun Apr 05 08:42:00 2009 +0000 @@ -48,6 +48,10 @@ #define G_PARAM_STATIC_BLURB G_PARAM_PRIVATE #endif +#if !GLIB_CHECK_VERSION(2,14,0) + #define g_timeout_add_seconds(time, callback, data) g_timeout_add(time * 1000, callback, data) +#endif + /** * Initialize GNT. */ diff -r c67d43408daa -r 8df78c06d10e finch/libgnt/gnttree.c --- a/finch/libgnt/gnttree.c Sun Apr 05 08:22:22 2009 +0000 +++ b/finch/libgnt/gnttree.c Sun Apr 05 08:42:00 2009 +0000 @@ -28,7 +28,7 @@ #include #include -#define SEARCH_TIMEOUT 4000 /* 4 secs */ +#define SEARCH_TIMEOUT_S 4 /* 4 secs */ #define SEARCHING(tree) (tree->priv->search && tree->priv->search->len > 0) #define COLUMN_INVISIBLE(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_INVISIBLE) @@ -821,7 +821,7 @@ gnt_bindable_perform_action_key(GNT_BINDABLE(tree), text); } g_source_remove(tree->priv->search_timeout); - tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree); + tree->priv->search_timeout = g_timeout_add_seconds(SEARCH_TIMEOUT_S, search_timeout, tree); return TRUE; } else if (text[0] == ' ' && text[1] == 0) { /* Space pressed */ @@ -933,7 +933,7 @@ return FALSE; GNT_WIDGET_SET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS); tree->priv->search = g_string_new(NULL); - tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree); + tree->priv->search_timeout = g_timeout_add_seconds(SEARCH_TIMEOUT_S, search_timeout, tree); return TRUE; } diff -r c67d43408daa -r 8df78c06d10e finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Sun Apr 05 08:22:22 2009 +0000 +++ b/finch/libgnt/gntwm.c Sun Apr 05 08:42:00 2009 +0000 @@ -408,7 +408,7 @@ wm->positions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE)) read_window_positions(wm); - g_timeout_add(IDLE_CHECK_INTERVAL * 1000, check_idle, NULL); + g_timeout_add_seconds(IDLE_CHECK_INTERVAL, check_idle, NULL); time(&last_active_time); gnt_wm_switch_workspace(wm, 0); } @@ -2130,7 +2130,7 @@ if (write_timeout) { g_source_remove(write_timeout); } - write_timeout = g_timeout_add(10000, write_already, wm); + write_timeout = g_timeout_add_seconds(10, write_already, wm); } void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y) diff -r c67d43408daa -r 8df78c06d10e finch/plugins/gntgf.c --- a/finch/plugins/gntgf.c Sun Apr 05 08:22:22 2009 +0000 +++ b/finch/plugins/gntgf.c Sun Apr 05 08:42:00 2009 +0000 @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -75,7 +76,7 @@ { toasters = g_list_remove(toasters, toast); gnt_widget_destroy(toast->window); - g_source_remove(toast->timer); + purple_timeout_remove(toast->timer); g_free(toast); } @@ -220,7 +221,7 @@ } gnt_widget_draw(window); - toast->timer = g_timeout_add(4000, (GSourceFunc)remove_toaster, toast); + toast->timer = purple_timeout_add_seconds(4, (GSourceFunc)remove_toaster, toast); toasters = g_list_prepend(toasters, toast); }