changeset 342:f4fba304b236

[gaim-migrate @ 352] More changes to the applet: tooltips are set different, and choosing "Signon" from the right-click menu actually tries to sign you on, as opposed to just bringing up the login window. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 07 Jun 2000 01:50:55 +0000
parents df984d56efb4
children 0c6301184801
files src/aim.c src/buddy.c src/gnome_applet_mgr.c src/gnome_applet_mgr.h
diffstat 4 files changed, 34 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/aim.c	Tue Jun 06 21:50:20 2000 +0000
+++ b/src/aim.c	Wed Jun 07 01:50:55 2000 +0000
@@ -181,6 +181,7 @@
 	}
 
 #ifdef USE_APPLET
+	 setUserState(online);
 	 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon");
 	 applet_widget_register_callback(APPLET_WIDGET(applet),
 			 "signoff",
@@ -497,7 +498,7 @@
         applet_widget_register_callback(APPLET_WIDGET(applet),
 					"signon",
 					_("Signon"),
-					applet_show_login,
+					applet_do_signon,
 					NULL);
 #ifdef GAIM_PLUGINS
         applet_widget_register_callback(APPLET_WIDGET(applet),
--- a/src/buddy.c	Tue Jun 06 21:50:20 2000 +0000
+++ b/src/buddy.c	Wed Jun 07 01:50:55 2000 +0000
@@ -103,8 +103,13 @@
 	int pres, total;
         char buf[BUF_LONG];
 
+#ifndef USE_APPLET
         if (!(display_options & OPT_DISP_SHOW_GRPNUM))
                 return;
+#else
+	int onl = 0;
+	int all = 0;
+#endif
 
         while(grp) {
 		g = (struct group *)grp->data;
@@ -123,10 +128,18 @@
 
                 g_snprintf(buf, sizeof(buf), "%s  (%d/%d)", g->name, pres, total);
 
+#ifdef USE_APPLET
+		onl += pres;
+		all += total;
+		if (display_options & OPT_DISP_SHOW_GRPNUM)
+#endif
                 gtk_label_set(GTK_LABEL(g->label), buf);
                 grp = grp->next;
         }
-        
+#ifdef USE_APPLET
+	g_snprintf(buf, sizeof(buf), "%d/%d Buddies Online", onl, all);
+	applet_set_tooltips(buf);
+#endif
 }
 
 void update_show_idlepix()
@@ -348,7 +361,7 @@
         applet_widget_register_callback(APPLET_WIDGET(applet),
                 "signon",
                 _("Signon"),
-                applet_show_login,
+                applet_do_signon,
                 NULL);
 #else
         show_login();
--- a/src/gnome_applet_mgr.c	Tue Jun 06 21:50:20 2000 +0000
+++ b/src/gnome_applet_mgr.c	Wed Jun 07 01:50:55 2000 +0000
@@ -142,12 +142,14 @@
                            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),
@@ -238,6 +240,12 @@
 	}
 }
 
+void applet_do_signon(AppletWidget *widget, gpointer data) {
+	show_login();
+	if (general_options & OPT_GEN_REMEMBER_PASS)
+		dologin();
+}
+
 void insert_applet_away() {
 	GList *awy = away_messages;
 	struct away_message *a;
@@ -335,7 +343,7 @@
   applet_widget_register_callback(APPLET_WIDGET(applet),
 				  "signon",
 				  _("Signon"),
-				  applet_show_login,
+				  applet_do_signon,
 				  NULL);
 }
 
@@ -512,7 +520,7 @@
         gdk_imlib_init();
         gtk_widget_push_visual(gdk_imlib_get_visual());
         gtk_widget_push_colormap(gdk_imlib_get_colormap());
-        
+
         applet=applet_widget_new("gaim_applet");
         if(!applet) g_error(_("Can't create GAIM applet!"));
 	gtk_widget_set_events(applet, gtk_widget_get_events(applet) |
@@ -539,6 +547,7 @@
 		
 	icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm);
 	
+	update_applet(NULL);
 	gtk_timeout_add( 1500, (GtkFunction)update_applet, NULL );
 	
 	vbox = gtk_vbox_new(FALSE,0);
@@ -569,8 +578,6 @@
 	gtk_widget_show( vbox );
 	gtk_widget_show( appletframe );
 	        
-	applet_widget_set_tooltip(APPLET_WIDGET(applet),"GAIM");
-
 	applet_widget_register_stock_callback(APPLET_WIDGET(applet),
 					      "about",
 					      GNOME_STOCK_MENU_ABOUT,
@@ -602,4 +609,8 @@
 	applet_draw_open = FALSE;
 }
 
+void applet_set_tooltips(char *msg) {
+	applet_widget_set_tooltip(APPLET_WIDGET(applet), msg);
+}
+
 #endif /*USE_APPLET*/
--- a/src/gnome_applet_mgr.h	Tue Jun 06 21:50:20 2000 +0000
+++ b/src/gnome_applet_mgr.h	Wed Jun 07 01:50:55 2000 +0000
@@ -63,6 +63,7 @@
 #define GAIM_GNOME_PENGUIN_ONLINE "gaim/gnome/penguin-online.png"
 
 gint init_applet_mgr();
+void applet_do_signon(AppletWidget *, gpointer);
 
 void setUserState( enum gaim_user_states state );
 enum gaim_user_states getUserState();
@@ -76,7 +77,7 @@
 void remove_applet_away();
 
 void update_pixmaps();
-
+void applet_set_tooltips(char *);
 
 #endif /*USE_APPLET*/
 #endif /*_GAIMGNOMEAPPLETMGR_H_*/