changeset 82:05077cb276d4

[gaim-migrate @ 92] Made it very easy to switch between penguin and devil icons in the applet. Also made it so that it would find the icons better (through use of nifty GNOME functions I accidentally found). Other little touch-ups here and there. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 05 Apr 2000 08:22:38 +0000
parents 7a24bb75a97b
children 8a98f129c849
files ChangeLog buddytrans.c pixmaps/Makefile.am src/Makefile.am src/aim.c src/gaim.h src/gaimrc.c src/gnome_applet_mgr.c src/gnome_applet_mgr.h src/prefs.c src/sound.c
diffstat 11 files changed, 67 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 05 07:21:34 2000 +0000
+++ b/ChangeLog	Wed Apr 05 08:22:38 2000 +0000
@@ -1,6 +1,7 @@
 GAIM: The Pimpin' Penguin IM Clone thats good for the soul! 
 
 version 0.9.14:
+	* Using devil pictures in applet is now easily configurable
 	* Numerous Fixes by G. Sumner Hayes (buffer over flow patches,
 	  etc)
 	* Paned Conversation Windows (Thanks Syd)
--- a/buddytrans.c	Wed Apr 05 07:21:34 2000 +0000
+++ b/buddytrans.c	Wed Apr 05 08:22:38 2000 +0000
@@ -79,6 +79,7 @@
 			} else if (!strcmp("buddy", field)) {
 				fprintf(dest, "b %s\n", name);
 			}
+			free(field);
 		}
 	}
 	fprintf(dest, "}");
--- a/pixmaps/Makefile.am	Wed Apr 05 07:21:34 2000 +0000
+++ b/pixmaps/Makefile.am	Wed Apr 05 08:22:38 2000 +0000
@@ -23,5 +23,6 @@
 gaimgnome_DATA = 
 gaimgnomepixmapsdir = $(gnomedata)/pixmaps/gaim
 gaimgnomepixmaps_DATA = gnome/penguin-online.png gnome/penguin-offline.png \
-	gnome/penguin-connect.png
+	gnome/penguin-connect.png gnome/devil-offline.png \
+	gnome/devil-connect.png gnome/devil-online.png
 endif
--- a/src/Makefile.am	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/Makefile.am	Wed Apr 05 08:22:38 2000 +0000
@@ -13,7 +13,6 @@
 endif
 
 
-
 CFLAGS += $(GAIM_CFLAGS)
 LIBS += $(GAIM_LIBS)
 LDADD += $(GAIM_LDADD)
--- a/src/aim.c	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/aim.c	Wed Apr 05 08:22:38 2000 +0000
@@ -406,6 +406,8 @@
 
                 applet_show_login(APPLET_WIDGET(applet), NULL);
         }
+
+	update_pixmaps();
 	
 	applet_widget_gtk_main();
 #else
--- a/src/gaim.h	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/gaim.h	Wed Apr 05 08:22:38 2000 +0000
@@ -269,7 +269,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 80 $"
+#define REVISION "gaim:$Revision: 92 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -346,6 +346,7 @@
 #define OPT_DISP_SHOW_BUTTON_XPM 0x00000010
 #define OPT_DISP_IGNORE_COLOUR   0x00000020
 #define OPT_DISP_SHOW_LOGON      0x00000040
+#define OPT_DISP_DEVIL_PIXMAPS   0x00000080
 
 extern int sound_options;
 #define OPT_SOUND_LOGIN          0x00000001
--- a/src/gaimrc.c	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/gaimrc.c	Wed Apr 05 08:22:38 2000 +0000
@@ -32,6 +32,10 @@
 #include "gaim.h"
 #include "proxy.h"
 
+#if USE_APPLET
+#include "gnome_applet_mgr.h"
+#endif
+
 
 struct aim_user *current_user = NULL;
 GList *aim_users = NULL;
@@ -415,7 +419,7 @@
                         blist_pos.height = atoi(p->value[3]);
                         blist_pos.xoff = atoi(p->value[4]);
                         blist_pos.yoff = atoi(p->value[5]);
-                }
+		}
 
         }
 
--- a/src/gnome_applet_mgr.c	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/gnome_applet_mgr.c	Wed Apr 05 08:22:38 2000 +0000
@@ -41,6 +41,10 @@
 gboolean applet_draw_open = FALSE;
 GtkWidget *applet_popup = NULL;
 
+gchar GAIM_GNOME_OFFLINE_ICON[255] = GAIM_GNOME_PENGUIN_OFFLINE;
+gchar GAIM_GNOME_CONNECT_ICON[255] = GAIM_GNOME_PENGUIN_CONNECT;
+gchar GAIM_GNOME_ONLINE_ICON[255] = GAIM_GNOME_PENGUIN_ONLINE;
+
 GtkWidget *applet;
 GtkWidget *button;
 GtkWidget *status_label;
@@ -87,13 +91,13 @@
 
 gboolean load_applet_icon( const char *name, int height, int width, GdkPixmap **pm, GdkBitmap **bm ){
 	gboolean result = TRUE;
-	char path[255] = GAIM_GNOME_PIXMAP_DIR;
+	char *path;
 	GdkImlibImage *im;
 	GdkPixmap *temp_pm;
         GdkPixmap *temp_bm;
-		
-	strcat( path, name);
-	
+
+	path = gnome_pixmap_file(name);	
+
 	im=gdk_imlib_load_image( path );
 	
 	if ((*pm)!=NULL)
@@ -111,6 +115,7 @@
 		debug_print(debug_buff);
 	}
 	
+	free(path);
 	return result;
 }
 
@@ -120,7 +125,8 @@
 ** visibility - private
 **
 ** input:
-**	ap - not in use
+**	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
@@ -140,7 +146,7 @@
 		debug_print(debug_buff);
      }
      
-     if( MRI_user_status != old_user_status ){
+     if( MRI_user_status != old_user_status || ap){
 
          switch( MRI_user_status ){
       		case offline:
@@ -173,8 +179,8 @@
       		break;
       		case away:
       			gtk_pixmap_set( GTK_PIXMAP(icon),
-                           icon_away_pm,
-                           icon_away_bm );   
+                           icon_online_pm,
+                           icon_online_bm );   
       			gtk_label_set( GTK_LABEL(status_label), "Away" );
       		break;
       	}
@@ -206,6 +212,25 @@
 
 }
 
+void update_pixmaps() {
+	if (display_options & OPT_DISP_DEVIL_PIXMAPS) {
+		sprintf(GAIM_GNOME_OFFLINE_ICON, "%s",  GAIM_GNOME_DEVIL_OFFLINE);
+		sprintf(GAIM_GNOME_CONNECT_ICON, "%s",  GAIM_GNOME_DEVIL_CONNECT);
+		sprintf(GAIM_GNOME_ONLINE_ICON, "%s",  GAIM_GNOME_DEVIL_ONLINE);
+	} else {
+		sprintf(GAIM_GNOME_OFFLINE_ICON, "%s",  GAIM_GNOME_PENGUIN_OFFLINE);
+		sprintf(GAIM_GNOME_CONNECT_ICON, "%s",  GAIM_GNOME_PENGUIN_CONNECT);
+		sprintf(GAIM_GNOME_ONLINE_ICON, "%s",  GAIM_GNOME_PENGUIN_ONLINE);
+	}
+	load_applet_icon( GAIM_GNOME_OFFLINE_ICON, 32, 34,
+			&icon_offline_pm, &icon_offline_bm );
+	load_applet_icon( GAIM_GNOME_CONNECT_ICON, 32, 34,
+			&icon_connect_pm, &icon_connect_bm );
+	load_applet_icon( GAIM_GNOME_ONLINE_ICON, 32, 34,
+			&icon_online_pm, &icon_online_bm );
+	update_applet((gpointer *)applet);
+}
+
 
 /***************************************************************
 **
@@ -287,6 +312,8 @@
 		awy = awy->next;
 		free(awayname);
 	}
+
+	MRI_user_status = online;
 }
 
 void remove_applet_away() {
@@ -310,6 +337,8 @@
 	}
 	applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away/");
 	applet_widget_unregister_callback(APPLET_WIDGET(applet), "away");
+
+	MRI_user_status = away;
 }
 
 /***************************************************************
@@ -327,7 +356,7 @@
   const gchar *authors[] = {"Mark Spencer <markster@marko.net>",
                             "Jim Duchek <jimduchek@ou.edu>",
                             "Rob Flynn <rflynn@blueridge.net>",
-			
+			    "Eric Warmenhoven <warmenhoven@yahoo.com>",
                             NULL};
 
   GtkWidget *about=gnome_about_new(_("GAIM"),
@@ -687,7 +716,7 @@
 
 void setUserState( enum gaim_user_states state ){
 	MRI_user_status = state; 
-	update_applet( (gpointer *)applet );
+	update_applet(NULL);
 }
 
 void setTotalBuddies( gint num ){
--- a/src/gnome_applet_mgr.h	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/gnome_applet_mgr.h	Wed Apr 05 08:22:38 2000 +0000
@@ -54,19 +54,13 @@
 #define _MSG_ONLINE_ "Online"
 #define _MSG_FONT_ "-adobe-helvetica-medium-r-normal-*-*-80-*-*-p-*-iso8859-1"
 
-#define GAIM_GNOME_PIXMAP_DIR "/usr/share/pixmaps/gaim/gnome/"
+#define GAIM_GNOME_DEVIL_OFFLINE "gaim/gnome/devil-offline.png"
+#define GAIM_GNOME_DEVIL_CONNECT "gaim/gnome/devil-connect.png"
+#define GAIM_GNOME_DEVIL_ONLINE "gaim/gnome/devil-online.png"
 
-/*this should be configurable instead of hard coded.*/
-#if 0
-#define GAIM_GNOME_OFFLINE_ICON "devil-offline.png"
-#define GAIM_GNOME_CONNECT_ICON "devil-connect.png"
-#define GAIM_GNOME_ONLINE_ICON "devil-online.png"
-
-#else 
-#define GAIM_GNOME_OFFLINE_ICON "penguin-offline.png"
-#define GAIM_GNOME_CONNECT_ICON "penguin-connect.png"
-#define GAIM_GNOME_ONLINE_ICON "penguin-online.png"
-#endif
+#define GAIM_GNOME_PENGUIN_OFFLINE "gaim/gnome/penguin-offline.png"
+#define GAIM_GNOME_PENGUIN_CONNECT "gaim/gnome/penguin-connect.png"
+#define GAIM_GNOME_PENGUIN_ONLINE "gaim/gnome/penguin-online.png"
 
 gint InitAppletMgr();                                              /* Initializes and creates applet */
 
@@ -91,6 +85,7 @@
 void insert_applet_away();
 void remove_applet_away();
 
+void update_pixmaps();
 
 
 #endif /*USE_APPLET*/
--- a/src/prefs.c	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/prefs.c	Wed Apr 05 08:22:38 2000 +0000
@@ -105,6 +105,10 @@
 
 	if (blist) update_button_pix();
 
+#if USE_APPLET
+	update_pixmaps();
+#endif
+
 	save_prefs();
 }
 
@@ -708,6 +712,9 @@
 	gaim_button("Transparent text window (experimental)", &transparent, appbox );
 #endif
 	gaim_button("Show logon/logoffs in conversation windows", &display_options, OPT_DISP_SHOW_LOGON, appbox );
+#if USE_APPLET
+	gaim_button("Use devil icons in applet", &display_options, OPT_DISP_DEVIL_PIXMAPS, appbox );
+#endif
 	
 	
 	gaim_button("Bold Text", &font_options, OPT_FONT_BOLD, fontbox);
--- a/src/sound.c	Wed Apr 05 07:21:34 2000 +0000
+++ b/src/sound.c	Wed Apr 05 08:22:38 2000 +0000
@@ -297,7 +297,7 @@
 #else /* USE_APPLET */
 
 #include "gaim.h"
-#include <libgnome/gnome-triggers.h>
+#include <gnome.h>
 void play_sound(int sound)
 {