changeset 1036:faa5afc2b89e

[gaim-migrate @ 1046] return of the aliases. bit by bit, day by day. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 31 Oct 2000 09:17:03 +0000
parents 80a47e3b1bca
children 1c663beef29d
files FIXME src/buddy.c src/dialogs.c src/gaim.h
diffstat 4 files changed, 41 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/FIXME	Tue Oct 31 07:36:11 2000 +0000
+++ b/FIXME	Tue Oct 31 09:17:03 2000 +0000
@@ -16,10 +16,14 @@
 
 3. Need to modify the right-click menu for buddies, to include status for the buddy from each
    connection that has it registered, and also to get available actions from each connection
-   that has it registered.
+   that has it registered. DONE
 
-4. Need to get Aliases working again.
+4. Need to get Aliases working again. DONE - I think
 
 5. Need to set number of buddies in group (as an option)
 
 6. Need to not hide empty groups (as an option)
+
+7. Need to do Buddy Pounces on a per-connection basis
+
+8. Need to report logins/outs to convo window
--- a/src/buddy.c	Tue Oct 31 07:36:11 2000 +0000
+++ b/src/buddy.c	Tue Oct 31 09:17:03 2000 +0000
@@ -91,14 +91,6 @@
 static void log_callback(GtkWidget *w, char *name);
 
 /* stuff for actual display of buddy list */
-struct buddy_show {
-	GtkWidget *item;
-	GtkWidget *pix;
-	GtkWidget *label;
-	char *name;
-	GSList *connlist;
-	guint log_timer;
-};
 struct group_show {
 	GtkWidget *item;
 	GtkWidget *label;
@@ -252,8 +244,7 @@
 
 void pressed_alias(GtkWidget *widget, struct buddy_show *b)
 {
-	struct buddy *m = find_buddy(connections->data, b->name);
-	alias_dialog(m);
+	alias_dialog(b);
 }
 
 void handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b)
@@ -1289,13 +1280,14 @@
 	return g;
 }
 
-static struct buddy_show *new_buddy_show(struct group_show *gs, char *buddy) {
+static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy) {
 	struct buddy_show *b = g_new0(struct buddy_show, 1);
 	GtkWidget *box;
 	GdkPixmap *pm;
 	GdkBitmap *bm;
 
-	b->name = g_strdup(buddy);
+	b->name = g_strdup(buddy->name);
+	b->show = g_strdup(buddy->show);
 
 	b->item = gtk_tree_item_new();
 	/* FIXME */
@@ -1316,7 +1308,7 @@
 	gdk_pixmap_unref(pm);
 	gdk_bitmap_unref(bm);
 
-	b->label = gtk_label_new(buddy);
+	b->label = gtk_label_new(buddy->show);
 	gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5);
 	gtk_box_pack_start(GTK_BOX(box), b->label, TRUE, TRUE, 1);
 	gtk_widget_show(b->label);
@@ -1360,6 +1352,7 @@
 			g_free(g);
 		}
 		g_free(b->name);
+		g_free(b->show);
 		g_free(b);
 	} else {
 		/* um.... what do we have to do here? just update the pixmap? */
@@ -1397,7 +1390,7 @@
 		if ((gs = find_group_show(g->name)) == NULL)
 			gs = new_group_show(g->name);
 		if ((bs = find_buddy_show(gs, b->name)) == NULL)
-			bs = new_buddy_show(gs, b->name);
+			bs = new_buddy_show(gs, b);
 		if (b->present == 1) {
 			play_sound(BUDDY_ARRIVE);
 			b->present = 2;
--- a/src/dialogs.c	Tue Oct 31 07:36:11 2000 +0000
+++ b/src/dialogs.c	Tue Oct 31 09:17:03 2000 +0000
@@ -3216,30 +3216,25 @@
 	return;
 }
 
-static void do_alias(GtkWidget *w, gpointer n)
+static void do_alias(GtkWidget *w, struct buddy_show *b)
 {
-	char *name, *who;
-	struct buddy *b;
-	name = g_strdup(gtk_entry_get_text(GTK_ENTRY(aliasentry)));
-	/* FIXME */
-	if ((b = find_buddy(connections->data, name)) == NULL) {
-		g_free(name);
-		destroy_dialog(aliasdlg, aliasdlg);
-		return;
+	GSList *c = b->connlist;
+	struct gaim_connection *g;
+	struct buddy *n;
+	g_free(b->show);
+	b->show = g_strdup(gtk_entry_get_text(GTK_ENTRY(aliasname)));
+	gtk_label_set(GTK_LABEL(b->label), b->show);
+	while (c) {
+		g = (struct gaim_connection *)c->data;
+		n = find_buddy(g, b->name);
+		if (n) g_snprintf(n->show, sizeof(n->show), "%s", b->show);
+		c = c->next;
 	}
-	g_snprintf(b->show, sizeof(b->show), "%s", gtk_entry_get_text(GTK_ENTRY(aliasname)));
 	do_export(0, 0);
-	who = g_malloc(sizeof(b->show) + 10);
-	strcpy(who, b->show);
-	/* FIXME */
-	/* gtk_label_set(GTK_LABEL(b->label), who); */
-	g_free(who);
-	/* set_buddy(b); */
-	g_free(name);
 	destroy_dialog(aliasdlg, aliasdlg);
 }
 
-void alias_dialog(struct buddy *b)
+void alias_dialog(struct buddy_show *b)
 {
 	GtkWidget *frame;
 	GtkWidget *vbox;
@@ -3269,7 +3264,7 @@
 	aliasname = gtk_entry_new();
         /* Put the buttons in the box */
 
-	add = picture_button(aliasdlg, _("Add"), add_xpm);
+	add = picture_button(aliasdlg, _("Alias"), add_xpm);
 
 	cancel = picture_button(aliasdlg, _("Cancel"), cancel_xpm);
 
@@ -3301,11 +3296,11 @@
         gtk_signal_connect(GTK_OBJECT(cancel), "clicked",
                            GTK_SIGNAL_FUNC(destroy_dialog), aliasdlg);
         gtk_signal_connect(GTK_OBJECT(add), "clicked",
-                           GTK_SIGNAL_FUNC(do_alias), NULL);
+                           GTK_SIGNAL_FUNC(do_alias), b);
         gtk_signal_connect(GTK_OBJECT(aliasentry), "activate",
-                           GTK_SIGNAL_FUNC(do_alias), NULL);
+                           GTK_SIGNAL_FUNC(do_alias), b);
 	gtk_signal_connect(GTK_OBJECT(aliasname), "activate",
-			   GTK_SIGNAL_FUNC(do_alias), NULL);
+			   GTK_SIGNAL_FUNC(do_alias), b);
         /* Finish up */
         gtk_widget_show(add);
         gtk_widget_show(cancel);
--- a/src/gaim.h	Tue Oct 31 07:36:11 2000 +0000
+++ b/src/gaim.h	Tue Oct 31 09:17:03 2000 +0000
@@ -226,6 +226,16 @@
 	u_short caps; /* woohoo! */
 };
 
+struct buddy_show {
+	GtkWidget *item;
+	GtkWidget *pix;
+	GtkWidget *label;
+	char *name;
+	char *show;
+	GSList *connlist;
+	guint log_timer;
+};
+
 struct log_conversation {
 	char name[80];
 	char filename[512];
@@ -798,7 +808,7 @@
 
 
 /* Functions in dialogs.c */
-extern void alias_dialog(struct buddy *);
+extern void alias_dialog(struct buddy_show *);
 extern void do_export(GtkWidget *, void *);
 extern void show_warn_dialog(struct gaim_connection *, char *);
 extern void do_error_dialog(char *, char *);