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