comparison 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
comparison
equal deleted inserted replaced
337:f5b199e20d12 338:9d258a0aa560
42 gchar GAIM_GNOME_OFFLINE_ICON[255] = GAIM_GNOME_PENGUIN_OFFLINE; 42 gchar GAIM_GNOME_OFFLINE_ICON[255] = GAIM_GNOME_PENGUIN_OFFLINE;
43 gchar GAIM_GNOME_CONNECT_ICON[255] = GAIM_GNOME_PENGUIN_CONNECT; 43 gchar GAIM_GNOME_CONNECT_ICON[255] = GAIM_GNOME_PENGUIN_CONNECT;
44 gchar GAIM_GNOME_ONLINE_ICON[255] = GAIM_GNOME_PENGUIN_ONLINE; 44 gchar GAIM_GNOME_ONLINE_ICON[255] = GAIM_GNOME_PENGUIN_ONLINE;
45 45
46 GtkWidget *applet; 46 GtkWidget *applet;
47 GtkWidget *button; 47 GtkWidget *appletframe;
48 GtkWidget *status_label; 48 GtkWidget *status_label;
49 49
50 GtkWidget *icon; 50 GtkWidget *icon;
51 GdkPixmap *icon_offline_pm=NULL; 51 GdkPixmap *icon_offline_pm=NULL;
52 GdkPixmap *icon_offline_bm=NULL; 52 GdkPixmap *icon_offline_bm=NULL;
211 } else { 211 } else {
212 gnome_buddy_show(); 212 gnome_buddy_show();
213 } 213 }
214 build_edit_tree(); 214 build_edit_tree();
215 build_permit_tree(); 215 build_permit_tree();
216 applet_widget_unregister_callback(APPLET_WIDGET(applet),"buddy");
217 216
218 } 217 }
219 218
220 /*************************************************************** 219 /***************************************************************
221 ** 220 **
228 ** description - I guess it shows the login dialog 227 ** description - I guess it shows the login dialog
229 ** 228 **
230 ****************************************************************/ 229 ****************************************************************/
231 230
232 void applet_show_login(AppletWidget *widget, gpointer data) { 231 void applet_show_login(AppletWidget *widget, gpointer data) {
232 /* FIXME : this is so pointless */
233 show_login(); 233 show_login();
234 /*
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);
241 insert_applet_away();
242 applet_widget_register_callback(APPLET_WIDGET(applet),
243 "buddy",
244 _("Buddy List"),
245 (AppletCallbackFunc)createOnlinePopup,
246 NULL);
247 */
248 } 234 }
249 235
250 void insert_applet_away() { 236 void insert_applet_away() {
251 GList *awy = away_messages; 237 GList *awy = away_messages;
252 struct away_message *a; 238 struct away_message *a;
367 gint x,y,pad; 353 gint x,y,pad;
368 GtkRequisition buddy_req, applet_req; 354 GtkRequisition buddy_req, applet_req;
369 GtkAllocation result; 355 GtkAllocation result;
370 GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) ); 356 GNOME_Panel_OrientType orient = applet_widget_get_panel_orient( APPLET_WIDGET(applet) );
371 pad = 5; 357 pad = 5;
372 gdk_window_get_position( gtk_widget_get_parent_window( button ),&x,&y ); 358 gdk_window_get_position(gtk_widget_get_parent_window(appletframe), &x, &y);
373 buddy_req = gnome_buddy_get_dimentions(); 359 buddy_req = gnome_buddy_get_dimentions();
374 applet_req = button->requisition; 360 applet_req = appletframe->requisition;
375 switch( orient ){ 361 switch( orient ){
376 case ORIENT_UP: 362 case ORIENT_UP:
377 result.x=x; 363 result.x=x;
378 result.y=y-(buddy_req.height+pad); 364 result.y=y-(buddy_req.height+pad);
379 break; 365 break;
450 436
451 void closeAwayPopup(){ 437 void closeAwayPopup(){
452 closeOnlinePopup(); 438 closeOnlinePopup();
453 } 439 }
454 440
455 void AppletClicked( GtkWidget *sender, gpointer data ){ 441 void AppletClicked( GtkWidget *sender, GdkEventButton *ev, gpointer data ){
442 if (!ev || ev->button != 1 || ev->type != GDK_BUTTON_PRESS)
443 return;
456 444
457 if( applet_draw_open ){ 445 if( applet_draw_open ){
458 switch( MRI_user_status ){ 446 switch( MRI_user_status ){
459 case offline: 447 case offline:
460 closeOfflinePopup(); 448 closeOfflinePopup();
496 484
497 } 485 }
498 } 486 }
499 487
500 488
501 #ifdef HAVE_PANEL_SIZE 489 /***************************************************************
502 /*************************************************************** 490 **
503 ** 491 ** Initialize GNOME stuff
504 ** Code for panel resizing
505 ** 492 **
506 ****************************************************************/ 493 ****************************************************************/
507 static void applet_change_size(GtkWidget *w, PanelSizeType o, gpointer data) { 494
508 switch(o) { 495 gint init_applet_mgr(int argc, char *argv[]) {
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; 496 GtkWidget *vbox;
590 497
591 GtkStyle *label_style; 498 GtkStyle *label_style;
592 GdkFont *label_font = NULL; 499 GdkFont *label_font = NULL;
593 500
598 gtk_widget_push_visual(gdk_imlib_get_visual()); 505 gtk_widget_push_visual(gdk_imlib_get_visual());
599 gtk_widget_push_colormap(gdk_imlib_get_colormap()); 506 gtk_widget_push_colormap(gdk_imlib_get_colormap());
600 507
601 applet=applet_widget_new("gaim_applet"); 508 applet=applet_widget_new("gaim_applet");
602 if(!applet) g_error(_("Can't create GAIM applet!")); 509 if(!applet) g_error(_("Can't create GAIM applet!"));
510 gtk_widget_set_events(applet, gtk_widget_get_events(applet) |
511 GDK_BUTTON_PRESS_MASK);
512
513 appletframe = gtk_frame_new(NULL);
603 514
604 button=gtk_button_new(); 515 gtk_widget_set_usize(appletframe, 48, 48);
605 516
606
607 gtk_widget_set_usize( button, 48,48 );
608
609 517
610 /*load offline icon*/ 518 /*load offline icon*/
611 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, 519 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, 32, 32,
612 32, 32, &icon_offline_pm, &icon_offline_bm ); 520 &icon_offline_pm, &icon_offline_bm );
613 521
614 /*load connecting icon*/ 522 /*load connecting icon*/
615 load_applet_icon( GAIM_GNOME_CONNECT_ICON, 523 load_applet_icon( GAIM_GNOME_CONNECT_ICON, 32, 32,
616 32, 32, &icon_connect_pm, &icon_connect_bm ); 524 &icon_connect_pm, &icon_connect_bm );
617 525
618 /*load online icon*/ 526 /*load online icon*/
619 load_applet_icon( GAIM_GNOME_ONLINE_ICON, 527 load_applet_icon( GAIM_GNOME_ONLINE_ICON, 32, 32,
620 32, 32, &icon_online_pm, &icon_online_bm ); 528 &icon_online_pm, &icon_online_bm );
621 529
622 /*icon_away and icon_msg_pennding need to be implemented*/ 530 /*icon_away and icon_msg_pennding need to be implemented*/
623 531
624 icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm); 532 icon=gtk_pixmap_new(icon_offline_pm,icon_offline_bm);
625 533
642 } else { 550 } else {
643 sprintf(debug_buff, "Font does not exist" ); 551 sprintf(debug_buff, "Font does not exist" );
644 debug_print(debug_buff); 552 debug_print(debug_buff);
645 } 553 }
646 554
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); 555 gtk_box_pack_start(GTK_BOX(vbox), status_label, FALSE, TRUE, 0);
654 556
655 gtk_container_add( GTK_CONTAINER(button), vbox ); 557 gtk_container_add( GTK_CONTAINER(appletframe), vbox );
656 applet_widget_add(APPLET_WIDGET(applet), button); 558 applet_widget_add(APPLET_WIDGET(applet), appletframe);
657 559
658 gtk_widget_show( status_label ); 560 gtk_widget_show( status_label );
659 gtk_widget_show( vbox ); 561 gtk_widget_show( vbox );
660 gtk_widget_show( button ); 562 gtk_widget_show( appletframe );
661 563
662 applet_widget_set_tooltip(APPLET_WIDGET(applet),"GAIM"); 564 applet_widget_set_tooltip(APPLET_WIDGET(applet),"GAIM");
663 565
664 applet_widget_register_stock_callback(APPLET_WIDGET(applet), 566 applet_widget_register_stock_callback(APPLET_WIDGET(applet),
665 "about", 567 "about",
666 GNOME_STOCK_MENU_ABOUT, 568 GNOME_STOCK_MENU_ABOUT,
667 _("About..."), 569 _("About..."),
668 applet_show_about, 570 applet_show_about,
669 NULL); 571 NULL);
670 572
671 gtk_signal_connect( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC( AppletClicked), NULL); 573 gtk_signal_connect( GTK_OBJECT(applet), "button_press_event", GTK_SIGNAL_FUNC( AppletClicked), NULL);
672 574
673 gtk_widget_show(icon); 575 gtk_widget_show(icon);
674 gtk_widget_show(applet); 576 gtk_widget_show(applet);
675 return 0; 577 return 0;
676 } 578 }