Mercurial > pidgin.yaz
changeset 26522:8df78c06d10e
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.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 05 Apr 2009 08:42:00 +0000 |
parents | c67d43408daa |
children | 98594c5e497e |
files | COPYRIGHT finch/gntblist.c finch/libgnt/gnt.h finch/libgnt/gnttree.c finch/libgnt/gntwm.c finch/plugins/gntgf.c |
diffstat | 6 files changed, 19 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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 <string.h> #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; }
--- 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. */
--- 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 <string.h> #include <ctype.h> -#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; }
--- 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)
--- 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 <blist.h> #include <conversation.h> #include <debug.h> +#include <eventloop.h> #include <util.h> #include <gnt.h> @@ -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); }