changeset 2131:acc11216ec5d

[gaim-migrate @ 2141] changing some gtk_timeout stuff to g_timeout (since it's likely that these will be used in core rather than gtk-ui). also fixed a small buddy pounce bug. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 06 Aug 2001 23:38:48 +0000
parents 50c7a704ee56
children a6b9983cead1
files src/buddy.c src/gaim.h src/plugins.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/oscar/oscar.c src/protocols/zephyr/zephyr.c src/server.c
diffstat 8 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/buddy.c	Mon Aug 06 23:38:48 2001 +0000
@@ -1695,7 +1695,7 @@
 	save_prefs();
 }
 
-void do_pounce(char *name, int when)
+void do_pounce(struct gaim_connection *gc, char *name, int when)
 {
         char *who;
         
@@ -1717,7 +1717,7 @@
 		if (u == NULL) continue;
 
 		/* check and see if we're signed on as the pouncer */
-		if (u->gc == NULL) continue;
+		if (u->gc != gc) continue;
 		
                 if (!g_strcasecmp(who, normalize(b->name))) { /* find someone to pounce */
 			if (b->options & OPT_POUNCE_POPUP) {
--- a/src/gaim.h	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/gaim.h	Mon Aug 06 23:38:48 2001 +0000
@@ -750,7 +750,7 @@
 extern void build_edit_tree();
 extern void remove_person(struct group *, struct buddy *);
 extern void remove_category(struct group *);
-extern void do_pounce(char *, int);
+extern void do_pounce(struct gaim_connection *, char *, int);
 extern void do_bp_menu();
 extern struct buddy *find_buddy(struct gaim_connection *, char *);
 extern struct group *find_group(struct gaim_connection *, char *);
--- a/src/plugins.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/plugins.c	Mon Aug 06 23:38:48 2001 +0000
@@ -477,7 +477,7 @@
 void gaim_plugin_unload(GModule *handle)
 {
 	unload_for_real(handle);
-	gtk_timeout_add(5000, (GtkFunction)unload_timeout, handle);
+	g_timeout_add(5000, unload_timeout, handle);
 }
 
 static void plugin_reload_cb(GtkWidget *w, gpointer data)
--- a/src/protocols/irc/irc.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/protocols/irc/irc.c	Mon Aug 06 23:38:48 2001 +0000
@@ -109,7 +109,7 @@
 	return;
 }
 
-static void irc_request_buddy_update(struct gaim_connection *gc)
+static gboolean irc_request_buddy_update(struct gaim_connection *gc)
 {
 	struct irc_data *idata = (struct irc_data *)gc->proto_data;
 	GSList *grp = gc->groups;
@@ -126,7 +126,7 @@
 
 	/* First, let's check to see if we have anyone on our buddylist */
 	if (!grp) {
-		return;
+		return TRUE;
 	}
 
 	/* Send the first part of our request */
@@ -159,6 +159,7 @@
 		grp = g_slist_next(grp);
 	}
 	write(idata->fd, "\n", 1);
+	return TRUE;
 }
 
 
@@ -1826,7 +1827,7 @@
 	g_free(buf);
 
 	if (idata->timer)
-		gtk_timeout_remove(idata->timer);
+		g_source_remove(idata->timer);
 
 	while (chats) {
 		cc = (struct irc_channel *)chats->data;
@@ -1905,7 +1906,7 @@
 		do_import(NULL, gc);
 
 	/* we don't call this now because otherwise some IRC servers might not like us */
-	idata->timer = gtk_timeout_add(20000, (GtkFunction) irc_request_buddy_update, gc);
+	idata->timer = g_timeout_add(20000, irc_request_buddy_update, gc);
 }
 
 static void irc_login(struct aim_user *user)
--- a/src/protocols/jabber/jabber.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/protocols/jabber/jabber.c	Mon Aug 06 23:38:48 2001 +0000
@@ -1209,7 +1209,7 @@
 	g_hash_table_destroy(jd->hash);
 	gaim_input_remove(gc->inpa);
 	close(jd->jc->fd);
-	gtk_timeout_add(50, jabber_free, jd->jc);
+	g_timeout_add(50, jabber_free, jd->jc);
 	jd->jc = NULL;
 	g_free(jd);
 	gc->proto_data = NULL;
--- a/src/protocols/oscar/oscar.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/protocols/oscar/oscar.c	Mon Aug 06 23:38:48 2001 +0000
@@ -522,7 +522,7 @@
 		if (n->unanim)
 			gdk_pixbuf_unref(n->unanim);
 		if (n->timer)
-			gtk_timeout_remove(n->timer);
+			g_source_remove(n->timer);
 		if (n->cnv && n->pix)
 			gtk_container_remove(GTK_CONTAINER(n->cnv->bbox), n->pix);
 		g_free(n->user);
@@ -1668,7 +1668,7 @@
 	}
 	ir->curframe = (ir->curframe + 1) % g_list_length(frames);
 	delay = MAX(gdk_pixbuf_frame_get_delay_time(frame), 13);
-	ir->timer = gtk_timeout_add(delay * 10, redraw_anim, ir);
+	ir->timer = g_timeout_add(delay * 10, redraw_anim, ir);
 	return FALSE;
 }
 #endif
@@ -1822,7 +1822,7 @@
 				gdk_pixbuf_unref(ir->unanim);
 			ir->unanim = NULL;
 			if (ir->timer)
-				gtk_timeout_remove(ir->timer);
+				g_source_remove(ir->timer);
 			ir->timer = 0;
 
 			ir->length = args->info.icon.length;
@@ -1852,7 +1852,7 @@
 					int delay =
 						MAX(gdk_pixbuf_frame_get_delay_time(frames->data), 13);
 					ir->curframe = 1;
-					ir->timer = gtk_timeout_add(delay * 10, redraw_anim, ir);
+					ir->timer = g_timeout_add(delay * 10, redraw_anim, ir);
 				}
 			} else {
 				ir->unanim = gdk_pixbuf_loader_get_pixbuf(load);
@@ -3221,7 +3221,7 @@
 		if (gdk_pixbuf_animation_get_num_frames(ir->anim) > 1) {
 			int delay = MAX(gdk_pixbuf_frame_get_delay_time(frames->data), 13);
 			ir->curframe = 1;
-			ir->timer = gtk_timeout_add(delay * 10, redraw_anim, ir);
+			ir->timer = g_timeout_add(delay * 10, redraw_anim, ir);
 		}
 	} else {
 		ir->unanim = gdk_pixbuf_loader_get_pixbuf(load);
@@ -3283,7 +3283,7 @@
 	ir->curframe = 0;
 	
 	if (ir->timer)
-		gtk_timeout_remove(ir->timer);
+		g_source_remove(ir->timer);
 	ir->timer = 0;
 #endif
 }
--- a/src/protocols/zephyr/zephyr.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/protocols/zephyr/zephyr.c	Mon Aug 06 23:38:48 2001 +0000
@@ -584,8 +584,8 @@
 	process_anyone();
 	process_zsubs();
 
-	nottimer = gtk_timeout_add(100, check_notify, NULL);
-	loctimer = gtk_timeout_add(2000, check_loc, NULL);
+	nottimer = g_timeout_add(100, check_notify, NULL);
+	loctimer = g_timeout_add(2000, check_loc, NULL);
 }
 
 static void write_zsubs()
@@ -669,10 +669,10 @@
 	g_slist_free(subscrips);
 	
 	if (nottimer)
-		gtk_timeout_remove(nottimer);
+		g_source_remove(nottimer);
 	nottimer = 0;
 	if (loctimer)
-		gtk_timeout_remove(loctimer);
+		g_source_remove(loctimer);
 	loctimer = 0;
 	zgc = NULL;
 	z_call(ZCancelSubscriptions(0));
--- a/src/server.c	Mon Aug 06 21:47:17 2001 +0000
+++ b/src/server.c	Mon Aug 06 23:38:48 2001 +0000
@@ -69,11 +69,11 @@
 	}
 
 	if (gc->idle_timer > 0)
-		gtk_timeout_remove(gc->idle_timer);
+		g_source_remove(gc->idle_timer);
 	gc->idle_timer = 0;
 
 	if (gc->keepalive > 0)
-		gtk_timeout_remove(gc->keepalive);
+		g_source_remove(gc->keepalive);
 	gc->keepalive = 0;
 
 	if (gc->prpl && gc->prpl->close)
@@ -105,9 +105,9 @@
 	}
 
 	if (gc->idle_timer > 0)
-		gtk_timeout_remove(gc->idle_timer);
+		g_source_remove(gc->idle_timer);
 
-	gc->idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, gc);
+	gc->idle_timer = g_timeout_add(20000, (GtkFunction)check_idle, gc);
 	serv_touch_idle(gc);
 
 	time(&gc->login_time);
@@ -651,7 +651,7 @@
 		system_log(log_idle, gc, b, OPT_LOG_BUDDY_IDLE);
 	}
 	if (b->idle && !idle) {
-		do_pounce(b->name, OPT_POUNCE_UNIDLE);
+		do_pounce(gc, b->name, OPT_POUNCE_UNIDLE);
 		plugin_event(event_buddy_unidle, gc, b->name, 0, 0);
 		system_log(log_unidle, gc, b, OPT_LOG_BUDDY_IDLE);
 	}
@@ -660,7 +660,7 @@
 	b->evil = evil;
 
 	if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) {
-		do_pounce(b->name, OPT_POUNCE_UNAWAY);
+		do_pounce(gc, b->name, OPT_POUNCE_UNAWAY);
 		plugin_event(event_buddy_back, gc, b->name, 0, 0);
 		system_log(log_back, gc, b, OPT_LOG_BUDDY_AWAY);
 	} else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) {
@@ -677,7 +677,7 @@
 	if (loggedin) {
 		if (!b->present) {
 			b->present = 1;
-			do_pounce(b->name, OPT_POUNCE_SIGNON);
+			do_pounce(gc, b->name, OPT_POUNCE_SIGNON);
 			plugin_event(event_buddy_signon, gc, b->name, 0, 0);
 			system_log(log_signon, gc, b, OPT_LOG_BUDDY_SIGNON);
 		}
@@ -931,10 +931,10 @@
 {
 	if (on && !gc->keepalive && blist) {
 		debug_printf("allowing NOP\n");
-		gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc);
+		gc->keepalive = g_timeout_add(60000, (GtkFunction)send_keepalive, gc);
 	} else if (!on && gc->keepalive > 0) {
 		debug_printf("removing NOP\n");
-		gtk_timeout_remove(gc->keepalive);
+		g_source_remove(gc->keepalive);
 		gc->keepalive = 0;
 	}
 }