changeset 8287:ef881489396e

[gaim-migrate @ 9011] Another patch from Scott Lamb to change g_source_remove calls to gaim_timeout_remove. It also implements gaim_timeout_remove. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 18 Feb 2004 07:43:21 +0000
parents 89d9d004e3f3
children dde73afb3283
files src/account.c src/blist.c src/connection.c src/conversation.c src/eventloop.c src/eventloop.h src/gaim-disclosure.c src/gtkeventloop.c src/gtkroomlist.c src/pounce.c src/prefs.c src/protocols/icq/gaim_icq.c src/protocols/irc/irc.c src/protocols/msn/httpmethod.c src/protocols/msn/servconn.c src/protocols/oscar/oscar.c src/protocols/zephyr/zephyr.c src/server.c src/win32/win32dep.c
diffstat 19 files changed, 50 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/account.c	Wed Feb 18 07:43:21 2004 +0000
@@ -1659,7 +1659,7 @@
 gaim_accounts_uninit(void)
 {
 	if (accounts_save_timer != 0) {
-		g_source_remove(accounts_save_timer);
+		gaim_timeout_remove(accounts_save_timer);
 		accounts_save_timer = 0;
 		gaim_accounts_sync();
 	}
--- a/src/blist.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/blist.c	Wed Feb 18 07:43:21 2004 +0000
@@ -296,7 +296,7 @@
 
 	if(do_something) {
 		if(buddy->timer > 0)
-			g_source_remove(buddy->timer);
+			gaim_timeout_remove(buddy->timer);
 		buddy->timer = gaim_timeout_add(10000, (GSourceFunc)presence_update_timeout_cb, buddy);
 
 		gaim_contact_compute_priority_buddy(gaim_buddy_get_contact(buddy));
@@ -1103,7 +1103,7 @@
 	g_free(hb.name);
 
 	if(buddy->timer > 0)
-		g_source_remove(buddy->timer);
+		gaim_timeout_remove(buddy->timer);
 
 	if (buddy->icon != NULL)
 		gaim_buddy_icon_unref(buddy->icon);
--- a/src/connection.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/connection.c	Wed Feb 18 07:43:21 2004 +0000
@@ -87,7 +87,7 @@
 		g_free(gc->away_state);
 
 	if (gc->disconnect_timeout)
-		g_source_remove(gc->disconnect_timeout);
+		gaim_timeout_remove(gc->disconnect_timeout);
 
 	g_free(gc);
 }
--- a/src/conversation.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/conversation.c	Wed Feb 18 07:43:21 2004 +0000
@@ -1592,7 +1592,7 @@
 	if (im->typing_timeout == 0)
 		return;
 
-	g_source_remove(im->typing_timeout);
+	gaim_timeout_remove(im->typing_timeout);
 	im->typing_timeout = 0;
 }
 
@@ -1637,7 +1637,7 @@
 	if (im->type_again_timeout == 0)
 		return;
 
-	g_source_remove(im->type_again_timeout);
+	gaim_timeout_remove(im->type_again_timeout);
 	im->type_again_timeout = 0;
 }
 
--- a/src/eventloop.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/eventloop.c	Wed Feb 18 07:43:21 2004 +0000
@@ -34,6 +34,14 @@
 	return ops->timeout_add(interval, function, data);
 }
 
+void
+gaim_timeout_remove(guint tag)
+{
+	GaimEventLoopUiOps *ops = gaim_eventloop_get_ui_ops();
+
+	return ops->timeout_remove(tag);
+}
+
 guint
 gaim_input_add(int source, GaimInputCondition condition, GaimInputFunction func, gpointer user_data)
 {
--- a/src/eventloop.h	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/eventloop.h	Wed Feb 18 07:43:21 2004 +0000
@@ -54,6 +54,12 @@
 	guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data);
 
 	/**
+	 * Removes a callback timer.
+	 * @see gaim_timeout_remove, g_source_remove
+	 */
+	guint (*timeout_remove)(guint handle);
+
+	/**
 	 * Adds an input handler.
 	 * @see gaim_input_add, g_io_add_watch_full
 	 */
@@ -83,6 +89,13 @@
 guint gaim_timeout_add(guint interval, GSourceFunc function, gpointer data);
 
 /**
+ * Removes a timeout handler.
+ *
+ * @param handle The handle, as returned by gaim_timeout_add.
+ */
+void gaim_timeout_remove(guint handle);
+
+/**
  * Adds an input handler.
  *
  * @param fd        The input file descriptor.
--- a/src/gaim-disclosure.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/gaim-disclosure.c	Wed Feb 18 07:43:21 2004 +0000
@@ -188,7 +188,7 @@
 	      gboolean opening)
 {
 	if (disclosure->priv->expand_id > 0) {
-		g_source_remove(disclosure->priv->expand_id);
+		gaim_timeout_remove(disclosure->priv->expand_id);
 	}
 
 	disclosure->priv->direction = opening ? 1 : -1;
--- a/src/gtkeventloop.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/gtkeventloop.c	Wed Feb 18 07:43:21 2004 +0000
@@ -92,19 +92,12 @@
 	return closure->result;
 }
 
-static void gaim_gtk_input_remove(guint tag)
-{
-	/* gaim_debug(GAIM_DEBUG_MISC, "proxy",
-	              "CLOSURE: removing input watcher %d\n", tag); */
-	if (tag > 0)
-		g_source_remove(tag);
-}
-
 static GaimEventLoopUiOps eventloop_ops =
 {
 	g_timeout_add,
+	g_source_remove,
 	gaim_gtk_input_add,
-	gaim_gtk_input_remove
+	g_source_remove
 };
 
 GaimEventLoopUiOps *
--- a/src/gtkroomlist.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/gtkroomlist.c	Wed Feb 18 07:43:21 2004 +0000
@@ -79,7 +79,7 @@
 
 	if (dialog->roomlist) {
 		if (dialog->pg_to_active) {
-			g_source_remove(dialog->pg_update_to);
+			gaim_timeout_remove(dialog->pg_update_to);
 			dialog->pg_to_active = FALSE;
 			/* yes, that's right, unref it twice. */
 			gaim_roomlist_unref(dialog->roomlist);
--- a/src/pounce.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/pounce.c	Wed Feb 18 07:43:21 2004 +0000
@@ -1008,7 +1008,7 @@
 gaim_pounces_uninit()
 {
 	if (pounces_save_timer != 0) {
-		g_source_remove(pounces_save_timer);
+		gaim_timeout_remove(pounces_save_timer);
 		pounces_save_timer = 0;
 		gaim_pounces_sync();
 	}
--- a/src/prefs.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/prefs.c	Wed Feb 18 07:43:21 2004 +0000
@@ -135,7 +135,7 @@
 gaim_prefs_uninit()
 {
 	if (prefs_save_timer != 0) {
-		g_source_remove(prefs_save_timer);
+		gaim_timeout_remove(prefs_save_timer);
 		prefs_save_timer = 0;
 		gaim_prefs_sync();
 	}
--- a/src/protocols/icq/gaim_icq.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/protocols/icq/gaim_icq.c	Wed Feb 18 07:43:21 2004 +0000
@@ -148,7 +148,7 @@
 	if (interval > 0 && ack_timer == 0)
 		ack_timer = gaim_timeout_add(interval * 1000, icq_set_timeout_cb, NULL);
 	else if (ack_timer > 0) {
-		g_source_remove(ack_timer);
+		gaim_timeout_remove(ack_timer);
 		ack_timer = 0;
 	}
 }
--- a/src/protocols/irc/irc.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/protocols/irc/irc.c	Wed Feb 18 07:43:21 2004 +0000
@@ -270,12 +270,12 @@
 	irc_cmd_quit(irc, "quit", NULL, NULL);
 
 	if (gc->inpa)
-		g_source_remove(gc->inpa);
+		gaim_timeout_remove(gc->inpa);
 
 	g_free(irc->inbuf);
 	close(irc->fd);
 	if (irc->timer)
-		g_source_remove(irc->timer);
+		gaim_timeout_remove(irc->timer);
 	g_hash_table_destroy(irc->cmds);
 	g_hash_table_destroy(irc->msgs);
 	if (irc->motd)
--- a/src/protocols/msn/httpmethod.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/protocols/msn/httpmethod.c	Wed Feb 18 07:43:21 2004 +0000
@@ -67,7 +67,7 @@
 	if (servconn->http_data->timer)
 	{
 		gaim_debug(GAIM_DEBUG_INFO, "msn", "Stopping timer\n");
-		g_source_remove(servconn->http_data->timer);
+		gaim_timeout_remove(servconn->http_data->timer);
 		servconn->http_data->timer = 0;
 	}
 }
--- a/src/protocols/msn/servconn.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/protocols/msn/servconn.c	Wed Feb 18 07:43:21 2004 +0000
@@ -280,7 +280,7 @@
 			g_free(servconn->http_data->gateway_ip);
 
 		if (servconn->http_data->timer)
-			g_source_remove(servconn->http_data->timer);
+			gaim_timeout_remove(servconn->http_data->timer);
 
 		g_free(servconn->http_data);
 	}
--- a/src/protocols/oscar/oscar.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Feb 18 07:43:21 2004 +0000
@@ -790,9 +790,9 @@
 	if (od->icopa > 0)
 		gaim_input_remove(od->icopa);
 	if (od->icontimer > 0)
-		g_source_remove(od->icontimer);
+		gaim_timeout_remove(od->icontimer);
 	if (od->getblisttimer)
-		g_source_remove(od->getblisttimer);
+		gaim_timeout_remove(od->getblisttimer);
 	aim_session_kill(od->sess);
 	g_free(od->sess);
 	od->sess = NULL;
@@ -1463,7 +1463,7 @@
 	od->iconconnecting = FALSE;
 
 	if (od->icontimer)
-		g_source_remove(od->icontimer);
+		gaim_timeout_remove(od->icontimer);
 	od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc);
 
 	return 1;
@@ -1882,7 +1882,7 @@
 			if (!cur) {
 				od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn)));
 				if (od->icontimer)
-					g_source_remove(od->icontimer);
+					gaim_timeout_remove(od->icontimer);
 				od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc);
 			}
 		}
@@ -3496,7 +3496,7 @@
 	free(sn);
 
 	if (od->icontimer)
-		g_source_remove(od->icontimer);
+		gaim_timeout_remove(od->icontimer);
 	od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc);
 
 	return 1;
@@ -3544,7 +3544,7 @@
 	}
 
 	if (od->icontimer)
-		g_source_remove(od->icontimer);
+		gaim_timeout_remove(od->icontimer);
 	od->icontimer = gaim_timeout_add(250, gaim_icon_timerfunc, gc);
 
 	return 1;
--- a/src/protocols/zephyr/zephyr.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/protocols/zephyr/zephyr.c	Wed Feb 18 07:43:21 2004 +0000
@@ -797,10 +797,10 @@
 	g_slist_free(subscrips);
 	
 	if (nottimer)
-		g_source_remove(nottimer);
+		gaim_timeout_remove(nottimer);
 	nottimer = 0;
 	if (loctimer)
-		g_source_remove(loctimer);
+		gaim_timeout_remove(loctimer);
 	loctimer = 0;
 	zgc = NULL;
 	z_call(ZCancelSubscriptions(0));
--- a/src/server.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/server.c	Wed Feb 18 07:43:21 2004 +0000
@@ -90,7 +90,7 @@
 		gc->keep_alive = gaim_timeout_add(60000, send_keepalive, gc);
 	} else if (!on && gc->keep_alive > 0) {
 		gaim_debug(GAIM_DEBUG_INFO, "server", "removing NOP\n");
-		g_source_remove(gc->keep_alive);
+		gaim_timeout_remove(gc->keep_alive);
 		gc->keep_alive = 0;
 	}
 }
@@ -108,7 +108,7 @@
 	}
 
 	if (gc->idle_timer > 0)
-		g_source_remove(gc->idle_timer);
+		gaim_timeout_remove(gc->idle_timer);
 	gc->idle_timer = 0;
 
 	update_keepalive(gc, FALSE);
@@ -152,7 +152,7 @@
 	}
 
 	if (gc->idle_timer > 0)
-		g_source_remove(gc->idle_timer);
+		gaim_timeout_remove(gc->idle_timer);
 
 	gc->idle_timer = gaim_timeout_add(20000, check_idle, gc);
 	serv_touch_idle(gc);
--- a/src/win32/win32dep.c	Wed Feb 18 07:22:53 2004 +0000
+++ b/src/win32/win32dep.c	Wed Feb 18 07:43:21 2004 +0000
@@ -128,7 +128,7 @@
                 WGAIM_FLASH_INFO *finfo = data;        
                 /* Stop flashing and remove filter */
                 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Removing timeout\n");
-                g_source_remove(finfo->t_handle);
+                gaim_timeout_remove(finfo->t_handle);
                 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "Disconnecting signal handler\n");
                 g_signal_handler_disconnect(G_OBJECT(widget),finfo->sig_handler);
                 gaim_debug(GAIM_DEBUG_INFO, "wgaim", "done\n");