pidgin: 143e16e9: Save the world.

sadrul at pidgin.im sadrul at pidgin.im
Sun Apr 5 04:50:33 EDT 2009


-----------------------------------------------------------------
Revision: 143e16e91e423b92535ef8aac4bf1158f4a6186c
Ancestor: 68170ae1f29540e16f4dec277f9447650bc2b84c
Author: sadrul at pidgin.im
Date: 2009-04-05T08:42:00
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/143e16e91e423b92535ef8aac4bf1158f4a6186c

Modified files:
        COPYRIGHT finch/gntblist.c finch/libgnt/gnt.h
        finch/libgnt/gnttree.c finch/libgnt/gntwm.c
        finch/plugins/gntgf.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- COPYRIGHT	39de45679de508f5dd401345ca744ee66e42cfd8
+++ COPYRIGHT	c9c9471aa7cb5f9f629531fd00836dc78b0cc3c5
@@ -19,6 +19,7 @@ John Bailey
 Christopher Ayoup
 Alex Badea
 John Bailey
+Arunan Bala
 R. Tyler Ballance
 Chris Banal
 Luca Barbato
============================================================
--- finch/gntblist.c	3ef386709f3bdfa9ec0b4ca5507e505a63254434
+++ finch/gntblist.c	404ab463993fd367b2bd594e1c29a9048eb23cbf
@@ -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 @@ reset_blist_window(GntWidget *window, gp
 	}
 
 	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:
 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 @@ status_selection_changed(GntComboBox *bo
 		/* 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 @@ status_text_changed(GntEntry *entry, con
 		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 @@ status_text_changed(GntEntry *entry, con
 		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;
 }
 
============================================================
--- finch/libgnt/gnt.h	cc7fa9167f0a4223dae74407f4bb7bafa78363a2
+++ finch/libgnt/gnt.h	846e9a41e82cd568adbc30a88cd4673ee6566616
@@ -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.
  */
============================================================
--- finch/libgnt/gnttree.c	c17d41d8069417b8de91e41485c66a8029ebec02
+++ finch/libgnt/gnttree.c	5109f450f37b656762fc0db5269b501f61e1e6b4
@@ -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_tree_key_pressed(GntWidget *widget, 
 			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 @@ start_search(GntBindable *bindable, GLis
 		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;
 }
 
============================================================
--- finch/libgnt/gntwm.c	4f248b7ab0b3d8d3d012f9657aab566e5c937dc6
+++ finch/libgnt/gntwm.c	2162fb2f2676ff2855fdc6f3f990d0353cb10c3b
@@ -408,7 +408,7 @@ gnt_wm_init(GTypeInstance *instance, gpo
 	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 @@ write_positions_to_file(GntWM *wm)
 	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)
============================================================
--- finch/plugins/gntgf.c	9101f962dc5d790f51527ce2a615b925f817dc15
+++ finch/plugins/gntgf.c	d676156ca7a1204b440e9ff8cbc3b28cbe4fa707
@@ -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 @@ destroy_toaster(GntToast *toast)
 {
 	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 @@ notify(PurpleConversation *conv, const c
 	}
 	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);
 }
 


More information about the Commits mailing list