changeset 746:5a908dd5cfc4

[gaim-migrate @ 756] i finally got pissed off enough at gnome_applet_mgr.c that i redid it committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 23 Aug 2000 04:14:47 +0000
parents d693b83e4933
children eec93c5929b9
files src/aim.c src/away.c src/buddy.c src/gaim.h src/gnome_applet_mgr.c src/gnome_applet_mgr.h src/oscar.c src/prefs.c src/toc.c
diffstat 9 files changed, 175 insertions(+), 434 deletions(-) [+]
line wrap: on
line diff
--- a/src/aim.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/aim.c	Wed Aug 23 04:14:47 2000 +0000
@@ -85,8 +85,8 @@
 void cancel_logon(void)
 {
 #ifdef USE_APPLET
-        set_applet_draw_closed();
-        AppletCancelLogon();
+	applet_buddy_show = FALSE;
+	signoff();
         gtk_widget_hide(mainwindow);
 #else
 #ifdef GAIM_PLUGINS
@@ -199,8 +199,7 @@
 		g_screenname[i] = toupper( g_screenname[i] );
 
 #ifdef USE_APPLET
-	set_applet_draw_closed();
-	setUserState(signing_on);
+	set_user_state(signing_on);
 #endif /* USE_APPLET */
 
 	if (running) return;
@@ -231,28 +230,28 @@
 	}
 
 #ifdef USE_APPLET
-	 setUserState(online);
-	 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon");
-	 applet_widget_register_callback(APPLET_WIDGET(applet),
-			 "signoff",
-			 _("Signoff"),
-			 signoff,
-			 NULL);
+	set_user_state(online);
+	applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon");
+	applet_widget_register_callback(APPLET_WIDGET(applet),
+			"signoff",
+			_("Signoff"),
+			signoff,
+			NULL);
 #endif /* USE_APPLET */
 
 #ifdef GAIM_PLUGINS
 	 {
-		 GList *c = callbacks;
-		 struct gaim_callback *g;
-		 void (*function)(void *);
-		 while (c) {
-			 g = (struct gaim_callback *)c->data;
-			 if (g->event == event_signon && g->function != NULL) {
-				 function = g->function;
-				 (*function)(g->data);
-			 }
-			 c = c->next;
-		 }
+		GList *c = callbacks;
+		struct gaim_callback *g;
+		void (*function)(void *);
+		while (c) {
+			g = (struct gaim_callback *)c->data;
+			if (g->event == event_signon && g->function != NULL) {
+				function = g->function;
+				(*function)(g->data);
+			}
+			c = c->next;
+		}
 	 }
 #endif /* GAIM_PLUGINS */
 
--- a/src/away.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/away.c	Wed Aug 23 04:14:47 2000 +0000
@@ -37,9 +37,6 @@
 #include "pixmaps/join.xpm"
 
 GtkWidget *imaway=NULL;
-#ifdef USE_APPLET
-extern enum gaim_user_states MRI_user_status;
-#endif
 
 GtkWidget *awaymenu = NULL;
 struct away_message *awaymessage = NULL;
@@ -54,9 +51,9 @@
 void do_im_back(GtkWidget *w, GtkWidget *x)
 {
 #ifdef USE_APPLET
-  applet_widget_unregister_callback(APPLET_WIDGET(applet),"away");
-  MRI_user_status = online;
-  insert_applet_away();
+	applet_widget_unregister_callback(APPLET_WIDGET(applet),"away");
+	set_user_state(online);
+	insert_applet_away();
 #endif /* USE_APPLET */
 	if (imaway) {
 		gtk_widget_destroy(imaway);
@@ -104,8 +101,8 @@
                                         "away",
                                         _("Back"),
                                         (AppletCallbackFunc) do_im_back,
-                                        NULL);
-	MRI_user_status = away;
+                                        NULL);				
+	set_user_state(away);
 #endif
 
 	if (!imaway) {
--- a/src/buddy.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/buddy.c	Wed Aug 23 04:14:47 2000 +0000
@@ -103,9 +103,6 @@
 		gtk_widget_destroy(blist);
 	blist=NULL;
 	imchatbox = NULL;
-#ifdef USE_APPLET
-	buddy_created = FALSE;
-#endif
 }
 
 void update_num_groups()
@@ -277,41 +274,14 @@
 
 #ifdef USE_APPLET
 gint applet_destroy_buddy( GtkWidget *widget, GdkEvent *event,gpointer *data ) {
-	set_applet_draw_closed();
-	gnome_buddy_hide();
+	applet_buddy_show = FALSE;
+	gtk_widget_hide(blist);
 	return (TRUE);
 }
 
-void gnome_buddy_show(){
-	gtk_widget_show( blist );
-}
-
-void gnome_buddy_hide(){
-	gtk_widget_hide( blist );
-}
-
-void gnome_buddy_set_pos( gint x, gint y ){
-	if (general_options & OPT_GEN_NEAR_APPLET)
-		gtk_widget_set_uposition ( blist, x, y );
-	else if (general_options & OPT_GEN_SAVED_WINDOWS)
-		gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, blist_pos.y - blist_pos.yoff);
-}
-
-GtkRequisition gnome_buddy_get_dimentions(){
-	if (general_options & OPT_GEN_SAVED_WINDOWS) {
-		GtkRequisition r;
-		r.width = blist_pos.width;
-		r.height = blist_pos.height;
-		return r;
-	} else {
-		return blist->requisition;
-	}
-}
-
 #endif
 
 
-extern enum gaim_user_states MRI_user_status;
 void signoff()
 {
 	GList *mem;
@@ -345,8 +315,8 @@
         destroy_buddy();
         hide_login_progress("");
 #ifdef USE_APPLET
-	MRI_user_status = offline;
-        set_applet_draw_closed();
+	set_user_state(offline);
+	applet_buddy_show = FALSE;
         applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff");
 	remove_applet_away();
         applet_widget_register_callback(APPLET_WIDGET(applet),
--- a/src/gaim.h	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/gaim.h	Wed Aug 23 04:14:47 2000 +0000
@@ -401,7 +401,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 746 $"
+#define REVISION "gaim:$Revision: 756 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -416,7 +416,6 @@
 
 
 #ifdef USE_APPLET
-extern gboolean buddy_created;
 extern GtkWidget *applet;
 #endif /* USE_APPLET */
 
@@ -724,9 +723,6 @@
 #ifdef USE_APPLET
 extern void createOnlinePopup();
 extern void applet_show_login(AppletWidget *, gpointer);
-extern void gnome_buddy_show();
-extern void gnome_buddy_hide();
-extern void gnome_buddy_set_pos( gint x, gint y );
 GtkRequisition gnome_buddy_get_dimentions();
 #endif
 
--- a/src/gnome_applet_mgr.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/gnome_applet_mgr.c	Wed Aug 23 04:14:47 2000 +0000
@@ -38,8 +38,7 @@
 
 enum gaim_user_states MRI_user_status; 
 
-gboolean buddy_created = FALSE;
-gboolean applet_draw_open = FALSE;
+gboolean applet_buddy_show = FALSE;
 GtkWidget *applet_popup = NULL;
 
 gchar GAIM_GNOME_OFFLINE_ICON[255] = GAIM_GNOME_PENGUIN_OFFLINE;
@@ -67,34 +66,11 @@
 GdkPixmap *icon_away_bm=NULL;
 
 static GtkAllocation get_applet_pos(gboolean);
-
 gint sizehint=48;
 
-/***************************************************************
-**
-** function load_applet_icon
-** visibility - private
-**
-** input:
-**	name - the name of the file to load
-**	height, width - the height and width 
-**					  that the icon should be
-**					 scaled to.
-**
-** output:
-**	TRUE - success
-**      FALSE - failure
-**	pm - a GdkPixmap structure that the icon is loaded into
-**      bm - a GdkBitmap structure that the icon's transparancy
-**		mask is loaded into
-**
-** description - loads an icon from 
-**                    /usr/share/pixmap/gaim/gnome/
-**                    and scales it using imlib
-**
-****************************************************************/
-
-gboolean load_applet_icon( const char *name, int height, int width, GdkPixmap **pm, GdkBitmap **bm ){
+static gboolean load_applet_icon(const char *name, int height, int width,
+				 GdkPixmap **pm, GdkBitmap **bm)
+{
 	gboolean result = TRUE;
 	char *path;
 	GdkImlibImage *im;
@@ -121,88 +97,52 @@
 	free(path);
 	return result;
 }
-/***************************************************************
-**
-** function applet_change_pixel_size
-** visibility - private
-**
-** input:
-**	w - applet that called the signal
-**	size - size of panel
-**	data - extra data (in this case NULL)
-**
-** description - changes the size of the applet when the panel size
-**	changes
-**
-***************************************************************/
+
 #ifdef HAVE_PANEL_PIXEL_SIZE
-void applet_change_pixel_size(GtkWidget *w, int size, gpointer data)
+static void applet_change_pixel_size(GtkWidget *w, int size, gpointer data)
 {
 	sizehint = size;
 	update_pixmaps();
 }
 #endif
 
-/***************************************************************
-**
-** function update_applet
-** visibility - private
-**
-** input:
-**	ap - if not NULL, was called from update_pixmaps, and
-**		should update them
-**
-** description - takes care of swapping status icons and 
-**			  updating the status label
-**
-****************************************************************/ 
+static gboolean update_applet(gboolean force_update){
+	static enum gaim_user_states old_user_status = offline;
 
-gboolean update_applet( gpointer *ap ){
-     static enum gaim_user_states old_user_status = offline;
-     
-     if( MRI_user_status != old_user_status || ap){
+	if( MRI_user_status != old_user_status || force_update) {
 
-         switch( MRI_user_status ){
-      		case offline:
-      			gtk_pixmap_set( GTK_PIXMAP(icon),
-                           icon_offline_pm,
-                           icon_offline_bm );
-         	       gtk_label_set( GTK_LABEL(status_label), _MSG_OFFLINE_ );
-		       applet_set_tooltips(_("Offilne. Click to bring up login box."));
-      		break;
-      		case signing_on:
-      			gtk_pixmap_set( GTK_PIXMAP(icon),
-                           icon_connect_pm,
-                           icon_connect_bm );   
-      			gtk_label_set( GTK_LABEL(status_label), _MSG_CONNECT_ );
+		switch( MRI_user_status ){
+		case offline:
+			gtk_pixmap_set( GTK_PIXMAP(icon),
+					icon_offline_pm,
+					icon_offline_bm );
+			gtk_label_set( GTK_LABEL(status_label), _MSG_OFFLINE_ );
+			applet_set_tooltips(_("Offilne. Click to bring up login box."));
+			break;
+		case signing_on:
+			gtk_pixmap_set( GTK_PIXMAP(icon),
+					icon_connect_pm,
+					icon_connect_bm );   
+			gtk_label_set( GTK_LABEL(status_label), _MSG_CONNECT_ );
 			applet_set_tooltips(_("Attempting to sign on...."));
-      		break;
-      		case online:
-      			gtk_pixmap_set( GTK_PIXMAP(icon),
-                           icon_online_pm,
-                           icon_online_bm );                
-                   
-                	gtk_label_set( GTK_LABEL(status_label), _MSG_ONLINE_ );
+			break;
+		case online:
+			gtk_pixmap_set( GTK_PIXMAP(icon),
+					icon_online_pm,
+					icon_online_bm );                
+			gtk_label_set( GTK_LABEL(status_label), _MSG_ONLINE_ );
 			update_num_groups();
-      		break;
-      
-      		case unread_message_pending:
-      			gtk_pixmap_set( GTK_PIXMAP(icon),
-                           icon_msg_pending_pm,
-                           icon_msg_pending_bm );   
-      			gtk_label_set( GTK_LABEL(status_label), "msg" );
-      		break;
-      		case away:
-      			gtk_pixmap_set( GTK_PIXMAP(icon),
-                           icon_online_pm,
-                           icon_online_bm );   
-      			gtk_label_set( GTK_LABEL(status_label), _("Away") );
-      		break;
-      	}
-      	old_user_status = MRI_user_status;
-      }
-      return TRUE;
-
+			break;
+		case away:
+			gtk_pixmap_set( GTK_PIXMAP(icon),
+					icon_online_pm,
+					icon_online_bm );   
+			gtk_label_set( GTK_LABEL(status_label), _("Away") );
+			break;
+		}
+		old_user_status = MRI_user_status;
+	}
+	return TRUE;
 }
 
 void update_pixmaps() {
@@ -221,44 +161,11 @@
 			&icon_connect_pm, &icon_connect_bm );
 	load_applet_icon( GAIM_GNOME_ONLINE_ICON, (sizehint-16), (sizehint-12),
 			&icon_online_pm, &icon_online_bm );
-	update_applet((gpointer *)applet);
+	update_applet(TRUE);
 	gtk_widget_set_usize(appletframe, sizehint, sizehint);
 }
 
 
-/***************************************************************
-**
-** function make_buddy
-** visibility - private
-**
-** description - If buddylist is not created create it
-**                    else show the buddy list
-**
-****************************************************************/ 
-void make_buddy(void) {
-        set_applet_draw_open();        
-	if( !buddy_created ){
-		show_buddy_list();
-		buddy_created = TRUE;
-	} else {
-		gnome_buddy_show();
-	}	
-	build_edit_tree();
-	build_permit_tree();
-	
-}
-
-/***************************************************************
-**
-** function applet_show_login
-** visibility - private
-**
-** input:
-**
-**
-** description - I guess it shows the login dialog
-**
-****************************************************************/
 extern GtkWidget *mainwindow;
 void applet_show_login(AppletWidget *widget, gpointer data) {
         show_login();
@@ -269,7 +176,7 @@
 }
 
 void applet_do_signon(AppletWidget *widget, gpointer data) {
-	show_login();
+	applet_show_login(NULL, 0);
 	if (general_options & OPT_GEN_REMEMBER_PASS)
 		dologin(0, 0);
 }
@@ -329,17 +236,7 @@
 	applet_widget_unregister_callback(APPLET_WIDGET(applet), "away");
 }
 
-/***************************************************************
-**
-** function applet_show_about
-** visibility - public
-**
-**
-** description - takes care of creating and
-**                    displaying the about box
-**
-****************************************************************/
-void applet_show_about(AppletWidget *widget, gpointer data) {
+static void applet_show_about(AppletWidget *widget, gpointer data) {
   
   const gchar *authors[] = {"Mark Spencer <markster@marko.net>",
                             "Jim Duchek <jimduchek@ou.edu>",
@@ -357,175 +254,84 @@
   gtk_widget_show(about);
 }
 
-/***************************************************************
-**
-** function AppletCancelLogin (name should be changed to 
-**									applet_cancel_login)
-** visibility - public
-**
-** description - called when user cancels login
-**
-****************************************************************/ 
-void AppletCancelLogon(){
-  applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff");
-  applet_widget_register_callback(APPLET_WIDGET(applet),
-				  "signon",
-				  _("Signon"),
-				  applet_do_signon,
-				  NULL);
+static GtkAllocation get_applet_pos(gboolean for_blist) {
+	gint x,y,pad;
+	GtkRequisition buddy_req, applet_req;
+	GtkAllocation result;
+	GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) );
+	pad = 5;
+
+	gdk_window_get_position(gtk_widget_get_parent_window(appletframe), &x, &y);
+	if (for_blist) {
+	        if (general_options & OPT_GEN_SAVED_WINDOWS) {
+			buddy_req.width = blist_pos.width;
+			buddy_req.height = blist_pos.height;
+		} else {
+			buddy_req = blist->requisition;
+		}
+	} else {
+		buddy_req = mainwindow->requisition;
+	}
+	applet_req = appletframe->requisition;
+
+	/* FIXME : we need to be smarter here */
+	switch( orient ){
+	case ORIENT_UP:
+		result.x=x;
+		result.y=y-(buddy_req.height+pad);
+		break;
+	case ORIENT_DOWN:
+		result.x=x; 
+		result.y=y+applet_req.height+pad; 
+		break;
+	case ORIENT_LEFT:
+		result.x=x-(buddy_req.width + pad );
+		result.y=y;
+		break;
+	case ORIENT_RIGHT:
+		result.x=x+applet_req.width+pad;
+		result.y=y;
+		break;
+	} 
+	return result;
 }
 
-/***************************************************************
-**
-** function get_applet_pos
-** visibility - private
-**
-** output:
-**	GtKAllocation - a Gtk struct that holds the 
-**						position of the dialog
-**
-** description - returns the x,y position the buddy list should
-** 				should be placed based on the position
-**                      of the applet and the orientation
-**				of the Gnome panel.
-**
-****************************************************************/ 
-GtkAllocation get_applet_pos(gboolean for_blist) {
-    gint x,y,pad;
-    GtkRequisition buddy_req, applet_req;
-    GtkAllocation result;
-    GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) );
-    pad = 5;
-    gdk_window_get_position(gtk_widget_get_parent_window(appletframe), &x, &y);
-    if (for_blist)
-	    buddy_req = gnome_buddy_get_dimentions();
-    else
-	    buddy_req = mainwindow->requisition;
-    applet_req = appletframe->requisition;
-   switch( orient ){
-   	case ORIENT_UP:
-   		result.x=x;
-   		result.y=y-(buddy_req.height+pad);
-   	break;
-	case ORIENT_DOWN:
-   		result.x=x; 
-   		result.y=y+applet_req.height+pad; 
-   	
-   	break;
-   	case ORIENT_LEFT:
-   		result.x=x-(buddy_req.width + pad );
-   		result.y=y;
-   	break;
-   	case ORIENT_RIGHT:
-   		result.x=x+applet_req.width+pad;
-   		result.y=y;
-   	break;
-   } 
-   
-   
-   return result;
-}
-
-
-
-void createOfflinePopup(){
-	applet_show_login( APPLET_WIDGET(applet), NULL );
-}
-
-
-void createSignonPopup(){
-	applet_draw_open = FALSE;
-}
-
-
 void createOnlinePopup(){
-    GtkAllocation al;
-    make_buddy();
-    al  = get_applet_pos(TRUE);  
-    gnome_buddy_set_pos(  al.x, al.y );
-}
-
-
-void createPendingPopup(){
-    applet_draw_open = FALSE;
-}
-
-
-void createAwayPopup(){
-     createOnlinePopup();
-}
-
-
-void closeOfflinePopup(){
-	cancel_logon();
-	set_applet_draw_closed();
-}
-
-
-void closeSignonPopup(){
-
-}
-
-
-void closeOnlinePopup(){
-    set_applet_draw_closed();
-    applet_destroy_buddy(0, 0, 0);
-}
-
-
-void closePendingPopup(){
-    applet_draw_open = FALSE;
-}
-
-
-void closeAwayPopup(){
-	closeOnlinePopup();
+	GtkAllocation al;
+	if (blist) gtk_widget_show(blist);
+	al  = get_applet_pos(TRUE);  
+        if (general_options & OPT_GEN_NEAR_APPLET)
+                gtk_widget_set_uposition ( blist, al.x, al.y );
+        else if (general_options & OPT_GEN_SAVED_WINDOWS)
+                gtk_widget_set_uposition(blist, blist_pos.x - blist_pos.xoff, blist_pos.y - blist_pos.yoff);
 }
 
 void AppletClicked( GtkWidget *sender, GdkEventButton *ev, gpointer data ){
 	if (!ev || ev->button != 1 || ev->type != GDK_BUTTON_PRESS)
 		return;
         
-	if( applet_draw_open ){
+	if(applet_buddy_show) {
+		applet_buddy_show = FALSE;
 	  	switch( MRI_user_status ){
 			case offline:
-				closeOfflinePopup();
-			break;
-			case signing_on:
-				closeSignonPopup();
-			break;
+				gtk_widget_hide(mainwindow);
+				break;
 			case online:
-				closeOnlinePopup();
-				
-			break;
-			case unread_message_pending:
-				closePendingPopup();
-			break;
 			case away:
-				closeAwayPopup();
-			break;
+				applet_destroy_buddy(0, 0, 0);
+				break;
 		}     
 	} else {
-		set_applet_draw_open();
+		applet_buddy_show = TRUE;
 		switch( MRI_user_status ){
 			case offline:
-				createOfflinePopup();
-			break;
-			case signing_on:
-				createSignonPopup();
-			break;
+				applet_show_login( APPLET_WIDGET(applet), NULL );
+				break;
 			case online:
+			case away:
 				createOnlinePopup();
-			break;
-			case unread_message_pending:
-				createPendingPopup();
-			break;
-			case away:
-				createAwayPopup();
-			break;
+				break;
 		}
-		
-				
 	}
 }
 
@@ -577,8 +383,7 @@
 		
 	icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm);
 	
-	update_applet(NULL);
-	gtk_timeout_add( 1500, (GtkFunction)update_applet, NULL );
+	update_applet(FALSE);
 	
 	vbox = gtk_vbox_new(FALSE,0);
 	
@@ -629,21 +434,9 @@
         return 0;
 }
 
-void setUserState( enum gaim_user_states state ){
+void set_user_state( enum gaim_user_states state ){
 	MRI_user_status = state; 
-	update_applet(NULL);
-}
-
-enum gaim_user_states getUserState(){
-	return MRI_user_status;
-}
-
-void set_applet_draw_open(){
-	applet_draw_open = TRUE;
-}
-
-void set_applet_draw_closed(){
-	applet_draw_open = FALSE;
+	update_applet(FALSE);
 }
 
 void applet_set_tooltips(char *msg) {
--- a/src/gnome_applet_mgr.h	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/gnome_applet_mgr.h	Wed Aug 23 04:14:47 2000 +0000
@@ -44,7 +44,6 @@
 	offline = 0,
 	signing_on,
 	online,
-	unread_message_pending,
 	away
 };
 
@@ -68,13 +67,7 @@
 extern void cancel_logon();
 extern gint applet_destroy_buddy(GtkWidget *, GdkEvent *, gpointer *);
 
-extern void setUserState( enum gaim_user_states state );
-extern enum gaim_user_states getUserState();
-
-extern void AppletCancelLogon();
-
-extern void set_applet_draw_open();
-extern void set_applet_draw_closed();
+extern void set_user_state( enum gaim_user_states state );
 
 extern void insert_applet_away();
 extern void remove_applet_away();
@@ -83,5 +76,7 @@
 extern void applet_set_tooltips(char *);
 extern void dologin(GtkWidget *, GtkWidget *);
 
+extern gboolean applet_buddy_show;
+
 #endif /*USE_APPLET*/
 #endif /*_GAIMGNOMEAPPLETMGR_H_*/
--- a/src/oscar.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/oscar.c	Wed Aug 23 04:14:47 2000 +0000
@@ -102,8 +102,6 @@
 	if (condition & GDK_INPUT_EXCEPTION) {
 		signoff();
 		hide_login_progress(_("Disconnected."));
-		aim_logoff(gaim_sess);
-		gdk_input_remove(inpa);
 		auth_failed();
 		return;
 	}
@@ -170,14 +168,14 @@
 	if (conn == NULL) {
 		debug_print(_("internal connection error\n"));
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif
 		set_state(STATE_OFFLINE);
 		hide_login_progress(_("Unable to login to AIM"));
 		return -1;
 	} else if (conn->fd == -1) {
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif
 		set_state(STATE_OFFLINE);
 		if (conn->status & AIM_CONN_STATUS_RESOLVERR) {
@@ -232,7 +230,7 @@
 
 void oscar_close() {
 #ifdef USE_APPLET
-	setUserState(offline);
+	set_user_state(offline);
 #endif
 	set_state(STATE_OFFLINE);
 	if (inpa > 0)
@@ -272,12 +270,12 @@
 				sess->logininfo.errorurl);
 		debug_print(debug_buff);
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif
 		set_state(STATE_OFFLINE);
+		gdk_input_remove(inpa);
 		hide_login_progress(_("Authentication Failed"));
-		gdk_input_remove(inpa);
-		aim_conn_kill(sess, &command->conn);
+		signoff();
 		auth_failed();
 		return 0;
 	}
@@ -293,7 +291,7 @@
 	bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, sess->logininfo.BOSIP);
 	if (bosconn == NULL) {
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif
 		set_state(STATE_OFFLINE);
 		hide_login_progress(_("Internal Error"));
@@ -301,7 +299,7 @@
 		return -1;
 	} else if (bosconn->status != 0) {
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif
 		set_state(STATE_OFFLINE);
 		hide_login_progress(_("Could Not Connect"));
@@ -434,23 +432,22 @@
 		aim_seticbmparam(sess, command->conn);
 		aim_conn_setlatency(command->conn, 1);
 
-#ifdef USE_APPLET
-		make_buddy();
-		if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
-			gnome_buddy_show();
-			createOnlinePopup();
-			set_applet_draw_open();
-		} else {
-			gnome_buddy_hide();
-			set_applet_draw_closed();
-		}
-		setUserState(online);
-		gtk_widget_hide(mainwindow);
-#else
 		gtk_widget_hide(mainwindow);
 		show_buddy_list();
+#ifdef USE_APPLET
+		if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
+			refresh_buddy_window();
+			createOnlinePopup();
+			applet_buddy_show = TRUE;
+		} else {
+			gtk_widget_hide(blist);
+			applet_buddy_show = FALSE;
+		}
+		set_user_state(online);
+#else
 		refresh_buddy_window();
 #endif
+
 		serv_finish_login();
 		gaim_setup();
 		if (bud_list_cache_exists())
@@ -458,6 +455,7 @@
 
 		aim_bos_clientready(sess, command->conn);
 		debug_print("Roger that, all systems go\n");
+
 		aim_bos_reqservice(sess, command->conn, AIM_CONN_TYPE_CHATNAV);
 
 		break;
--- a/src/prefs.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/prefs.c	Wed Aug 23 04:14:47 2000 +0000
@@ -350,6 +350,9 @@
 	gtk_widget_show(sep);
 
 	gaim_button(_("Save Window Size/Position"), &general_options, OPT_GEN_SAVED_WINDOWS, box);
+#ifdef USE_APPLET
+	gaim_button(_("Automatically show buddy list on sign on"), &general_options, OPT_GEN_APP_BUDDY_SHOW, box);
+#endif
 
 	gtk_widget_show(prefdialog);
 }
--- a/src/toc.c	Wed Aug 23 02:43:34 2000 +0000
+++ b/src/toc.c	Wed Aug 23 04:14:47 2000 +0000
@@ -69,7 +69,7 @@
 	if (!sin) {
 	        
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif /* USE_APPLET */
                 set_state(STATE_OFFLINE);
 		g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host);
@@ -88,7 +88,7 @@
 
         if (toc_fd < 0) {
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif /* USE_APPLET */
                 set_state(STATE_OFFLINE);
 		g_snprintf(buf, sizeof(buf), "Connect to %s failed",
@@ -105,7 +105,7 @@
 	
 	if (toc_signon(username, password) < 0) {
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif /* USE_APPLET */
                 set_state(STATE_OFFLINE);
 		hide_login_progress("Disconnected.");
@@ -116,7 +116,7 @@
 	set_login_progress(4, buf);
 	if (toc_wait_signon() < 0) {
 #ifdef USE_APPLET
-		setUserState(offline);
+		set_user_state(offline);
 #endif /* USE_APPLET */
                 set_state(STATE_OFFLINE);
 		hide_login_progress("Authentication Failed");
@@ -143,37 +143,27 @@
 	config = toc_wait_config();
 	state = STATE_ONLINE;
 
+        gtk_widget_hide(mainwindow);
+	show_buddy_list();
 #ifdef USE_APPLET
-	make_buddy();
 	if (general_options & OPT_GEN_APP_BUDDY_SHOW) {
-                gnome_buddy_show();
-		if (config != NULL)
-			parse_toc_buddy_list(config, 0);
-		else
-			do_import(0, 0);
+		refresh_buddy_window();
 		createOnlinePopup();
-                set_applet_draw_open();
+                applet_buddy_show = TRUE;
         } else {
-                gnome_buddy_hide();
-		if (config != NULL)
-			parse_toc_buddy_list(config, 0);
-		else
-			do_import(0, 0);
-                set_applet_draw_closed();
+                gtk_widget_hide(blist);
+                applet_buddy_show = FALSE;
         }
 
-       
-	setUserState(online);
-	gtk_widget_hide(mainwindow);
+	set_user_state(online);
 #else
-        gtk_widget_hide(mainwindow);
-	show_buddy_list();
+	refresh_buddy_window();
+#endif
 	if (config != NULL)
 		parse_toc_buddy_list(config, 0);
 	else
 		do_import(0, 0);
         refresh_buddy_window();
-#endif
         
         
 	g_snprintf(buf2, sizeof(buf2), "toc_init_done");
@@ -191,7 +181,7 @@
 void toc_close()
 {
 #ifdef USE_APPLET
-	setUserState(offline);
+	set_user_state(offline);
 #endif /* USE_APPLET */
         seqno = 0;
         state = STATE_OFFLINE;