Mercurial > pidgin
annotate src/gnome_applet_mgr.c @ 191:948100a8cb23
[gaim-migrate @ 201]
Wrote a plugin for IcedSoal to put an asterisk in the titlebar of conversations
where you haven't replied to the person yet (e.g. you weren't the last person
to say something).
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 27 Apr 2000 12:14:16 +0000 |
parents | 5d62a5d50c89 |
children | bc117fbcf527 |
rev | line source |
---|---|
1 | 1 /************************************************************** |
2 ** | |
3 ** GaimGnomeAppletMgr | |
4 ** Author - Quinticent (John Palmieri: johnp@martianrock.com) | |
5 ** | |
6 ** Purpose - Takes over the task of managing the GNOME applet | |
7 ** code and provides a centralized codebase for | |
8 ** GNOME integration for Gaim. | |
9 ** | |
10 ** | |
11 ** gaim | |
12 ** | |
13 ** Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
14 ** | |
15 ** This program is free software; you can redistribute it and/or modify | |
16 ** it under the terms of the GNU General Public License as published by | |
17 ** the Free Software Foundation; either version 2 of the License, or | |
18 ** (at your option) any later version. | |
19 ** | |
20 ** This program is distributed in the hope that it will be useful, | |
21 ** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 ** GNU General Public License for more details. | |
24 ** | |
25 ** You should have received a copy of the GNU General Public License | |
26 ** along with this program; if not, write to the Free Software | |
27 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
28 */ | |
29 | |
30 #ifdef USE_APPLET | |
31 #include <string.h> | |
32 #include <gdk_imlib.h> | |
33 #include "gaim.h" | |
34 #include "gnome_applet_mgr.h" | |
35 | |
36 enum gaim_user_states MRI_user_status; | |
37 | |
38 gboolean buddy_created = FALSE; | |
39 gboolean applet_draw_open = FALSE; | |
40 GtkWidget *applet_popup = NULL; | |
41 | |
82 | 42 gchar GAIM_GNOME_OFFLINE_ICON[255] = GAIM_GNOME_PENGUIN_OFFLINE; |
43 gchar GAIM_GNOME_CONNECT_ICON[255] = GAIM_GNOME_PENGUIN_CONNECT; | |
44 gchar GAIM_GNOME_ONLINE_ICON[255] = GAIM_GNOME_PENGUIN_ONLINE; | |
45 | |
1 | 46 GtkWidget *applet; |
47 GtkWidget *button; | |
48 GtkWidget *status_label; | |
49 | |
50 GtkWidget *icon; | |
51 GdkPixmap *icon_offline_pm=NULL; | |
52 GdkPixmap *icon_offline_bm=NULL; | |
53 | |
54 GdkPixmap *icon_online_pm=NULL; | |
55 GdkPixmap *icon_online_bm=NULL; | |
56 | |
57 GdkPixmap *icon_connect_pm=NULL; | |
58 GdkPixmap *icon_connect_bm=NULL; | |
59 | |
60 GdkPixmap *icon_msg_pending_pm=NULL; | |
61 GdkPixmap *icon_msg_pending_bm=NULL; | |
62 | |
63 GdkPixmap *icon_away_pm=NULL; | |
64 GdkPixmap *icon_away_bm=NULL; | |
65 | |
66 /*************************************************************** | |
67 ** | |
68 ** function load_applet_icon | |
69 ** visibility - private | |
70 ** | |
71 ** input: | |
72 ** name - the name of the file to load | |
73 ** height, width - the height and width | |
74 ** that the icon should be | |
75 ** scaled to. | |
76 ** | |
77 ** output: | |
78 ** TRUE - success | |
79 ** FALSE - failure | |
80 ** pm - a GdkPixmap structure that the icon is loaded into | |
81 ** bm - a GdkBitmap structure that the icon's transparancy | |
82 ** mask is loaded into | |
83 ** | |
84 ** description - loads an icon from | |
85 ** /usr/share/pixmap/gaim/gnome/ | |
86 ** and scales it using imlib | |
87 ** | |
88 ****************************************************************/ | |
89 | |
90 gboolean load_applet_icon( const char *name, int height, int width, GdkPixmap **pm, GdkBitmap **bm ){ | |
91 gboolean result = TRUE; | |
82 | 92 char *path; |
1 | 93 GdkImlibImage *im; |
94 GdkPixmap *temp_pm; | |
95 GdkPixmap *temp_bm; | |
82 | 96 |
97 path = gnome_pixmap_file(name); | |
98 | |
1 | 99 im=gdk_imlib_load_image( path ); |
100 | |
101 if ((*pm)!=NULL) | |
102 gdk_imlib_free_pixmap((*pm)); | |
103 | |
104 if( im!= NULL ){ | |
105 gdk_imlib_render(im,width,height); | |
106 | |
107 (*pm) = gdk_imlib_move_image(im); | |
108 (*bm) = gdk_imlib_move_mask(im); | |
109 | |
110 } else { | |
111 result = FALSE; | |
112 sprintf(debug_buff,"file not found: %s\n",path); | |
113 debug_print(debug_buff); | |
114 } | |
115 | |
82 | 116 free(path); |
1 | 117 return result; |
118 } | |
119 | |
120 /*************************************************************** | |
121 ** | |
122 ** function update_applet | |
123 ** visibility - private | |
124 ** | |
125 ** input: | |
82 | 126 ** ap - if not NULL, was called from update_pixmaps, and |
127 ** should update them | |
1 | 128 ** |
129 ** description - takes care of swapping status icons and | |
130 ** updating the status label | |
131 ** | |
132 ****************************************************************/ | |
133 | |
134 gboolean update_applet( gpointer *ap ){ | |
135 char temp_string[25]; | |
136 static enum gaim_user_states old_user_status = offline; | |
137 | |
82 | 138 if( MRI_user_status != old_user_status || ap){ |
1 | 139 |
140 switch( MRI_user_status ){ | |
141 case offline: | |
142 gtk_pixmap_set( GTK_PIXMAP(icon), | |
143 icon_offline_pm, | |
144 icon_offline_bm ); | |
145 gtk_label_set( GTK_LABEL(status_label), _MSG_OFFLINE_ ); | |
146 break; | |
147 case signing_on: | |
148 gtk_pixmap_set( GTK_PIXMAP(icon), | |
149 icon_connect_pm, | |
150 icon_connect_bm ); | |
151 gtk_label_set( GTK_LABEL(status_label), _MSG_CONNECT_ ); | |
152 break; | |
153 case online: | |
154 gtk_pixmap_set( GTK_PIXMAP(icon), | |
155 icon_online_pm, | |
156 icon_online_bm ); | |
157 | |
158 gtk_label_set( GTK_LABEL(status_label), _MSG_ONLINE_ ); | |
159 break; | |
160 | |
161 case unread_message_pending: | |
162 gtk_pixmap_set( GTK_PIXMAP(icon), | |
163 icon_msg_pending_pm, | |
164 icon_msg_pending_bm ); | |
165 gtk_label_set( GTK_LABEL(status_label), "msg" ); | |
166 break; | |
167 case away: | |
168 gtk_pixmap_set( GTK_PIXMAP(icon), | |
82 | 169 icon_online_pm, |
170 icon_online_bm ); | |
1 | 171 gtk_label_set( GTK_LABEL(status_label), "Away" ); |
172 break; | |
173 } | |
174 old_user_status = MRI_user_status; | |
175 } | |
176 return TRUE; | |
177 | |
178 } | |
179 | |
82 | 180 void update_pixmaps() { |
181 if (display_options & OPT_DISP_DEVIL_PIXMAPS) { | |
182 sprintf(GAIM_GNOME_OFFLINE_ICON, "%s", GAIM_GNOME_DEVIL_OFFLINE); | |
183 sprintf(GAIM_GNOME_CONNECT_ICON, "%s", GAIM_GNOME_DEVIL_CONNECT); | |
184 sprintf(GAIM_GNOME_ONLINE_ICON, "%s", GAIM_GNOME_DEVIL_ONLINE); | |
185 } else { | |
186 sprintf(GAIM_GNOME_OFFLINE_ICON, "%s", GAIM_GNOME_PENGUIN_OFFLINE); | |
187 sprintf(GAIM_GNOME_CONNECT_ICON, "%s", GAIM_GNOME_PENGUIN_CONNECT); | |
188 sprintf(GAIM_GNOME_ONLINE_ICON, "%s", GAIM_GNOME_PENGUIN_ONLINE); | |
189 } | |
190 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, 32, 34, | |
191 &icon_offline_pm, &icon_offline_bm ); | |
192 load_applet_icon( GAIM_GNOME_CONNECT_ICON, 32, 34, | |
193 &icon_connect_pm, &icon_connect_bm ); | |
194 load_applet_icon( GAIM_GNOME_ONLINE_ICON, 32, 34, | |
195 &icon_online_pm, &icon_online_bm ); | |
196 update_applet((gpointer *)applet); | |
197 } | |
198 | |
1 | 199 |
200 /*************************************************************** | |
201 ** | |
202 ** function make_buddy | |
203 ** visibility - private | |
204 ** | |
205 ** description - If buddylist is not created create it | |
206 ** else show the buddy list | |
207 ** | |
208 ****************************************************************/ | |
209 void make_buddy(void) { | |
210 set_applet_draw_open(); | |
211 if( !buddy_created ){ | |
212 show_buddy_list(); | |
213 buddy_created = TRUE; | |
214 } else { | |
215 gnome_buddy_show(); | |
216 } | |
16 | 217 build_edit_tree(); |
1 | 218 applet_widget_unregister_callback(APPLET_WIDGET(applet),"buddy"); |
219 | |
220 } | |
221 | |
222 /*************************************************************** | |
223 ** | |
224 ** function applet_show_login | |
225 ** visibility - private | |
226 ** | |
227 ** input: | |
228 ** | |
229 ** | |
230 ** description - I guess it shows the login dialog | |
231 ** | |
232 ****************************************************************/ | |
233 | |
234 void applet_show_login(AppletWidget *widget, gpointer data) { | |
235 show_login(); | |
84 | 236 /* |
1 | 237 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon"); |
238 applet_widget_register_callback(APPLET_WIDGET(applet), | |
239 "signoff", | |
240 _("Signoff"), | |
241 signoff, | |
242 NULL); | |
18 | 243 insert_applet_away(); |
1 | 244 applet_widget_register_callback(APPLET_WIDGET(applet), |
245 "buddy", | |
246 _("Buddy List"), | |
107
55faf2e3a134
[gaim-migrate @ 117]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
247 (AppletCallbackFunc)createOnlinePopup, |
1 | 248 NULL); |
84 | 249 */ |
1 | 250 } |
251 | |
18 | 252 void insert_applet_away() { |
253 GList *awy = away_messages; | |
254 struct away_message *a; | |
255 char *awayname; | |
256 | |
257 applet_widget_register_callback_dir(APPLET_WIDGET(applet), | |
46 | 258 "away/", |
18 | 259 _("Away")); |
260 applet_widget_register_callback(APPLET_WIDGET(applet), | |
261 "away/new", | |
262 _("New Away Message"), | |
263 (AppletCallbackFunc)create_away_mess, | |
264 NULL); | |
265 | |
266 while(awy) { | |
267 a = (struct away_message *)awy->data; | |
268 | |
79 | 269 awayname = g_malloc(sizeof *awayname * (6 + strlen(a->name))); |
18 | 270 awayname[0] = '\0'; |
271 strcat(awayname, "away/"); | |
272 strcat(awayname, a->name); | |
273 applet_widget_register_callback(APPLET_WIDGET(applet), | |
274 awayname, | |
275 a->name, | |
276 (AppletCallbackFunc)do_away_message, | |
277 a); | |
278 | |
279 awy = awy->next; | |
23 | 280 free(awayname); |
18 | 281 } |
282 } | |
283 | |
284 void remove_applet_away() { | |
285 GList *awy = away_messages; | |
286 struct away_message *a; | |
287 char *awayname; | |
288 | |
289 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away/new"); | |
290 | |
291 while (awy) { | |
292 a = (struct away_message *)awy->data; | |
293 | |
79 | 294 awayname = g_malloc(sizeof *awayname * (6 + strlen(a->name))); |
18 | 295 awayname[0] = '\0'; |
296 strcat(awayname, "away/"); | |
297 strcat(awayname, a->name); | |
298 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname); | |
299 | |
300 awy = awy->next; | |
23 | 301 free(awayname); |
18 | 302 } |
46 | 303 applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away/"); |
18 | 304 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); |
305 } | |
306 | |
1 | 307 /*************************************************************** |
308 ** | |
309 ** function applet_show_about | |
310 ** visibility - public | |
311 ** | |
312 ** | |
313 ** description - takes care of creating and | |
314 ** displaying the about box | |
315 ** | |
316 ****************************************************************/ | |
317 void applet_show_about(AppletWidget *widget, gpointer data) { | |
318 | |
319 const gchar *authors[] = {"Mark Spencer <markster@marko.net>", | |
320 "Jim Duchek <jimduchek@ou.edu>", | |
321 "Rob Flynn <rflynn@blueridge.net>", | |
82 | 322 "Eric Warmenhoven <warmenhoven@yahoo.com>", |
178
5d62a5d50c89
[gaim-migrate @ 188]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
323 "Syd Logan", |
1 | 324 NULL}; |
325 | |
326 GtkWidget *about=gnome_about_new(_("GAIM"), | |
327 _(VERSION), | |
328 _(""), | |
329 authors, | |
330 "", | |
331 NULL); | |
332 gtk_widget_show(about); | |
333 } | |
334 | |
335 /*************************************************************** | |
336 ** | |
337 ** function AppletCancelLogin (name should be changed to | |
338 ** applet_cancel_login) | |
339 ** visibility - public | |
340 ** | |
341 ** description - called when user cancels login | |
342 ** | |
343 ****************************************************************/ | |
344 void AppletCancelLogon(){ | |
345 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff"); | |
346 applet_widget_register_callback(APPLET_WIDGET(applet), | |
347 "signon", | |
348 _("Signon"), | |
349 applet_show_login, | |
350 NULL); | |
351 } | |
352 | |
353 /*************************************************************** | |
354 ** | |
355 ** function get_applet_pos | |
356 ** visibility - private | |
357 ** | |
358 ** output: | |
359 ** GtKAllocation - a Gtk struct that holds the | |
360 ** position of the dialog | |
361 ** | |
362 ** description - returns the x,y position the buddy list should | |
363 ** should be placed based on the position | |
364 ** of the applet and the orientation | |
365 ** of the Gnome panel. | |
366 ** | |
367 ****************************************************************/ | |
368 GtkAllocation get_applet_pos(){ | |
369 GtkAllocation pos; | |
370 gint x,y,pad; | |
371 GtkRequisition buddy_req, applet_req; | |
372 GtkAllocation result; | |
373 GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) ); | |
374 pad = 5; | |
375 gdk_window_get_position( gtk_widget_get_parent_window( button ),&x,&y ); | |
376 buddy_req = gnome_buddy_get_dimentions(); | |
377 applet_req = button->requisition; | |
378 switch( orient ){ | |
379 case ORIENT_UP: | |
380 result.x=x; | |
381 result.y=y-(buddy_req.height+pad); | |
382 break; | |
383 case ORIENT_DOWN: | |
384 result.x=x; | |
385 result.y=y+applet_req.height+pad; | |
386 | |
387 break; | |
388 case ORIENT_LEFT: | |
389 result.x=x-(buddy_req.width + pad ); | |
390 result.y=y; | |
391 break; | |
392 case ORIENT_RIGHT: | |
393 result.x=x+applet_req.width+pad; | |
394 result.y=y; | |
395 break; | |
396 } | |
397 | |
398 | |
399 return result; | |
400 } | |
401 | |
402 | |
403 | |
404 void createOfflinePopup(){ | |
405 applet_show_login( APPLET_WIDGET(applet), NULL ); | |
406 } | |
407 | |
408 | |
409 void createSignonPopup(){ | |
410 applet_draw_open = FALSE; | |
411 } | |
412 | |
413 | |
414 void createOnlinePopup(){ | |
415 GtkAllocation al; | |
416 make_buddy(); | |
417 al = get_applet_pos(); | |
418 gnome_buddy_set_pos( al.x, al.y ); | |
419 } | |
420 | |
421 | |
422 void createPendingPopup(){ | |
423 applet_draw_open = FALSE; | |
424 } | |
425 | |
426 | |
427 void createAwayPopup(){ | |
83 | 428 createOnlinePopup(); |
1 | 429 } |
430 | |
431 | |
432 void closeOfflinePopup(){ | |
433 cancel_logon(); | |
434 set_applet_draw_closed(); | |
435 } | |
436 | |
437 | |
438 void closeSignonPopup(){ | |
439 | |
440 } | |
441 | |
442 | |
443 void closeOnlinePopup(){ | |
444 set_applet_draw_closed(); | |
445 applet_destroy_buddy(); | |
446 } | |
447 | |
448 | |
449 void closePendingPopup(){ | |
450 applet_draw_open = FALSE; | |
451 } | |
452 | |
453 | |
454 void closeAwayPopup(){ | |
83 | 455 closeOnlinePopup(); |
1 | 456 } |
457 | |
458 void AppletClicked( GtkWidget *sender, gpointer data ){ | |
459 | |
460 if( applet_draw_open ){ | |
461 switch( MRI_user_status ){ | |
462 case offline: | |
463 closeOfflinePopup(); | |
464 break; | |
465 case signing_on: | |
466 closeSignonPopup(); | |
467 break; | |
468 case online: | |
469 closeOnlinePopup(); | |
470 | |
471 break; | |
472 case unread_message_pending: | |
473 closePendingPopup(); | |
474 break; | |
475 case away: | |
476 closeAwayPopup(); | |
477 break; | |
478 } | |
479 } else { | |
480 set_applet_draw_open(); | |
481 switch( MRI_user_status ){ | |
482 case offline: | |
483 createOfflinePopup(); | |
484 break; | |
485 case signing_on: | |
486 createSignonPopup(); | |
487 break; | |
488 case online: | |
489 createOnlinePopup(); | |
490 break; | |
491 case unread_message_pending: | |
492 createPendingPopup(); | |
493 break; | |
494 case away: | |
495 createAwayPopup(); | |
496 break; | |
497 } | |
498 | |
499 | |
500 } | |
501 } | |
502 | |
503 | |
504 #ifdef HAVE_PANEL_SIZE | |
505 /*************************************************************** | |
506 ** | |
507 ** Code for panel resizing | |
508 ** | |
509 ****************************************************************/ | |
510 static void applet_change_size(GtkWidget *w, PanelSizeType o, gpointer data) { | |
511 switch(o) { | |
512 case SIZE_TINY: | |
513 /*24x24*/ | |
514 gtk_widget_set_usize( button, 24,24 ); | |
515 | |
516 /*load offline icon*/ | |
517 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, | |
518 24, 24, &icon_offline_pm, &icon_offline_bm ); | |
519 | |
520 /*load connecting icon*/ | |
521 load_applet_icon( GAIM_GNOME_CONNECT_ICON, | |
522 24, 24, &icon_connect_pm, &icon_connect_bm ); | |
523 | |
524 /*load online icon*/ | |
525 load_applet_icon( GAIM_GNOME_ONLINE_ICON, | |
526 24, 24, &icon_online_pm, &icon_online_bm ); | |
527 break; | |
528 | |
529 case SIZE_STANDARD: | |
530 /*48x48*/ | |
531 gtk_widget_set_usize( button, 48,48 ); | |
532 | |
533 /*load offline icon*/ | |
534 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, | |
535 32, 34, &icon_offline_pm, &icon_offline_bm ); | |
536 | |
537 /*load connecting icon*/ | |
538 load_applet_icon( GAIM_GNOME_CONNECT_ICON, | |
539 32, 34, &icon_connect_pm, &icon_connect_bm ); | |
540 | |
541 /*load online icon*/ | |
542 load_applet_icon( GAIM_GNOME_ONLINE_ICON, | |
543 32, 34, &icon_online_pm, &icon_online_bm ); | |
544 break; | |
545 | |
546 case SIZE_LARGE: | |
547 /*64x64*/ | |
548 gtk_widget_set_usize( button, 64, 64 ); | |
549 | |
550 /*load offline icon*/ | |
551 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, | |
552 55, 55, &icon_offline_pm, &icon_offline_bm ); | |
553 | |
554 /*load connecting icon*/ | |
555 load_applet_icon( GAIM_GNOME_CONNECT_ICON, | |
556 55, 55, &icon_connect_pm, &icon_connect_bm ); | |
557 | |
558 /*load online icon*/ | |
559 load_applet_icon( GAIM_GNOME_ONLINE_ICON, | |
560 55, 55, &icon_online_pm, &icon_online_bm ); | |
561 break; | |
562 | |
563 case SIZE_HUGE: | |
564 /*80x80*/ | |
565 gtk_widget_set_usize( button, 80, 80 ); | |
566 | |
567 /*load offline icon*/ | |
568 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, | |
569 70, 70, &icon_offline_pm, &icon_offline_bm ); | |
570 | |
571 /*load connecting icon*/ | |
572 load_applet_icon( GAIM_GNOME_CONNECT_ICON, | |
573 70, 70, &icon_connect_pm, &icon_connect_bm ); | |
574 | |
575 /*load online icon*/ | |
576 load_applet_icon( GAIM_GNOME_ONLINE_ICON, | |
577 70, 70, &icon_online_pm, &icon_online_bm ); | |
578 | |
579 break; | |
580 } | |
581 } | |
582 #endif /*HAVE_PANEL_SIZE*/ | |
583 | |
584 | |
585 /*************************************************************** | |
586 ** | |
587 ** Initialize GNOME stuff | |
588 ** | |
589 ****************************************************************/ | |
590 | |
591 gint InitAppletMgr( int argc, char *argv[] ){ | |
592 GtkWidget *vbox; | |
593 | |
594 GtkStyle *label_style; | |
595 GdkFont *label_font = NULL; | |
596 | |
597 applet_widget_init("GAIM",VERSION,argc,argv,NULL,0,NULL); | |
598 | |
599 /*init imlib for graphics*/ | |
600 gdk_imlib_init(); | |
601 gtk_widget_push_visual(gdk_imlib_get_visual()); | |
602 gtk_widget_push_colormap(gdk_imlib_get_colormap()); | |
603 | |
604 applet=applet_widget_new("gaim_applet"); | |
605 if(!applet) g_error(_("Can't create GAIM applet!")); | |
606 | |
607 button=gtk_button_new(); | |
608 | |
609 | |
610 gtk_widget_set_usize( button, 48,48 ); | |
611 | |
612 | |
613 /*load offline icon*/ | |
614 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, | |
615 32, 32, &icon_offline_pm, &icon_offline_bm ); | |
616 | |
617 /*load connecting icon*/ | |
618 load_applet_icon( GAIM_GNOME_CONNECT_ICON, | |
619 32, 32, &icon_connect_pm, &icon_connect_bm ); | |
620 | |
621 /*load online icon*/ | |
622 load_applet_icon( GAIM_GNOME_ONLINE_ICON, | |
623 32, 32, &icon_online_pm, &icon_online_bm ); | |
624 | |
625 /*icon_away and icon_msg_pennding need to be implemented*/ | |
626 | |
627 icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm); | |
628 | |
629 gtk_timeout_add( 1500, (GtkFunction)update_applet, NULL ); | |
630 | |
631 vbox = gtk_vbox_new(FALSE,0); | |
632 | |
633 gtk_box_pack_start(GTK_BOX(vbox), icon, FALSE, TRUE, 0); | |
634 | |
635 status_label = gtk_label_new("Offline"); | |
636 /*set this label's font*/ | |
637 label_style = gtk_widget_get_style( status_label ); | |
638 | |
639 label_font = gdk_font_load( _MSG_FONT_ ); | |
640 | |
641 | |
642 if( label_font != NULL ){ | |
643 label_style->font = label_font; | |
644 gtk_widget_set_style( status_label, label_style ); | |
645 } else { | |
646 sprintf(debug_buff, "Font does not exist" ); | |
647 debug_print(debug_buff); | |
648 } | |
649 | |
650 #ifdef HAVE_PANEL_SIZE | |
651 gtk_signal_connect(GTK_OBJECT(applet),"change_size", | |
652 GTK_SIGNAL_FUNC(applet_change_size), | |
653 NULL); | |
654 #endif /*HAVE_PANEL_SIZE*/ | |
655 | |
656 gtk_box_pack_start(GTK_BOX(vbox), status_label, FALSE, TRUE, 0); | |
657 | |
658 gtk_container_add( GTK_CONTAINER(button), vbox ); | |
659 applet_widget_add(APPLET_WIDGET(applet), button); | |
660 | |
661 gtk_widget_show( status_label ); | |
662 gtk_widget_show( vbox ); | |
663 gtk_widget_show( button ); | |
664 | |
665 applet_widget_set_tooltip(APPLET_WIDGET(applet),"GAIM"); | |
666 | |
667 applet_widget_register_stock_callback(APPLET_WIDGET(applet), | |
668 "about", | |
669 GNOME_STOCK_MENU_ABOUT, | |
670 _("About..."), | |
671 applet_show_about, | |
672 NULL); | |
673 | |
674 gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( AppletClicked), NULL); | |
675 | |
676 gtk_widget_show(icon); | |
677 gtk_widget_show(applet); | |
678 return 0; | |
679 } | |
680 | |
681 void setUserState( enum gaim_user_states state ){ | |
682 MRI_user_status = state; | |
82 | 683 update_applet(NULL); |
1 | 684 } |
685 | |
686 enum gaim_user_states getUserState(){ | |
687 return MRI_user_status; | |
688 } | |
689 | |
690 void set_applet_draw_open(){ | |
691 applet_draw_open = TRUE; | |
692 } | |
693 | |
694 void set_applet_draw_closed(){ | |
695 applet_draw_open = FALSE; | |
696 } | |
697 | |
698 #endif /*USE_APPLET*/ |