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