pidgin/gtkmain.c

changeset 31506
d282fb1e8315
parent 30844
0d9af8dbf654
child 31590
e96aac3d0c77
child 31881
fb4435d51439
child 32424
be4a642b2d45
equal deleted inserted replaced
31505:6ebbabb2ca84 31506:d282fb1e8315
74 # include <signal.h> 74 # include <signal.h>
75 #endif 75 #endif
76 76
77 #include <getopt.h> 77 #include <getopt.h>
78 78
79 #ifdef HAVE_STARTUP_NOTIFICATION
80 # define SN_API_NOT_YET_FROZEN
81 # include <libsn/sn-launchee.h>
82 # include <gdk/gdkx.h>
83 #endif
84
85
86
87 #ifdef HAVE_STARTUP_NOTIFICATION
88 static SnLauncheeContext *sn_context = NULL;
89 static SnDisplay *sn_display = NULL;
90 #endif
91 79
92 #ifdef HAVE_SIGNAL_H 80 #ifdef HAVE_SIGNAL_H
93 81
94 /* 82 /*
95 * Lists of signals we wish to catch and those we wish to ignore. 83 * Lists of signals we wish to catch and those we wish to ignore.
470 458
471 purple_print_utf8_to_console(stdout, text); 459 purple_print_utf8_to_console(stdout, text);
472 g_free(text); 460 g_free(text);
473 } 461 }
474 462
475 #ifdef HAVE_STARTUP_NOTIFICATION
476 static void
477 sn_error_trap_push(SnDisplay *display, Display *xdisplay)
478 {
479 gdk_error_trap_push();
480 }
481
482 static void
483 sn_error_trap_pop(SnDisplay *display, Display *xdisplay)
484 {
485 gdk_error_trap_pop();
486 }
487
488 static void
489 startup_notification_complete(void)
490 {
491 Display *xdisplay;
492
493 xdisplay = GDK_DISPLAY();
494 sn_display = sn_display_new(xdisplay,
495 sn_error_trap_push,
496 sn_error_trap_pop);
497 sn_context =
498 sn_launchee_context_new_from_environment(sn_display,
499 DefaultScreen(xdisplay));
500
501 if (sn_context != NULL)
502 {
503 sn_launchee_context_complete(sn_context);
504 sn_launchee_context_unref(sn_context);
505
506 sn_display_unref(sn_display);
507 }
508 }
509 #endif /* HAVE_STARTUP_NOTIFICATION */
510
511 /* FUCKING GET ME A TOWEL! */ 463 /* FUCKING GET ME A TOWEL! */
512 #ifdef _WIN32 464 #ifdef _WIN32
513 /* suppress gcc "no previous prototype" warning */ 465 /* suppress gcc "no previous prototype" warning */
514 int pidgin_main(HINSTANCE hint, int argc, char *argv[]); 466 int pidgin_main(HINSTANCE hint, int argc, char *argv[]);
515 int pidgin_main(HINSTANCE hint, int argc, char *argv[]) 467 int pidgin_main(HINSTANCE hint, int argc, char *argv[])
874 gboolean tr = TRUE; 826 gboolean tr = TRUE;
875 dbus_message_append_args(message, DBUS_TYPE_INT32, &tr, DBUS_TYPE_INVALID); 827 dbus_message_append_args(message, DBUS_TYPE_INT32, &tr, DBUS_TYPE_INVALID);
876 dbus_connection_send_with_reply_and_block(conn, message, -1, NULL); 828 dbus_connection_send_with_reply_and_block(conn, message, -1, NULL);
877 dbus_message_unref(message); 829 dbus_message_unref(message);
878 #endif 830 #endif
831 gdk_notify_startup_complete();
879 purple_core_quit(); 832 purple_core_quit();
880 g_printerr(_("Exiting because another libpurple client is already running.\n")); 833 g_printerr(_("Exiting because another libpurple client is already running.\n"));
881 #ifdef HAVE_SIGNAL_H 834 #ifdef HAVE_SIGNAL_H
882 g_free(segfault_message); 835 g_free(segfault_message);
883 #endif 836 #endif
965 else 918 else
966 { 919 {
967 g_list_free(active_accounts); 920 g_list_free(active_accounts);
968 } 921 }
969 922
970 #ifdef HAVE_STARTUP_NOTIFICATION 923 /* GTK clears the notification for us when opening the first window,
971 startup_notification_complete(); 924 * but we may have launched with only a status icon, so clear the it
972 #endif 925 * just in case. */
926 gdk_notify_startup_complete();
973 927
974 #ifdef _WIN32 928 #ifdef _WIN32
975 winpidgin_post_init(); 929 winpidgin_post_init();
976 #endif 930 #endif
977 931

mercurial