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 gint total_num_of_buddies; /* how many buddies I have in my list */
|
|
38 gint num_of_buddies_online; /* how many of them are online */
|
|
39
|
|
40 gboolean buddy_created = FALSE;
|
|
41 gboolean applet_draw_open = FALSE;
|
|
42 GtkWidget *applet_popup = NULL;
|
|
43
|
|
44 GtkWidget *applet;
|
|
45 GtkWidget *button;
|
|
46 GtkWidget *status_label;
|
|
47
|
|
48 GtkWidget *icon;
|
|
49 GdkPixmap *icon_offline_pm=NULL;
|
|
50 GdkPixmap *icon_offline_bm=NULL;
|
|
51
|
|
52 GdkPixmap *icon_online_pm=NULL;
|
|
53 GdkPixmap *icon_online_bm=NULL;
|
|
54
|
|
55 GdkPixmap *icon_connect_pm=NULL;
|
|
56 GdkPixmap *icon_connect_bm=NULL;
|
|
57
|
|
58 GdkPixmap *icon_msg_pending_pm=NULL;
|
|
59 GdkPixmap *icon_msg_pending_bm=NULL;
|
|
60
|
|
61 GdkPixmap *icon_away_pm=NULL;
|
|
62 GdkPixmap *icon_away_bm=NULL;
|
|
63
|
|
64 /***************************************************************
|
|
65 **
|
|
66 ** function load_applet_icon
|
|
67 ** visibility - private
|
|
68 **
|
|
69 ** input:
|
|
70 ** name - the name of the file to load
|
|
71 ** height, width - the height and width
|
|
72 ** that the icon should be
|
|
73 ** scaled to.
|
|
74 **
|
|
75 ** output:
|
|
76 ** TRUE - success
|
|
77 ** FALSE - failure
|
|
78 ** pm - a GdkPixmap structure that the icon is loaded into
|
|
79 ** bm - a GdkBitmap structure that the icon's transparancy
|
|
80 ** mask is loaded into
|
|
81 **
|
|
82 ** description - loads an icon from
|
|
83 ** /usr/share/pixmap/gaim/gnome/
|
|
84 ** and scales it using imlib
|
|
85 **
|
|
86 ****************************************************************/
|
|
87
|
|
88 gboolean load_applet_icon( const char *name, int height, int width, GdkPixmap **pm, GdkBitmap **bm ){
|
|
89 gboolean result = TRUE;
|
|
90 char path[255] = GAIM_GNOME_PIXMAP_DIR;
|
|
91 GdkImlibImage *im;
|
|
92 GdkPixmap *temp_pm;
|
|
93 GdkPixmap *temp_bm;
|
|
94
|
|
95 strcat( path, name);
|
|
96
|
|
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
|
|
114 return result;
|
|
115 }
|
|
116
|
|
117 /***************************************************************
|
|
118 **
|
|
119 ** function update_applet
|
|
120 ** visibility - private
|
|
121 **
|
|
122 ** input:
|
|
123 ** ap - not in use
|
|
124 **
|
|
125 ** description - takes care of swapping status icons and
|
|
126 ** updating the status label
|
|
127 **
|
|
128 ****************************************************************/
|
|
129
|
|
130 gboolean update_applet( gpointer *ap ){
|
|
131 char temp_string[25];
|
|
132 static enum gaim_user_states old_user_status = offline;
|
|
133 static gint old_total_num_of_buddies = -1;
|
|
134 static gint old_num_of_buddies_online = -1;
|
|
135 if( applet_draw_open ){
|
|
136 sprintf(debug_buff, "Drawer is open\n");
|
|
137 debug_print(debug_buff);
|
|
138 } else {
|
|
139 sprintf(debug_buff, "Drawer is closed\n");
|
|
140 debug_print(debug_buff);
|
|
141 }
|
|
142
|
|
143 if( MRI_user_status != old_user_status ){
|
|
144
|
|
145 switch( MRI_user_status ){
|
|
146 case offline:
|
|
147 gtk_pixmap_set( GTK_PIXMAP(icon),
|
|
148 icon_offline_pm,
|
|
149 icon_offline_bm );
|
|
150 gtk_label_set( GTK_LABEL(status_label), _MSG_OFFLINE_ );
|
|
151 break;
|
|
152 case signing_on:
|
|
153 gtk_pixmap_set( GTK_PIXMAP(icon),
|
|
154 icon_connect_pm,
|
|
155 icon_connect_bm );
|
|
156 gtk_label_set( GTK_LABEL(status_label), _MSG_CONNECT_ );
|
|
157 old_total_num_of_buddies = -1;
|
|
158 old_num_of_buddies_online = -1;
|
|
159 break;
|
|
160 case online:
|
|
161 gtk_pixmap_set( GTK_PIXMAP(icon),
|
|
162 icon_online_pm,
|
|
163 icon_online_bm );
|
|
164
|
|
165 gtk_label_set( GTK_LABEL(status_label), _MSG_ONLINE_ );
|
|
166 break;
|
|
167
|
|
168 case unread_message_pending:
|
|
169 gtk_pixmap_set( GTK_PIXMAP(icon),
|
|
170 icon_msg_pending_pm,
|
|
171 icon_msg_pending_bm );
|
|
172 gtk_label_set( GTK_LABEL(status_label), "msg" );
|
|
173 break;
|
|
174 case away:
|
|
175 gtk_pixmap_set( GTK_PIXMAP(icon),
|
|
176 icon_away_pm,
|
|
177 icon_away_bm );
|
|
178 gtk_label_set( GTK_LABEL(status_label), "Away" );
|
|
179 break;
|
|
180 }
|
|
181 old_user_status = MRI_user_status;
|
|
182 }
|
|
183 #ifdef _USE_BUDDY_COUNT_
|
|
184 if( (( old_total_num_of_buddies != total_num_of_buddies ) ||
|
|
185 ( old_num_of_buddies_online != num_of_buddies_online )) &&
|
|
186 ( MRI_user_status == online ) ){
|
|
187 /*make user buffer can not overflow*/
|
|
188 if(total_num_of_buddies<1000){
|
|
189 sprintf(temp_string, "%i/%i", num_of_buddies_online, total_num_of_buddies);
|
|
190 } else {
|
|
191 if(num_of_buddies_online<100000){
|
|
192 sprintf(temp_string, "%i", num_of_buddies_online);
|
|
193 } else {
|
|
194 /*we most likely will never get to here but
|
|
195 hey, people also thought computer wouldn't
|
|
196 be around by the year 2000 :-) */
|
|
197 sprintf(temp_string, _MSG_ONLINE_ );
|
|
198 }
|
|
199 }
|
|
200 gtk_label_set( GTK_LABEL(status_label), temp_string );
|
|
201 old_total_num_of_buddies = total_num_of_buddies;
|
|
202 old_num_of_buddies_online = num_of_buddies_online;
|
|
203 }
|
|
204 #endif /*_USE_BUDDY_COUNT_*/
|
|
205 return TRUE;
|
|
206
|
|
207 }
|
|
208
|
|
209
|
|
210 /***************************************************************
|
|
211 **
|
|
212 ** function make_buddy
|
|
213 ** visibility - private
|
|
214 **
|
|
215 ** description - If buddylist is not created create it
|
|
216 ** else show the buddy list
|
|
217 **
|
|
218 ****************************************************************/
|
|
219 void make_buddy(void) {
|
|
220 set_applet_draw_open();
|
|
221 if( !buddy_created ){
|
|
222 show_buddy_list();
|
|
223 buddy_created = TRUE;
|
|
224 } else {
|
|
225 gnome_buddy_show();
|
|
226 }
|
16
|
227 build_edit_tree();
|
1
|
228 applet_widget_unregister_callback(APPLET_WIDGET(applet),"buddy");
|
|
229
|
|
230 }
|
|
231
|
|
232 /***************************************************************
|
|
233 **
|
|
234 ** function applet_show_login
|
|
235 ** visibility - private
|
|
236 **
|
|
237 ** input:
|
|
238 **
|
|
239 **
|
|
240 ** description - I guess it shows the login dialog
|
|
241 **
|
|
242 ****************************************************************/
|
|
243
|
|
244 void applet_show_login(AppletWidget *widget, gpointer data) {
|
|
245 show_login();
|
|
246 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon");
|
|
247 applet_widget_register_callback(APPLET_WIDGET(applet),
|
|
248 "signoff",
|
|
249 _("Signoff"),
|
|
250 signoff,
|
|
251 NULL);
|
|
252 applet_widget_register_callback(APPLET_WIDGET(applet),
|
|
253 "away",
|
|
254 _("Away Message"),
|
|
255 show_away_mess,
|
|
256 NULL);
|
|
257 applet_widget_register_callback(APPLET_WIDGET(applet),
|
|
258 "buddy",
|
|
259 _("Buddy List"),
|
|
260 (AppletCallbackFunc)make_buddy,
|
|
261 NULL);
|
|
262 }
|
|
263
|
|
264 /***************************************************************
|
|
265 **
|
|
266 ** function applet_show_about
|
|
267 ** visibility - public
|
|
268 **
|
|
269 **
|
|
270 ** description - takes care of creating and
|
|
271 ** displaying the about box
|
|
272 **
|
|
273 ****************************************************************/
|
|
274 void applet_show_about(AppletWidget *widget, gpointer data) {
|
|
275
|
|
276 const gchar *authors[] = {"Mark Spencer <markster@marko.net>",
|
|
277 "Jim Duchek <jimduchek@ou.edu>",
|
|
278 "Rob Flynn <rflynn@blueridge.net>",
|
|
279
|
|
280 NULL};
|
|
281
|
|
282 GtkWidget *about=gnome_about_new(_("GAIM"),
|
|
283 _(VERSION),
|
|
284 _(""),
|
|
285 authors,
|
|
286 "",
|
|
287 NULL);
|
|
288 gtk_widget_show(about);
|
|
289 }
|
|
290
|
|
291 /***************************************************************
|
|
292 **
|
|
293 ** function AppletCancelLogin (name should be changed to
|
|
294 ** applet_cancel_login)
|
|
295 ** visibility - public
|
|
296 **
|
|
297 ** description - called when user cancels login
|
|
298 **
|
|
299 ****************************************************************/
|
|
300 void AppletCancelLogon(){
|
|
301 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff");
|
|
302 applet_widget_register_callback(APPLET_WIDGET(applet),
|
|
303 "signon",
|
|
304 _("Signon"),
|
|
305 applet_show_login,
|
|
306 NULL);
|
|
307 }
|
|
308
|
|
309 /***************************************************************
|
|
310 **
|
|
311 ** function get_applet_pos
|
|
312 ** visibility - private
|
|
313 **
|
|
314 ** output:
|
|
315 ** GtKAllocation - a Gtk struct that holds the
|
|
316 ** position of the dialog
|
|
317 **
|
|
318 ** description - returns the x,y position the buddy list should
|
|
319 ** should be placed based on the position
|
|
320 ** of the applet and the orientation
|
|
321 ** of the Gnome panel.
|
|
322 **
|
|
323 ****************************************************************/
|
|
324 GtkAllocation get_applet_pos(){
|
|
325 GtkAllocation pos;
|
|
326 gint x,y,pad;
|
|
327 GtkRequisition buddy_req, applet_req;
|
|
328 GtkAllocation result;
|
|
329 GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) );
|
|
330 pad = 5;
|
|
331 gdk_window_get_position( gtk_widget_get_parent_window( button ),&x,&y );
|
|
332 buddy_req = gnome_buddy_get_dimentions();
|
|
333 applet_req = button->requisition;
|
|
334 switch( orient ){
|
|
335 case ORIENT_UP:
|
|
336 result.x=x;
|
|
337 result.y=y-(buddy_req.height+pad);
|
|
338 break;
|
|
339 case ORIENT_DOWN:
|
|
340 result.x=x;
|
|
341 result.y=y+applet_req.height+pad;
|
|
342
|
|
343 break;
|
|
344 case ORIENT_LEFT:
|
|
345 result.x=x-(buddy_req.width + pad );
|
|
346 result.y=y;
|
|
347 break;
|
|
348 case ORIENT_RIGHT:
|
|
349 result.x=x+applet_req.width+pad;
|
|
350 result.y=y;
|
|
351 break;
|
|
352 }
|
|
353
|
|
354
|
|
355 return result;
|
|
356 }
|
|
357
|
|
358
|
|
359
|
|
360 void createOfflinePopup(){
|
|
361 applet_show_login( APPLET_WIDGET(applet), NULL );
|
|
362 }
|
|
363
|
|
364
|
|
365 void createSignonPopup(){
|
|
366 applet_draw_open = FALSE;
|
|
367 }
|
|
368
|
|
369
|
|
370 void createOnlinePopup(){
|
|
371 GtkAllocation al;
|
|
372 make_buddy();
|
|
373 al = get_applet_pos();
|
|
374 gnome_buddy_set_pos( al.x, al.y );
|
|
375 }
|
|
376
|
|
377
|
|
378 void createPendingPopup(){
|
|
379 applet_draw_open = FALSE;
|
|
380 }
|
|
381
|
|
382
|
|
383 void createAwayPopup(){
|
|
384 applet_draw_open = FALSE;
|
|
385 }
|
|
386
|
|
387
|
|
388 void closeOfflinePopup(){
|
|
389 cancel_logon();
|
|
390 set_applet_draw_closed();
|
|
391 }
|
|
392
|
|
393
|
|
394 void closeSignonPopup(){
|
|
395
|
|
396 }
|
|
397
|
|
398
|
|
399 void closeOnlinePopup(){
|
|
400 set_applet_draw_closed();
|
|
401 applet_destroy_buddy();
|
|
402 }
|
|
403
|
|
404
|
|
405 void closePendingPopup(){
|
|
406 applet_draw_open = FALSE;
|
|
407 }
|
|
408
|
|
409
|
|
410 void closeAwayPopup(){
|
|
411 applet_draw_open = FALSE;
|
|
412 }
|
|
413
|
|
414 /**************************************************
|
|
415 **
|
|
416 ** Dummy function to fix compiles for gnome
|
|
417 ** Feel free to implement an away message
|
|
418 **
|
|
419 ***************************************************/
|
|
420 void show_away_mess( AppletWidget *widget, gpointer data ) {
|
|
421 }
|
|
422
|
|
423 void AppletClicked( GtkWidget *sender, gpointer data ){
|
|
424
|
|
425 if( applet_draw_open ){
|
|
426 switch( MRI_user_status ){
|
|
427 case offline:
|
|
428 closeOfflinePopup();
|
|
429 break;
|
|
430 case signing_on:
|
|
431 closeSignonPopup();
|
|
432 break;
|
|
433 case online:
|
|
434 closeOnlinePopup();
|
|
435
|
|
436 break;
|
|
437 case unread_message_pending:
|
|
438 closePendingPopup();
|
|
439 break;
|
|
440 case away:
|
|
441 closeAwayPopup();
|
|
442 break;
|
|
443 }
|
|
444 } else {
|
|
445 set_applet_draw_open();
|
|
446 switch( MRI_user_status ){
|
|
447 case offline:
|
|
448 createOfflinePopup();
|
|
449 break;
|
|
450 case signing_on:
|
|
451 createSignonPopup();
|
|
452 break;
|
|
453 case online:
|
|
454 createOnlinePopup();
|
|
455 break;
|
|
456 case unread_message_pending:
|
|
457 createPendingPopup();
|
|
458 break;
|
|
459 case away:
|
|
460 createAwayPopup();
|
|
461 break;
|
|
462 }
|
|
463
|
|
464
|
|
465 }
|
|
466 }
|
|
467
|
|
468
|
|
469 #ifdef HAVE_PANEL_SIZE
|
|
470 /***************************************************************
|
|
471 **
|
|
472 ** Code for panel resizing
|
|
473 **
|
|
474 ****************************************************************/
|
|
475 static void applet_change_size(GtkWidget *w, PanelSizeType o, gpointer data) {
|
|
476 switch(o) {
|
|
477 case SIZE_TINY:
|
|
478 /*24x24*/
|
|
479 gtk_widget_set_usize( button, 24,24 );
|
|
480
|
|
481 /*load offline icon*/
|
|
482 load_applet_icon( GAIM_GNOME_OFFLINE_ICON,
|
|
483 24, 24, &icon_offline_pm, &icon_offline_bm );
|
|
484
|
|
485 /*load connecting icon*/
|
|
486 load_applet_icon( GAIM_GNOME_CONNECT_ICON,
|
|
487 24, 24, &icon_connect_pm, &icon_connect_bm );
|
|
488
|
|
489 /*load online icon*/
|
|
490 load_applet_icon( GAIM_GNOME_ONLINE_ICON,
|
|
491 24, 24, &icon_online_pm, &icon_online_bm );
|
|
492 break;
|
|
493
|
|
494 case SIZE_STANDARD:
|
|
495 /*48x48*/
|
|
496 gtk_widget_set_usize( button, 48,48 );
|
|
497
|
|
498 /*load offline icon*/
|
|
499 load_applet_icon( GAIM_GNOME_OFFLINE_ICON,
|
|
500 32, 34, &icon_offline_pm, &icon_offline_bm );
|
|
501
|
|
502 /*load connecting icon*/
|
|
503 load_applet_icon( GAIM_GNOME_CONNECT_ICON,
|
|
504 32, 34, &icon_connect_pm, &icon_connect_bm );
|
|
505
|
|
506 /*load online icon*/
|
|
507 load_applet_icon( GAIM_GNOME_ONLINE_ICON,
|
|
508 32, 34, &icon_online_pm, &icon_online_bm );
|
|
509 break;
|
|
510
|
|
511 case SIZE_LARGE:
|
|
512 /*64x64*/
|
|
513 gtk_widget_set_usize( button, 64, 64 );
|
|
514
|
|
515 /*load offline icon*/
|
|
516 load_applet_icon( GAIM_GNOME_OFFLINE_ICON,
|
|
517 55, 55, &icon_offline_pm, &icon_offline_bm );
|
|
518
|
|
519 /*load connecting icon*/
|
|
520 load_applet_icon( GAIM_GNOME_CONNECT_ICON,
|
|
521 55, 55, &icon_connect_pm, &icon_connect_bm );
|
|
522
|
|
523 /*load online icon*/
|
|
524 load_applet_icon( GAIM_GNOME_ONLINE_ICON,
|
|
525 55, 55, &icon_online_pm, &icon_online_bm );
|
|
526 break;
|
|
527
|
|
528 case SIZE_HUGE:
|
|
529 /*80x80*/
|
|
530 gtk_widget_set_usize( button, 80, 80 );
|
|
531
|
|
532 /*load offline icon*/
|
|
533 load_applet_icon( GAIM_GNOME_OFFLINE_ICON,
|
|
534 70, 70, &icon_offline_pm, &icon_offline_bm );
|
|
535
|
|
536 /*load connecting icon*/
|
|
537 load_applet_icon( GAIM_GNOME_CONNECT_ICON,
|
|
538 70, 70, &icon_connect_pm, &icon_connect_bm );
|
|
539
|
|
540 /*load online icon*/
|
|
541 load_applet_icon( GAIM_GNOME_ONLINE_ICON,
|
|
542 70, 70, &icon_online_pm, &icon_online_bm );
|
|
543
|
|
544 break;
|
|
545 }
|
|
546 }
|
|
547 #endif /*HAVE_PANEL_SIZE*/
|
|
548
|
|
549
|
|
550 /***************************************************************
|
|
551 **
|
|
552 ** Initialize GNOME stuff
|
|
553 **
|
|
554 ****************************************************************/
|
|
555
|
|
556 gint InitAppletMgr( int argc, char *argv[] ){
|
|
557 GtkWidget *vbox;
|
|
558
|
|
559 GtkStyle *label_style;
|
|
560 GdkFont *label_font = NULL;
|
|
561
|
|
562 applet_widget_init("GAIM",VERSION,argc,argv,NULL,0,NULL);
|
|
563
|
|
564 /*init imlib for graphics*/
|
|
565 gdk_imlib_init();
|
|
566 gtk_widget_push_visual(gdk_imlib_get_visual());
|
|
567 gtk_widget_push_colormap(gdk_imlib_get_colormap());
|
|
568
|
|
569 applet=applet_widget_new("gaim_applet");
|
|
570 if(!applet) g_error(_("Can't create GAIM applet!"));
|
|
571
|
|
572 button=gtk_button_new();
|
|
573
|
|
574
|
|
575 gtk_widget_set_usize( button, 48,48 );
|
|
576
|
|
577
|
|
578 /*load offline icon*/
|
|
579 load_applet_icon( GAIM_GNOME_OFFLINE_ICON,
|
|
580 32, 32, &icon_offline_pm, &icon_offline_bm );
|
|
581
|
|
582 /*load connecting icon*/
|
|
583 load_applet_icon( GAIM_GNOME_CONNECT_ICON,
|
|
584 32, 32, &icon_connect_pm, &icon_connect_bm );
|
|
585
|
|
586 /*load online icon*/
|
|
587 load_applet_icon( GAIM_GNOME_ONLINE_ICON,
|
|
588 32, 32, &icon_online_pm, &icon_online_bm );
|
|
589
|
|
590 /*icon_away and icon_msg_pennding need to be implemented*/
|
|
591
|
|
592 icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm);
|
|
593
|
|
594 gtk_timeout_add( 1500, (GtkFunction)update_applet, NULL );
|
|
595
|
|
596 vbox = gtk_vbox_new(FALSE,0);
|
|
597
|
|
598 gtk_box_pack_start(GTK_BOX(vbox), icon, FALSE, TRUE, 0);
|
|
599
|
|
600 status_label = gtk_label_new("Offline");
|
|
601 /*set this label's font*/
|
|
602 label_style = gtk_widget_get_style( status_label );
|
|
603
|
|
604 label_font = gdk_font_load( _MSG_FONT_ );
|
|
605
|
|
606
|
|
607 if( label_font != NULL ){
|
|
608 label_style->font = label_font;
|
|
609 gtk_widget_set_style( status_label, label_style );
|
|
610 } else {
|
|
611 sprintf(debug_buff, "Font does not exist" );
|
|
612 debug_print(debug_buff);
|
|
613 }
|
|
614
|
|
615 #ifdef HAVE_PANEL_SIZE
|
|
616 gtk_signal_connect(GTK_OBJECT(applet),"change_size",
|
|
617 GTK_SIGNAL_FUNC(applet_change_size),
|
|
618 NULL);
|
|
619 #endif /*HAVE_PANEL_SIZE*/
|
|
620
|
|
621 gtk_box_pack_start(GTK_BOX(vbox), status_label, FALSE, TRUE, 0);
|
|
622
|
|
623 gtk_container_add( GTK_CONTAINER(button), vbox );
|
|
624 applet_widget_add(APPLET_WIDGET(applet), button);
|
|
625
|
|
626 gtk_widget_show( status_label );
|
|
627 gtk_widget_show( vbox );
|
|
628 gtk_widget_show( button );
|
|
629
|
|
630 applet_widget_set_tooltip(APPLET_WIDGET(applet),"GAIM");
|
|
631
|
|
632 applet_widget_register_stock_callback(APPLET_WIDGET(applet),
|
|
633 "about",
|
|
634 GNOME_STOCK_MENU_ABOUT,
|
|
635 _("About..."),
|
|
636 applet_show_about,
|
|
637 NULL);
|
|
638
|
|
639 gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( AppletClicked), NULL);
|
|
640
|
|
641 gtk_widget_show(icon);
|
|
642 gtk_widget_show(applet);
|
|
643 return 0;
|
|
644 }
|
|
645
|
|
646 void setUserState( enum gaim_user_states state ){
|
|
647 MRI_user_status = state;
|
|
648 update_applet( (gpointer *)applet );
|
|
649 }
|
|
650
|
|
651 void setTotalBuddies( gint num ){
|
|
652 total_num_of_buddies = num;
|
|
653 }
|
|
654
|
|
655 void setNumBuddiesOnline( gint num ){
|
|
656 num_of_buddies_online=num;
|
|
657 }
|
|
658
|
|
659 enum gaim_user_states getUserState(){
|
|
660 return MRI_user_status;
|
|
661 }
|
|
662
|
|
663 gint getTotalBuddies(){
|
|
664 return total_num_of_buddies;
|
|
665 }
|
|
666
|
|
667 gint getNumBuddiesOnline(){
|
|
668 return num_of_buddies_online;
|
|
669 }
|
|
670
|
|
671 void set_applet_draw_open(){
|
|
672 applet_draw_open = TRUE;
|
|
673 }
|
|
674
|
|
675 void set_applet_draw_closed(){
|
|
676 applet_draw_open = FALSE;
|
|
677 }
|
|
678
|
|
679 #endif /*USE_APPLET*/
|