Mercurial > pidgin.yaz
annotate src/gnome_applet_mgr.c @ 338:9d258a0aa560
[gaim-migrate @ 348]
Whoa, all kinds of things happened here. The applet looks better. The
preferences dialog changes based on your compile-time options (oscar,
gnome). Whispering works again. libfaim got updated; it can almost do
RVOUS stuff, and hopefully soon can make requests too. The applet doesn't
need to have its sounds go through GNOME, although it still can. There
is code to facilitate SOCKS5 support (all that needs to be done is to
actually write the code to communicate with the proxy server).
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 06 Jun 2000 09:55:30 +0000 |
parents | 2c5713cd9d8c |
children | 0d9cfc3579a5 |
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; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
47 GtkWidget *appletframe; |
1 | 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 |
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) { | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
232 /* FIXME : this is so pointless */ |
1 | 233 show_login(); |
234 } | |
235 | |
18 | 236 void insert_applet_away() { |
237 GList *awy = away_messages; | |
238 struct away_message *a; | |
239 char *awayname; | |
240 | |
241 applet_widget_register_callback_dir(APPLET_WIDGET(applet), | |
46 | 242 "away/", |
18 | 243 _("Away")); |
244 applet_widget_register_callback(APPLET_WIDGET(applet), | |
245 "away/new", | |
246 _("New Away Message"), | |
247 (AppletCallbackFunc)create_away_mess, | |
248 NULL); | |
249 | |
250 while(awy) { | |
251 a = (struct away_message *)awy->data; | |
252 | |
79 | 253 awayname = g_malloc(sizeof *awayname * (6 + strlen(a->name))); |
18 | 254 awayname[0] = '\0'; |
255 strcat(awayname, "away/"); | |
256 strcat(awayname, a->name); | |
257 applet_widget_register_callback(APPLET_WIDGET(applet), | |
258 awayname, | |
259 a->name, | |
260 (AppletCallbackFunc)do_away_message, | |
261 a); | |
262 | |
263 awy = awy->next; | |
23 | 264 free(awayname); |
18 | 265 } |
266 } | |
267 | |
268 void remove_applet_away() { | |
269 GList *awy = away_messages; | |
270 struct away_message *a; | |
271 char *awayname; | |
272 | |
273 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away/new"); | |
274 | |
275 while (awy) { | |
276 a = (struct away_message *)awy->data; | |
277 | |
79 | 278 awayname = g_malloc(sizeof *awayname * (6 + strlen(a->name))); |
18 | 279 awayname[0] = '\0'; |
280 strcat(awayname, "away/"); | |
281 strcat(awayname, a->name); | |
282 applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname); | |
283 | |
284 awy = awy->next; | |
23 | 285 free(awayname); |
18 | 286 } |
46 | 287 applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away/"); |
18 | 288 applet_widget_unregister_callback(APPLET_WIDGET(applet), "away"); |
289 } | |
290 | |
1 | 291 /*************************************************************** |
292 ** | |
293 ** function applet_show_about | |
294 ** visibility - public | |
295 ** | |
296 ** | |
297 ** description - takes care of creating and | |
298 ** displaying the about box | |
299 ** | |
300 ****************************************************************/ | |
301 void applet_show_about(AppletWidget *widget, gpointer data) { | |
302 | |
303 const gchar *authors[] = {"Mark Spencer <markster@marko.net>", | |
304 "Jim Duchek <jimduchek@ou.edu>", | |
305 "Rob Flynn <rflynn@blueridge.net>", | |
82 | 306 "Eric Warmenhoven <warmenhoven@yahoo.com>", |
178
5d62a5d50c89
[gaim-migrate @ 188]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
307 "Syd Logan", |
1 | 308 NULL}; |
309 | |
310 GtkWidget *about=gnome_about_new(_("GAIM"), | |
311 _(VERSION), | |
312 _(""), | |
313 authors, | |
314 "", | |
315 NULL); | |
316 gtk_widget_show(about); | |
317 } | |
318 | |
319 /*************************************************************** | |
320 ** | |
321 ** function AppletCancelLogin (name should be changed to | |
322 ** applet_cancel_login) | |
323 ** visibility - public | |
324 ** | |
325 ** description - called when user cancels login | |
326 ** | |
327 ****************************************************************/ | |
328 void AppletCancelLogon(){ | |
329 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff"); | |
330 applet_widget_register_callback(APPLET_WIDGET(applet), | |
331 "signon", | |
332 _("Signon"), | |
333 applet_show_login, | |
334 NULL); | |
335 } | |
336 | |
337 /*************************************************************** | |
338 ** | |
339 ** function get_applet_pos | |
340 ** visibility - private | |
341 ** | |
342 ** output: | |
343 ** GtKAllocation - a Gtk struct that holds the | |
344 ** position of the dialog | |
345 ** | |
346 ** description - returns the x,y position the buddy list should | |
347 ** should be placed based on the position | |
348 ** of the applet and the orientation | |
349 ** of the Gnome panel. | |
350 ** | |
351 ****************************************************************/ | |
352 GtkAllocation get_applet_pos(){ | |
353 gint x,y,pad; | |
354 GtkRequisition buddy_req, applet_req; | |
355 GtkAllocation result; | |
356 GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) ); | |
357 pad = 5; | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
358 gdk_window_get_position(gtk_widget_get_parent_window(appletframe), &x, &y); |
1 | 359 buddy_req = gnome_buddy_get_dimentions(); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
360 applet_req = appletframe->requisition; |
1 | 361 switch( orient ){ |
362 case ORIENT_UP: | |
363 result.x=x; | |
364 result.y=y-(buddy_req.height+pad); | |
365 break; | |
366 case ORIENT_DOWN: | |
367 result.x=x; | |
368 result.y=y+applet_req.height+pad; | |
369 | |
370 break; | |
371 case ORIENT_LEFT: | |
372 result.x=x-(buddy_req.width + pad ); | |
373 result.y=y; | |
374 break; | |
375 case ORIENT_RIGHT: | |
376 result.x=x+applet_req.width+pad; | |
377 result.y=y; | |
378 break; | |
379 } | |
380 | |
381 | |
382 return result; | |
383 } | |
384 | |
385 | |
386 | |
387 void createOfflinePopup(){ | |
388 applet_show_login( APPLET_WIDGET(applet), NULL ); | |
389 } | |
390 | |
391 | |
392 void createSignonPopup(){ | |
393 applet_draw_open = FALSE; | |
394 } | |
395 | |
396 | |
397 void createOnlinePopup(){ | |
398 GtkAllocation al; | |
399 make_buddy(); | |
400 al = get_applet_pos(); | |
401 gnome_buddy_set_pos( al.x, al.y ); | |
402 } | |
403 | |
404 | |
405 void createPendingPopup(){ | |
406 applet_draw_open = FALSE; | |
407 } | |
408 | |
409 | |
410 void createAwayPopup(){ | |
83 | 411 createOnlinePopup(); |
1 | 412 } |
413 | |
414 | |
415 void closeOfflinePopup(){ | |
416 cancel_logon(); | |
417 set_applet_draw_closed(); | |
418 } | |
419 | |
420 | |
421 void closeSignonPopup(){ | |
422 | |
423 } | |
424 | |
425 | |
426 void closeOnlinePopup(){ | |
427 set_applet_draw_closed(); | |
428 applet_destroy_buddy(); | |
429 } | |
430 | |
431 | |
432 void closePendingPopup(){ | |
433 applet_draw_open = FALSE; | |
434 } | |
435 | |
436 | |
437 void closeAwayPopup(){ | |
83 | 438 closeOnlinePopup(); |
1 | 439 } |
440 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
441 void AppletClicked( GtkWidget *sender, GdkEventButton *ev, gpointer data ){ |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
442 if (!ev || ev->button != 1 || ev->type != GDK_BUTTON_PRESS) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
443 return; |
1 | 444 |
445 if( applet_draw_open ){ | |
446 switch( MRI_user_status ){ | |
447 case offline: | |
448 closeOfflinePopup(); | |
449 break; | |
450 case signing_on: | |
451 closeSignonPopup(); | |
452 break; | |
453 case online: | |
454 closeOnlinePopup(); | |
455 | |
456 break; | |
457 case unread_message_pending: | |
458 closePendingPopup(); | |
459 break; | |
460 case away: | |
461 closeAwayPopup(); | |
462 break; | |
463 } | |
464 } else { | |
465 set_applet_draw_open(); | |
466 switch( MRI_user_status ){ | |
467 case offline: | |
468 createOfflinePopup(); | |
469 break; | |
470 case signing_on: | |
471 createSignonPopup(); | |
472 break; | |
473 case online: | |
474 createOnlinePopup(); | |
475 break; | |
476 case unread_message_pending: | |
477 createPendingPopup(); | |
478 break; | |
479 case away: | |
480 createAwayPopup(); | |
481 break; | |
482 } | |
483 | |
484 | |
485 } | |
486 } | |
487 | |
488 | |
489 /*************************************************************** | |
490 ** | |
491 ** Initialize GNOME stuff | |
492 ** | |
493 ****************************************************************/ | |
494 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
495 gint init_applet_mgr(int argc, char *argv[]) { |
1 | 496 GtkWidget *vbox; |
497 | |
498 GtkStyle *label_style; | |
499 GdkFont *label_font = NULL; | |
500 | |
501 applet_widget_init("GAIM",VERSION,argc,argv,NULL,0,NULL); | |
502 | |
503 /*init imlib for graphics*/ | |
504 gdk_imlib_init(); | |
505 gtk_widget_push_visual(gdk_imlib_get_visual()); | |
506 gtk_widget_push_colormap(gdk_imlib_get_colormap()); | |
507 | |
508 applet=applet_widget_new("gaim_applet"); | |
509 if(!applet) g_error(_("Can't create GAIM applet!")); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
510 gtk_widget_set_events(applet, gtk_widget_get_events(applet) | |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
511 GDK_BUTTON_PRESS_MASK); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
512 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
513 appletframe = gtk_frame_new(NULL); |
1 | 514 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
515 gtk_widget_set_usize(appletframe, 48, 48); |
1 | 516 |
517 | |
518 /*load offline icon*/ | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
519 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, 32, 32, |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
520 &icon_offline_pm, &icon_offline_bm ); |
1 | 521 |
522 /*load connecting icon*/ | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
523 load_applet_icon( GAIM_GNOME_CONNECT_ICON, 32, 32, |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
524 &icon_connect_pm, &icon_connect_bm ); |
1 | 525 |
526 /*load online icon*/ | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
527 load_applet_icon( GAIM_GNOME_ONLINE_ICON, 32, 32, |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
528 &icon_online_pm, &icon_online_bm ); |
1 | 529 |
530 /*icon_away and icon_msg_pennding need to be implemented*/ | |
531 | |
532 icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm); | |
533 | |
534 gtk_timeout_add( 1500, (GtkFunction)update_applet, NULL ); | |
535 | |
536 vbox = gtk_vbox_new(FALSE,0); | |
537 | |
538 gtk_box_pack_start(GTK_BOX(vbox), icon, FALSE, TRUE, 0); | |
539 | |
540 status_label = gtk_label_new("Offline"); | |
541 /*set this label's font*/ | |
542 label_style = gtk_widget_get_style( status_label ); | |
543 | |
544 label_font = gdk_font_load( _MSG_FONT_ ); | |
545 | |
546 | |
547 if( label_font != NULL ){ | |
548 label_style->font = label_font; | |
549 gtk_widget_set_style( status_label, label_style ); | |
550 } else { | |
551 sprintf(debug_buff, "Font does not exist" ); | |
552 debug_print(debug_buff); | |
553 } | |
554 | |
555 gtk_box_pack_start(GTK_BOX(vbox), status_label, FALSE, TRUE, 0); | |
556 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
557 gtk_container_add( GTK_CONTAINER(appletframe), vbox ); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
558 applet_widget_add(APPLET_WIDGET(applet), appletframe); |
1 | 559 |
560 gtk_widget_show( status_label ); | |
561 gtk_widget_show( vbox ); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
562 gtk_widget_show( appletframe ); |
1 | 563 |
564 applet_widget_set_tooltip(APPLET_WIDGET(applet),"GAIM"); | |
565 | |
566 applet_widget_register_stock_callback(APPLET_WIDGET(applet), | |
567 "about", | |
568 GNOME_STOCK_MENU_ABOUT, | |
569 _("About..."), | |
570 applet_show_about, | |
571 NULL); | |
572 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
246
diff
changeset
|
573 gtk_signal_connect( GTK_OBJECT(applet), "button_press_event", GTK_SIGNAL_FUNC( AppletClicked), NULL); |
1 | 574 |
575 gtk_widget_show(icon); | |
576 gtk_widget_show(applet); | |
577 return 0; | |
578 } | |
579 | |
580 void setUserState( enum gaim_user_states state ){ | |
581 MRI_user_status = state; | |
82 | 582 update_applet(NULL); |
1 | 583 } |
584 | |
585 enum gaim_user_states getUserState(){ | |
586 return MRI_user_status; | |
587 } | |
588 | |
589 void set_applet_draw_open(){ | |
590 applet_draw_open = TRUE; | |
591 } | |
592 | |
593 void set_applet_draw_closed(){ | |
594 applet_draw_open = FALSE; | |
595 } | |
596 | |
597 #endif /*USE_APPLET*/ |