changeset 3278:30ca1b76ad0c

[gaim-migrate @ 3296] Aliases in buddy ticker, inspired by Jeff Stuart. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 29 May 2002 00:24:41 +0000
parents ec20536eaeb0
children 86fdd015f40e
files ChangeLog src/buddy.c src/prefs.c src/ticker.c src/ui.h
diffstat 5 files changed, 56 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 28 08:40:48 2002 +0000
+++ b/ChangeLog	Wed May 29 00:24:41 2002 +0000
@@ -20,7 +20,8 @@
 	  the hat to Christian Hammond for the graphic)
 	* Conversation struct has pointer to toolbar (thanks Brent
 	  Priddy and Paul Miller)
-	* Zephyr fixes (thanks, (Arun A. Tharuvai)
+	* Zephyr fixes (thanks, Arun A. Tharuvai)
+	* Aliases in buddy ticker
 
 version 0.58 (05/13/2002):
 	* Bulgarian translation added (Thanks, Igel Itzo)
--- a/src/buddy.c	Tue May 28 08:40:48 2002 +0000
+++ b/src/buddy.c	Wed May 29 00:24:41 2002 +0000
@@ -300,6 +300,8 @@
 		}
 		update_num_group(gs);
 	} else {
+		if (misc_options & OPT_MISC_BUDDY_TICKER)
+			BuddyTickerSetAlias(b->name, b->show);
 		gtk_label_set_text(GTK_LABEL(bs->label), b->show);
 		update_idle_time(bs);
 	}
@@ -2313,7 +2315,7 @@
 			gtk_pixmap_set(GTK_PIXMAP(bs->pix), pm, bm);
 			gtk_widget_show(bs->pix);
 			if (misc_options & OPT_MISC_BUDDY_TICKER) {
-				BuddyTickerAddUser(b->name, pm, bm);
+				BuddyTickerAddUser(b->name, b->show, pm, bm);
 				gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogonTimeout, b->name);
 			}
 			gdk_pixmap_unref(pm);
--- a/src/prefs.c	Tue May 28 08:40:48 2002 +0000
+++ b/src/prefs.c	Wed May 29 00:24:41 2002 +0000
@@ -965,7 +965,7 @@
 		gtk_widget_set_sensitive(opt, FALSE);
 	gaim_button(_("Raise windows on events"), &im_options, OPT_IM_POPUP, vbox2);
 	gaim_button(_("Show logins in window"), &im_options, OPT_IM_LOGON, vbox2);
-	gaim_button(_("Show aliases in tabs/titles"), &im_options, OPT_IM_ALIAS_TAB, vbox2);
+	gaim_button(_("Show aliases in tabs/titles/ticker"), &im_options, OPT_IM_ALIAS_TAB, vbox2);
 	gaim_button(_("Hide window on send"), &im_options, OPT_IM_POPDOWN, vbox2);
 
 	frame = gtk_frame_new(_("Window Sizes"));
@@ -2750,8 +2750,10 @@
 	if (option == OPT_IM_HIDE_ICONS)
 		set_hide_icons();
 
-	if (option == OPT_IM_ALIAS_TAB)
+	if (option == OPT_IM_ALIAS_TAB) {
 		set_convo_titles();
+		BuddyTickerSetNames();
+	}
 
 	if (option == OPT_IM_NO_ANIMATION)
 		set_anim();
--- a/src/ticker.c	Tue May 28 08:40:48 2002 +0000
+++ b/src/ticker.c	Wed May 29 00:24:41 2002 +0000
@@ -34,6 +34,7 @@
 
 typedef struct {
 	char buddy[ 128 ];
+	char alias[ 388 ];
 	GtkWidget *hbox;
 	GtkWidget *ebox;
 	GtkWidget *label;
@@ -46,7 +47,7 @@
 
 void BuddyTickerDestroyWindow( GtkWidget *window );
 void BuddyTickerCreateWindow( void );
-void BuddyTickerAddUser( char *name, GdkPixmap *pm, GdkBitmap *bm );
+void BuddyTickerAddUser( char *name, char *alias, GdkPixmap *pm, GdkBitmap *bm );
 void BuddyTickerRemoveUser( char *name );
 void BuddyTickerSetPixmap( char *name, GdkPixmap *pm, GdkBitmap *bm );
 void BuddyTickerClearList( void );
@@ -66,7 +67,7 @@
 	userclose = TRUE;
 }
 
-static char *msg = "Welcome to Gaim " VERSION ", brought to you by Rob Flynn (maintainer), Eric Warmenhoven, Mark Spencer, Jeramey Crawford, Jim Duchek, and Syd Logan"; 
+static char *msg = "Welcome to Gaim " VERSION ", brought to you by Rob Flynn (maintainer), Eric Warmenhoven, Mark Spencer, Jeramey Crawford, Jim Duchek, Syd Logan, and Sean Egan"; 
 
 void
 BuddyTickerCreateWindow()
@@ -109,7 +110,7 @@
 }
 
 void
-BuddyTickerAddUser( char *name, GdkPixmap *pm, GdkBitmap *bm )
+BuddyTickerAddUser( char *name, char *alias, GdkPixmap *pm, GdkBitmap *bm )
 {
 	TickerData *p;
 	GList *q;
@@ -128,6 +129,7 @@
 	p->label = (GtkWidget *) NULL;
 	p->pix = (GtkWidget *) NULL;
 	strcpy( p->buddy, name );
+	strcpy( p->alias, alias);
 	tickerbuds = g_list_append( tickerbuds, p );
 
 	p->hbox = gtk_hbox_new( FALSE, 0 );
@@ -147,7 +149,10 @@
 	gtk_box_pack_start_defaults( GTK_BOX( p->hbox ), p->ebox );
 	gtk_widget_show( p->ebox );
 
-	p->label = gtk_label_new( name );
+	if (im_options & OPT_IM_ALIAS_TAB)
+		p->label = gtk_label_new( alias );
+	else
+		p->label = gtk_label_new( name );
 	gtk_container_add( GTK_CONTAINER(p->ebox), p->label ); 
 
 	gtk_widget_show( p->label );
@@ -198,6 +203,26 @@
 	gtk_widget_show( data->pix );
 }
 
+void
+BuddyTickerSetAlias( char *name, char *alias) {
+	GList *p;
+	TickerData *data;
+
+	if ( userclose == TRUE )
+		return;
+	p = (GList *) BuddyTickerFindUser( name );
+	if ( p )
+		data = (TickerData *) p->data;
+	else
+		return;
+	if (alias) {
+		g_snprintf(data->alias, sizeof(data->alias), alias);
+		
+		if (im_options & OPT_IM_ALIAS_TAB) 
+			gtk_label_set_text(GTK_LABEL(data->label), alias);
+	}
+}
+
 GList *
 BuddyTickerFindUser( char *name )
 {
@@ -212,6 +237,20 @@
 	return (GList *) NULL;
 }
 
+void
+BuddyTickerSetNames()
+{
+	GList *p = tickerbuds;
+	while ( p ) {
+		TickerData *q = (TickerData *) p->data;
+		if (im_options & OPT_IM_ALIAS_TAB)
+			gtk_label_set_text(GTK_LABEL(q->label), q->alias);
+		else
+			gtk_label_set_text(GTK_LABEL(q->label), q->buddy);
+	p = p->next;
+	}
+}
+
 int
 BuddyTickerMessageRemove( gpointer data )
 {
@@ -297,7 +336,7 @@
 					if (xpm == NULL)
 						xpm = (char **)no_icon_xpm;
 					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm);
-					BuddyTickerAddUser( b->name, pm, bm );
+					BuddyTickerAddUser( b->name, b->show, pm, bm );
 				}
 			}
 		}
--- a/src/ui.h	Tue May 28 08:40:48 2002 +0000
+++ b/src/ui.h	Wed May 29 00:24:41 2002 +0000
@@ -492,8 +492,10 @@
 /* Fucntions in ticker.c */
 void SetTickerPrefs();
 void BuddyTickerSignOff();
-void BuddyTickerAddUser(char *, GdkPixmap *, GdkBitmap *);
+void BuddyTickerAddUser(char *, char *, GdkPixmap *, GdkBitmap *);
 void BuddyTickerSetPixmap(char *, GdkPixmap *, GdkBitmap *);
+void BuddyTickerSetAlias(char *, char *);
+void BuddyTickerSetNames();
 void BuddyTickerSignoff();
 
 #endif /* _UI_H_ */