changeset 4397:ce3a0eba91ef

[gaim-migrate @ 4666] The add/remove button is fixed. Thanks ari. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 22 Jan 2003 23:20:09 +0000
parents 868ee63e1fe8
children a8249a5250b6
files src/dialogs.c src/gtkconv.c
diffstat 2 files changed, 29 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Wed Jan 22 23:17:13 2003 +0000
+++ b/src/dialogs.c	Wed Jan 22 23:20:09 2003 +0000
@@ -452,6 +452,7 @@
 {
 	struct group *g = find_group_by_buddy(b);
 	struct gaim_conversation *c;
+	gchar *name = g_strdup(b->name); /* b->name is null after remove_buddy */
 
 	if (!b)
 		return;
@@ -459,14 +460,16 @@
 	g = find_group_by_buddy(b);
 
 	debug_printf(_("Removing '%s' from buddy list.\n"), b->name);
-	serv_remove_buddy(b->user->gc, b->name, g->name);
+	serv_remove_buddy(b->user->gc, name, g->name);
 	remove_buddy(b);
 	gaim_blist_save();
 
-	c = gaim_find_conversation(b->name);
+	c = gaim_find_conversation(name);
 
 	if (c != NULL)
 		gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE);
+
+	g_free(name);
 }
 
 void show_confirm_del(struct gaim_connection *gc, gchar *name)
--- a/src/gtkconv.c	Wed Jan 22 23:17:13 2003 +0000
+++ b/src/gtkconv.c	Wed Jan 22 23:20:09 2003 +0000
@@ -3501,7 +3501,6 @@
 	struct gaim_connection *gc;
 	GaimConversationType type;
 	GtkWidget *parent;
-	gboolean rebuild = FALSE;
 
 	type    = gaim_conversation_get_type(conv);
 	gc      = gaim_conversation_get_gc(conv);
@@ -3509,46 +3508,33 @@
 	parent  = gtk_widget_get_parent(gtkconv->u.im->add);
 
 	if (find_buddy(gc->user, gaim_conversation_get_name(conv))) {
-		if (!g_object_get_data(G_OBJECT(gtkconv->u.im->add), "user_data")) {
-			gtkconv->u.im->add =
-				gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add,
-									 GTK_STOCK_REMOVE, type);
-			gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add,
-				_("Remove the user from your buddy list"), NULL);
-
-			rebuild = TRUE;
-		}
-		
+		gtkconv->u.im->add =
+			gaim_gtk_change_text(_("Remove"), gtkconv->u.im->add,
+								 GTK_STOCK_REMOVE, type);
+		gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add,
+			_("Remove the user from your buddy list"), NULL);
+
 		gtk_widget_set_sensitive(gtkconv->u.im->add,
 			(gc != NULL && gc->prpl->remove_buddy != NULL));
-
-		g_object_set_data(G_OBJECT(gtkconv->u.im->add), "user_data", conv);
-
 	} else {
-		if (g_object_get_data(G_OBJECT(gtkconv->u.im->add), "user_data")) {
-			gtkconv->u.im->add =
-				gaim_gtk_change_text(_("Add"), gtkconv->u.im->add,
-									 GTK_STOCK_ADD, type);
-			gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add,
-				_("Add the user to your buddy list"), NULL);
-
-			rebuild = TRUE;
-		}
+		gtkconv->u.im->add =
+			gaim_gtk_change_text(_("Add"), gtkconv->u.im->add,
+								 GTK_STOCK_ADD, type);
+		gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->u.im->add,
+			_("Add the user to your buddy list"), NULL);
 
 		gtk_widget_set_sensitive(gtkconv->u.im->add,
 			(gc != NULL && gc->prpl->add_buddy != NULL));
 	}
 
-	if (rebuild) {
-		g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked",
-						 G_CALLBACK(add_cb), conv);
-
-		gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add,
-						   FALSE, FALSE, 0);
-		gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3);
-		gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE);
-		gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add);
-	}
+	g_signal_connect(G_OBJECT(gtkconv->u.im->add), "clicked",
+					 G_CALLBACK(add_cb), conv);
+
+	gtk_box_pack_start(GTK_BOX(parent), gtkconv->u.im->add,
+					   FALSE, FALSE, 0);
+	gtk_box_reorder_child(GTK_BOX(parent), gtkconv->u.im->add, 3);
+	gtk_button_set_relief(GTK_BUTTON(gtkconv->u.im->add), GTK_RELIEF_NONE);
+	gtk_size_group_add_widget(gtkconv->sg, gtkconv->u.im->add);
 }
 
 struct gaim_window_ops *
@@ -4161,6 +4147,11 @@
 
 		generate_send_as_items(win, NULL);
 	}
+	else if(type == GAIM_CONV_UPDATE_ADD ||
+			type == GAIM_CONV_UPDATE_REMOVE) {
+		
+		update_convo_add_button(conv);
+	}
 }
 
 static struct gaim_conversation_ops conversation_ops =