comparison src/main.c @ 7168:282887c9e3dc

[gaim-migrate @ 7735] Added support for startup notification for those window managers that support it. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 06 Oct 2003 00:17:45 +0000
parents e09020153d85
children 42ef0c41cefb
comparison
equal deleted inserted replaced
7167:6d3d8f11e765 7168:282887c9e3dc
57 #endif 57 #endif
58 58
59 #include "locale.h" 59 #include "locale.h"
60 #include <getopt.h> 60 #include <getopt.h>
61 61
62 #ifdef HAVE_STARTUP_NOTIFICATION
63 # define SN_API_NOT_YET_FROZEN
64 # include <libsn/sn-launchee.h>
65 # include <gdk/gdkx.h>
66 #endif
67
62 extern void load_prefs(); 68 extern void load_prefs();
63 extern void load_pounces(); 69 extern void load_pounces();
64 70
65 static GtkWidget *name; 71 static GtkWidget *name;
66 static GtkWidget *pass; 72 static GtkWidget *pass;
73
74 #ifdef HAVE_STARTUP_NOTIFICATION
75 static SnLauncheeContext *sn_context = NULL;
76 static SnDisplay *sn_display = NULL;
77 #endif
67 78
68 GtkWidget *mainwindow = NULL; 79 GtkWidget *mainwindow = NULL;
69 80
70 int opt_away = 0; 81 int opt_away = 0;
71 int docklet_count = 0; 82 int docklet_count = 0;
556 case 1: /* short message */ 567 case 1: /* short message */
557 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); 568 printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name);
558 break; 569 break;
559 } 570 }
560 } 571 }
572
573 #ifdef HAVE_STARTUP_NOTIFICATION
574 static void
575 sn_error_trap_push(SnDisplay *display, Display *xdisplay)
576 {
577 gdk_error_trap_push();
578 }
579
580 static void
581 sn_error_trap_pop(SnDisplay *display, Display *xdisplay)
582 {
583 gdk_error_trap_pop();
584 }
585
586 static void
587 startup_notification_complete(void)
588 {
589 Display *xdisplay;
590
591 xdisplay = GDK_DISPLAY();
592 sn_display = sn_display_new(xdisplay,
593 sn_error_trap_push,
594 sn_error_trap_pop);
595 sn_context =
596 sn_launchee_context_new_from_environment(sn_display,
597 DefaultScreen(xdisplay));
598
599 if (sn_context != NULL)
600 {
601 sn_launchee_context_complete(sn_context);
602 sn_launchee_context_unref(sn_context);
603
604 sn_display_unref(sn_display);
605 }
606 }
607 #endif /* HAVE_STARTUP_NOTIFICATION */
561 608
562 /* FUCKING GET ME A TOWEL! */ 609 /* FUCKING GET ME A TOWEL! */
563 #ifdef _WIN32 610 #ifdef _WIN32
564 int gaim_main(HINSTANCE hint, int argc, char *argv[]) 611 int gaim_main(HINSTANCE hint, int argc, char *argv[])
565 #else 612 #else
866 if (opt_acct) { 913 if (opt_acct) {
867 gaim_gtk_accounts_window_show(); 914 gaim_gtk_accounts_window_show();
868 } else if ((dologin_ret == -1) && !gaim_connections_get_all()) 915 } else if ((dologin_ret == -1) && !gaim_connections_get_all())
869 show_login(); 916 show_login();
870 917
918 #ifdef HAVE_STARTUP_NOTIFICATION
919 startup_notification_complete();
920 #endif
921
871 gtk_main(); 922 gtk_main();
872 gaim_sound_shutdown(); 923 gaim_sound_shutdown();
873 #ifdef _WIN32 924 #ifdef _WIN32
874 wgaim_cleanup(); 925 wgaim_cleanup();
875 #endif 926 #endif