changeset 1396:df7c3cacac92

[gaim-migrate @ 1406] Un-Alias option in right-click edit list, and show alias next to name in edit list. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 09 Jan 2001 09:16:19 +0000
parents 567758889707
children d2799e0672ee
files src/buddy.c src/dialogs.c
diffstat 2 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Tue Jan 09 08:29:20 2001 +0000
+++ b/src/buddy.c	Tue Jan 09 09:16:19 2001 +0000
@@ -474,6 +474,18 @@
 	}
 }
 
+static void un_alias(GtkWidget *a, struct buddy *b)
+{
+	struct group *g = find_group_by_buddy(b->gc, b->name);
+	struct group_show *gs = find_group_show(g->name);
+	struct buddy_show *bs;
+	GtkCTreeNode *node = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b);
+	g_snprintf(b->show, sizeof(b->show), "%s", b->name);
+	gtk_ctree_node_set_text(GTK_CTREE(edittree), node, 0, b->name);
+	if (gs) bs = find_buddy_show(gs, b->name);
+	if (bs) gtk_label_set(GTK_LABEL(bs->label), b->name);
+	do_export(0, 0);
+}
 
 static gboolean click_edit_tree(GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
@@ -508,14 +520,25 @@
 			       event->button, event->time);
 	} else if (*type == EDIT_BUDDY) {
 		struct buddy *b = (struct buddy *)type;
+		struct group *g = find_group_by_buddy(b->gc, b->name);
+		struct group_show *gs = find_group_show(g->name);
+		struct buddy_show *bs = find_buddy_show(gs, b->name);
 		menu = gtk_menu_new();
 
 		button = gtk_menu_item_new_with_label(_("Alias"));
 		gtk_signal_connect(GTK_OBJECT(button), "activate",
-				   GTK_SIGNAL_FUNC(pressed_alias), b);
+				   GTK_SIGNAL_FUNC(pressed_alias), bs);
 		gtk_menu_append(GTK_MENU(menu), button);
 		gtk_widget_show(button);
 
+		if (strcmp(b->name, b->show)) {
+			button = gtk_menu_item_new_with_label(_("Un-Alias"));
+			gtk_signal_connect(GTK_OBJECT(button), "activate",
+					   GTK_SIGNAL_FUNC(un_alias), b);
+			gtk_menu_append(GTK_MENU(menu), button);
+			gtk_widget_show(button);
+		}
+
 		button = gtk_menu_item_new_with_label(_("Add Buddy Pounce"));
 		gtk_signal_connect(GTK_OBJECT(button), "activate",
 				   GTK_SIGNAL_FUNC(new_bp_callback), b->name);
@@ -931,9 +954,13 @@
 			mem = g->members;
 
 			while(mem) {
+				char buf[256];
 				b = (struct buddy *)mem->data;
-
-				text[0] = b->name;
+				if (strcmp(b->name, b->show)) {
+					g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, b->show);
+					text[0] = buf;
+				} else
+					text[0] = b->name;
 
 				n = gtk_ctree_insert_node(GTK_CTREE(edittree),
 							  p, NULL, text, 5,
--- a/src/dialogs.c	Tue Jan 09 08:29:20 2001 +0000
+++ b/src/dialogs.c	Tue Jan 09 09:16:19 2001 +0000
@@ -3429,6 +3429,7 @@
 	}
 	do_export(0, 0);
 	destroy_dialog(aliasdlg, aliasdlg);
+	build_edit_tree();
 }
 
 void alias_dialog(struct buddy_show *b)