Mercurial > pidgin.yaz
comparison src/gnome_applet_mgr.c @ 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 | bfdc427b936d |
children | 8a98f129c849 |
comparison
equal
deleted
inserted
replaced
81:7a24bb75a97b | 82:05077cb276d4 |
---|---|
38 gint num_of_buddies_online; /* how many of them are online */ | 38 gint num_of_buddies_online; /* how many of them are online */ |
39 | 39 |
40 gboolean buddy_created = FALSE; | 40 gboolean buddy_created = FALSE; |
41 gboolean applet_draw_open = FALSE; | 41 gboolean applet_draw_open = FALSE; |
42 GtkWidget *applet_popup = NULL; | 42 GtkWidget *applet_popup = NULL; |
43 | |
44 gchar GAIM_GNOME_OFFLINE_ICON[255] = GAIM_GNOME_PENGUIN_OFFLINE; | |
45 gchar GAIM_GNOME_CONNECT_ICON[255] = GAIM_GNOME_PENGUIN_CONNECT; | |
46 gchar GAIM_GNOME_ONLINE_ICON[255] = GAIM_GNOME_PENGUIN_ONLINE; | |
43 | 47 |
44 GtkWidget *applet; | 48 GtkWidget *applet; |
45 GtkWidget *button; | 49 GtkWidget *button; |
46 GtkWidget *status_label; | 50 GtkWidget *status_label; |
47 | 51 |
85 ** | 89 ** |
86 ****************************************************************/ | 90 ****************************************************************/ |
87 | 91 |
88 gboolean load_applet_icon( const char *name, int height, int width, GdkPixmap **pm, GdkBitmap **bm ){ | 92 gboolean load_applet_icon( const char *name, int height, int width, GdkPixmap **pm, GdkBitmap **bm ){ |
89 gboolean result = TRUE; | 93 gboolean result = TRUE; |
90 char path[255] = GAIM_GNOME_PIXMAP_DIR; | 94 char *path; |
91 GdkImlibImage *im; | 95 GdkImlibImage *im; |
92 GdkPixmap *temp_pm; | 96 GdkPixmap *temp_pm; |
93 GdkPixmap *temp_bm; | 97 GdkPixmap *temp_bm; |
94 | 98 |
95 strcat( path, name); | 99 path = gnome_pixmap_file(name); |
96 | 100 |
97 im=gdk_imlib_load_image( path ); | 101 im=gdk_imlib_load_image( path ); |
98 | 102 |
99 if ((*pm)!=NULL) | 103 if ((*pm)!=NULL) |
100 gdk_imlib_free_pixmap((*pm)); | 104 gdk_imlib_free_pixmap((*pm)); |
101 | 105 |
109 result = FALSE; | 113 result = FALSE; |
110 sprintf(debug_buff,"file not found: %s\n",path); | 114 sprintf(debug_buff,"file not found: %s\n",path); |
111 debug_print(debug_buff); | 115 debug_print(debug_buff); |
112 } | 116 } |
113 | 117 |
118 free(path); | |
114 return result; | 119 return result; |
115 } | 120 } |
116 | 121 |
117 /*************************************************************** | 122 /*************************************************************** |
118 ** | 123 ** |
119 ** function update_applet | 124 ** function update_applet |
120 ** visibility - private | 125 ** visibility - private |
121 ** | 126 ** |
122 ** input: | 127 ** input: |
123 ** ap - not in use | 128 ** ap - if not NULL, was called from update_pixmaps, and |
129 ** should update them | |
124 ** | 130 ** |
125 ** description - takes care of swapping status icons and | 131 ** description - takes care of swapping status icons and |
126 ** updating the status label | 132 ** updating the status label |
127 ** | 133 ** |
128 ****************************************************************/ | 134 ****************************************************************/ |
138 } else { | 144 } else { |
139 sprintf(debug_buff, "Drawer is closed\n"); | 145 sprintf(debug_buff, "Drawer is closed\n"); |
140 debug_print(debug_buff); | 146 debug_print(debug_buff); |
141 } | 147 } |
142 | 148 |
143 if( MRI_user_status != old_user_status ){ | 149 if( MRI_user_status != old_user_status || ap){ |
144 | 150 |
145 switch( MRI_user_status ){ | 151 switch( MRI_user_status ){ |
146 case offline: | 152 case offline: |
147 gtk_pixmap_set( GTK_PIXMAP(icon), | 153 gtk_pixmap_set( GTK_PIXMAP(icon), |
148 icon_offline_pm, | 154 icon_offline_pm, |
171 icon_msg_pending_bm ); | 177 icon_msg_pending_bm ); |
172 gtk_label_set( GTK_LABEL(status_label), "msg" ); | 178 gtk_label_set( GTK_LABEL(status_label), "msg" ); |
173 break; | 179 break; |
174 case away: | 180 case away: |
175 gtk_pixmap_set( GTK_PIXMAP(icon), | 181 gtk_pixmap_set( GTK_PIXMAP(icon), |
176 icon_away_pm, | 182 icon_online_pm, |
177 icon_away_bm ); | 183 icon_online_bm ); |
178 gtk_label_set( GTK_LABEL(status_label), "Away" ); | 184 gtk_label_set( GTK_LABEL(status_label), "Away" ); |
179 break; | 185 break; |
180 } | 186 } |
181 old_user_status = MRI_user_status; | 187 old_user_status = MRI_user_status; |
182 } | 188 } |
204 #endif /*_USE_BUDDY_COUNT_*/ | 210 #endif /*_USE_BUDDY_COUNT_*/ |
205 return TRUE; | 211 return TRUE; |
206 | 212 |
207 } | 213 } |
208 | 214 |
215 void update_pixmaps() { | |
216 if (display_options & OPT_DISP_DEVIL_PIXMAPS) { | |
217 sprintf(GAIM_GNOME_OFFLINE_ICON, "%s", GAIM_GNOME_DEVIL_OFFLINE); | |
218 sprintf(GAIM_GNOME_CONNECT_ICON, "%s", GAIM_GNOME_DEVIL_CONNECT); | |
219 sprintf(GAIM_GNOME_ONLINE_ICON, "%s", GAIM_GNOME_DEVIL_ONLINE); | |
220 } else { | |
221 sprintf(GAIM_GNOME_OFFLINE_ICON, "%s", GAIM_GNOME_PENGUIN_OFFLINE); | |
222 sprintf(GAIM_GNOME_CONNECT_ICON, "%s", GAIM_GNOME_PENGUIN_CONNECT); | |
223 sprintf(GAIM_GNOME_ONLINE_ICON, "%s", GAIM_GNOME_PENGUIN_ONLINE); | |
224 } | |
225 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, 32, 34, | |
226 &icon_offline_pm, &icon_offline_bm ); | |
227 load_applet_icon( GAIM_GNOME_CONNECT_ICON, 32, 34, | |
228 &icon_connect_pm, &icon_connect_bm ); | |
229 load_applet_icon( GAIM_GNOME_ONLINE_ICON, 32, 34, | |
230 &icon_online_pm, &icon_online_bm ); | |
231 update_applet((gpointer *)applet); | |
232 } | |
233 | |
209 | 234 |
210 /*************************************************************** | 235 /*************************************************************** |
211 ** | 236 ** |
212 ** function make_buddy | 237 ** function make_buddy |
213 ** visibility - private | 238 ** visibility - private |
285 a); | 310 a); |
286 | 311 |
287 awy = awy->next; | 312 awy = awy->next; |
288 free(awayname); | 313 free(awayname); |
289 } | 314 } |
315 | |
316 MRI_user_status = online; | |
290 } | 317 } |
291 | 318 |
292 void remove_applet_away() { | 319 void remove_applet_away() { |
293 GList *awy = away_messages; | 320 GList *awy = away_messages; |
294 struct away_message *a; | 321 struct away_message *a; |
308 awy = awy->next; | 335 awy = awy->next; |
309 free(awayname); | 336 free(awayname); |
310 } | 337 } |
311 applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away/"); | 338 applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away/"); |
312 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); | 339 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); |
340 | |
341 MRI_user_status = away; | |
313 } | 342 } |
314 | 343 |
315 /*************************************************************** | 344 /*************************************************************** |
316 ** | 345 ** |
317 ** function applet_show_about | 346 ** function applet_show_about |
325 void applet_show_about(AppletWidget *widget, gpointer data) { | 354 void applet_show_about(AppletWidget *widget, gpointer data) { |
326 | 355 |
327 const gchar *authors[] = {"Mark Spencer <markster@marko.net>", | 356 const gchar *authors[] = {"Mark Spencer <markster@marko.net>", |
328 "Jim Duchek <jimduchek@ou.edu>", | 357 "Jim Duchek <jimduchek@ou.edu>", |
329 "Rob Flynn <rflynn@blueridge.net>", | 358 "Rob Flynn <rflynn@blueridge.net>", |
330 | 359 "Eric Warmenhoven <warmenhoven@yahoo.com>", |
331 NULL}; | 360 NULL}; |
332 | 361 |
333 GtkWidget *about=gnome_about_new(_("GAIM"), | 362 GtkWidget *about=gnome_about_new(_("GAIM"), |
334 _(VERSION), | 363 _(VERSION), |
335 _(""), | 364 _(""), |
685 return 0; | 714 return 0; |
686 } | 715 } |
687 | 716 |
688 void setUserState( enum gaim_user_states state ){ | 717 void setUserState( enum gaim_user_states state ){ |
689 MRI_user_status = state; | 718 MRI_user_status = state; |
690 update_applet( (gpointer *)applet ); | 719 update_applet(NULL); |
691 } | 720 } |
692 | 721 |
693 void setTotalBuddies( gint num ){ | 722 void setTotalBuddies( gint num ){ |
694 total_num_of_buddies = num; | 723 total_num_of_buddies = num; |
695 } | 724 } |