changeset 436:7d5f91c1ff20

[gaim-migrate @ 446] Add preference for showing/hiding the ticker. committer: Tailor Script <tailor@pidgin.im>
author Syd Logan <slogan>
date Sun, 25 Jun 2000 02:42:11 +0000
parents feff1ae9d8da
children 9c113e5c5363
files src/aim.c src/buddy.c src/gaim.h src/prefs.c src/ticker.c
diffstat 5 files changed, 68 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/aim.c	Sun Jun 25 01:57:58 2000 +0000
+++ b/src/aim.c	Sun Jun 25 02:42:11 2000 +0000
@@ -507,6 +507,8 @@
 
         
         gtk_widget_show(mainwindow);
+
+	SetTickerPrefs();
 	
         if((general_options & OPT_GEN_AUTO_LOGIN) &&
            (general_options & OPT_GEN_REMEMBER_PASS)) {
--- a/src/buddy.c	Sun Jun 25 01:57:58 2000 +0000
+++ b/src/buddy.c	Sun Jun 25 02:42:11 2000 +0000
@@ -78,6 +78,7 @@
 
 static int last_lag_us;
 
+extern int ticker_prefs;
 
 GtkWidget *blist = NULL;
 GtkWidget *bpmenu;
@@ -374,7 +375,8 @@
 #else
         show_login();
 #endif /* USE_APPLET */
-	BuddyTickerSignoff();
+	if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+		BuddyTickerSignoff();
 }
 
 void handle_click_group(GtkWidget *widget, GdkEventButton *event, gpointer func_data)
@@ -1513,7 +1515,8 @@
 			pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
 				NULL, (gchar **)login_icon_xpm);
 
-			BuddyTickerAddUser( b->name, pm, bm );	
+        		if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				BuddyTickerAddUser( b->name, pm, bm );	
 
 			if (display_options & OPT_DISP_SHOW_LOGON) {
 				struct conversation *c = find_conversation(b->name);
@@ -1535,7 +1538,8 @@
 			gtk_widget_show(b->item);
 			gtk_widget_show(b->label);
                         b->log_timer = gtk_timeout_add(10000, (GtkFunction) log_timeout, b->name);
-                        gtk_timeout_add(10000, (GtkFunction) BuddyTickerLogonTimeout, b->name);
+        		if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+                        	gtk_timeout_add(10000, (GtkFunction) BuddyTickerLogonTimeout, b->name);
                         update_num_groups();
                         update_show_idlepix();
                         setup_buddy_chats();
@@ -1564,44 +1568,62 @@
                                 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)away_icon_xpm);
                                 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
-                                pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
+        			if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				{
+					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)away_icon_xpm);
-                                BuddyTickerSetPixmap(b->name, pm, bm);
+					BuddyTickerSetPixmap(b->name, pm, bm);
+				}
                         } else if (b->uc & UC_AOL) {
                                 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)aol_icon_xpm);
                                 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
-                                pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
+        			if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				{
+					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)aol_icon_xpm);
-                                BuddyTickerSetPixmap(b->name, pm, bm);
+					BuddyTickerSetPixmap(b->name, pm, bm);
+				}
                         } else if (b->uc & UC_NORMAL) {
                                 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)free_icon_xpm);
                                 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
-                                pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
+        			if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				{
+					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)free_icon_xpm);
-                                BuddyTickerSetPixmap(b->name, pm, bm);
+					BuddyTickerSetPixmap(b->name, pm, bm);
+				}
                         } else if (b->uc & UC_ADMIN) {
                                 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)admin_icon_xpm);
                                 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
-                                pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
+        			if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				{
+					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)admin_icon_xpm);
-                                BuddyTickerSetPixmap(b->name, pm, bm);
+					BuddyTickerSetPixmap(b->name, pm, bm);
+				}
                         } else if (b->uc & UC_UNCONFIRMED) {
                                 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)dt_icon_xpm);
                                 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
-                                pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
+        			if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				{
+					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)dt_icon_xpm);
-                                BuddyTickerSetPixmap(b->name, pm, bm);
+					BuddyTickerSetPixmap(b->name, pm, bm);
+				}
                         } else {
                                 pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)no_icon_xpm);
                                 gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
-                                pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
+        			if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				{
+					pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
                                                                   NULL, (gchar **)no_icon_xpm);
-                                BuddyTickerSetPixmap(b->name, pm, bm);
+					BuddyTickerSetPixmap(b->name, pm, bm);
+				}
                         }
                         if (display_options & OPT_DISP_SHOW_PIXMAPS)
                                 gtk_widget_show(b->pix);
@@ -1632,7 +1654,8 @@
 			gtk_pixmap_set(GTK_PIXMAP(b->pix), pm, bm);
 			pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm,
 				NULL, (gchar **)logout_icon_xpm);
-			BuddyTickerSetPixmap( b->name, pm, bm );
+        		if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+				BuddyTickerSetPixmap( b->name, pm, bm );
                         if (display_options & OPT_DISP_SHOW_PIXMAPS)
 				gtk_widget_show(b->pix);
 			if (display_options & OPT_DISP_SHOW_LOGON) {
@@ -1651,7 +1674,8 @@
 				}
 			}
                         b->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, b->name);
-                        gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogoutTimeout, b->name);
+        		if ( ticker_prefs & OPT_DISP_SHOW_BUDDYTICKER )
+                        	gtk_timeout_add(10000, (GtkFunction)BuddyTickerLogoutTimeout, b->name);
                         update_num_groups();
                         update_show_idlepix();
 		}
--- a/src/gaim.h	Sun Jun 25 01:57:58 2000 +0000
+++ b/src/gaim.h	Sun Jun 25 02:42:11 2000 +0000
@@ -385,7 +385,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 435 $"
+#define REVISION "gaim:$Revision: 446 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -476,6 +476,7 @@
 #define OPT_DISP_SHOW_LOGON      0x00000040
 #define OPT_DISP_DEVIL_PIXMAPS   0x00000080
 #define OPT_DISP_SHOW_SMILEY	 0x00000100
+#define OPT_DISP_SHOW_BUDDYTICKER	 0x00000200
  
 extern int sound_options;
 #define OPT_SOUND_LOGIN          0x00000001
--- a/src/prefs.c	Sun Jun 25 01:57:58 2000 +0000
+++ b/src/prefs.c	Sun Jun 25 02:42:11 2000 +0000
@@ -771,6 +771,7 @@
 	gaim_button(_("Show logon/logoffs in conversation windows"), &display_options, OPT_DISP_SHOW_LOGON, appbox );
 	gaim_button(_("Use devil icons"), &display_options, OPT_DISP_DEVIL_PIXMAPS, appbox );
 	gaim_button(_("Show graphical smileys (experimental)"), &display_options, OPT_DISP_SHOW_SMILEY, appbox );
+	gaim_button(_("Show Buddy Ticker after restart"), &display_options, OPT_DISP_SHOW_BUDDYTICKER, appbox );
 	
 	
 	gaim_button(_("Bold Text"), &font_options, OPT_FONT_BOLD, fontbox);
--- a/src/ticker.c	Sun Jun 25 01:57:58 2000 +0000
+++ b/src/ticker.c	Sun Jun 25 02:42:11 2000 +0000
@@ -48,6 +48,18 @@
 GList * BuddyTickerFindUser( char *name );
 int BuddyTickerMessageRemove( gpointer data );
 
+// this pref is startup only, so make a shadow here of settings at startup
+// code uses this variable, not display_prefs
+
+extern int display_options;
+int ticker_prefs;
+
+void
+SetTickerPrefs( void ) 
+{
+	ticker_prefs = display_options;
+}
+
 void
 BuddyTickerDestroyWindow( GtkWidget *window )
 {
@@ -95,11 +107,13 @@
 
 	if ( userclose == TRUE )
 		return;
+
+	BuddyTickerCreateWindow();
+
 	q = (GList *) BuddyTickerFindUser( name );
 	if ( q != (GList *) NULL )
 		return;
 
-	BuddyTickerCreateWindow();
 	p = (TickerData *) malloc( sizeof( TickerData ) );
 	p->hbox = (GtkWidget *) NULL;
 	p->label = (GtkWidget *) NULL;
@@ -144,7 +158,10 @@
 	if ( userclose == TRUE )
 		return;
 	p = (GList *) BuddyTickerFindUser( name );
-	data = (TickerData *) p->data;
+	if ( p )
+		data = (TickerData *) p->data;
+	else
+		return;
 	if ( data->pix == (GtkWidget *) NULL ) {
 		data->pix = gtk_pixmap_new( pm, bm );
 		gtk_box_pack_start_defaults( GTK_BOX( data->hbox ), data->pix );
@@ -204,7 +221,8 @@
 
 	while ( p ) {
 		q = (TickerData *) p->data;
-		BuddyTickerRemoveUser( q->buddy ); 
+		if ( q )
+			BuddyTickerRemoveUser( q->buddy ); 
 		p = tickerbuds;
 	}
 	userclose = FALSE;
@@ -215,12 +233,9 @@
 BuddyTickerClearList( void )
 {
 	GList *p = tickerbuds;
-	TickerData *q;
 
-	while ( p ) {
-		q = (TickerData *) p->data;
+	while ( p ) 
 		p = g_list_remove( p, p->data );
-	}
 	tickerbuds = (GList *) NULL;
 }