Mercurial > pidgin.yaz
comparison pidgin/gtkmain.c @ 27735:98604b4bfa3b
propagate from branch 'im.pidgin.pidgin' (head cc8513f94aa94550d600cd8a5d42475dbf7249c0)
to branch 'im.pidgin.pidgin.yaz' (head 3a859b75c16c1c1e2e79d4f4acb4424d13af5e0b)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 22 Nov 2007 07:44:59 +0000 |
parents | b8d98bc09656 47b2074a55d8 |
children | e13759a83714 |
comparison
equal
deleted
inserted
replaced
27734:3f5b0039428b | 27735:98604b4bfa3b |
---|---|
90 | 90 |
91 /* | 91 /* |
92 * Lists of signals we wish to catch and those we wish to ignore. | 92 * Lists of signals we wish to catch and those we wish to ignore. |
93 * Each list terminated with -1 | 93 * Each list terminated with -1 |
94 */ | 94 */ |
95 static int catch_sig_list[] = { | 95 static const int catch_sig_list[] = { |
96 SIGSEGV, | 96 SIGSEGV, |
97 SIGHUP, | 97 SIGHUP, |
98 SIGINT, | 98 SIGINT, |
99 SIGTERM, | 99 SIGTERM, |
100 SIGQUIT, | 100 SIGQUIT, |
101 SIGCHLD, | 101 SIGCHLD, |
102 SIGALRM, | 102 SIGALRM, |
103 -1 | 103 -1 |
104 }; | 104 }; |
105 | 105 |
106 static int ignore_sig_list[] = { | 106 static const int ignore_sig_list[] = { |
107 SIGPIPE, | 107 SIGPIPE, |
108 -1 | 108 -1 |
109 }; | 109 }; |
110 #endif | 110 #endif |
111 | 111 |
193 signal(SIGALRM, sighandler); | 193 signal(SIGALRM, sighandler); |
194 } | 194 } |
195 | 195 |
196 char *segfault_message; | 196 char *segfault_message; |
197 | 197 |
198 /* | |
199 * This signal handler shouldn't be touching this much stuff. | |
200 * It should just set a flag and return, and something else in | |
201 * Pidgin should monitor the flag to see if something needs to | |
202 * be done. Because the signal handler interrupts the program, | |
203 * it could be called in the middle of adding a new connection | |
204 * to the list of connections, and then if we try to disconnect | |
205 * all connections it could lead to a crash because the linked | |
206 * list of connections could be in a weird state. But, well, | |
207 * this signal handler probably isn't called very often, so it's | |
208 * not a big deal. | |
209 */ | |
198 static void | 210 static void |
199 sighandler(int sig) | 211 sighandler(int sig) |
200 { | 212 { |
201 switch (sig) { | 213 switch (sig) { |
202 case SIGHUP: | 214 case SIGHUP: |
383 show_usage(const char *name, gboolean terse) | 395 show_usage(const char *name, gboolean terse) |
384 { | 396 { |
385 char *text; | 397 char *text; |
386 | 398 |
387 if (terse) { | 399 if (terse) { |
388 text = g_strdup_printf(_("%s %s. Try `%s -h' for more information.\n"), PIDGIN_NAME, VERSION, name); | 400 text = g_strdup_printf(_("%s %s. Try `%s -h' for more information.\n"), PIDGIN_NAME, DISPLAY_VERSION, name); |
389 } else { | 401 } else { |
390 text = g_strdup_printf(_("%s %s\n" | 402 text = g_strdup_printf(_("%s %s\n" |
391 "Usage: %s [OPTION]...\n\n" | 403 "Usage: %s [OPTION]...\n\n" |
392 " -c, --config=DIR use DIR for config files\n" | 404 " -c, --config=DIR use DIR for config files\n" |
393 " -d, --debug print debugging messages to stdout\n" | 405 " -d, --debug print debugging messages to stdout\n" |
397 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n" | 409 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n" |
398 " account(s) to use, separated by commas)\n" | 410 " account(s) to use, separated by commas)\n" |
399 #ifndef WIN32 | 411 #ifndef WIN32 |
400 " --display=DISPLAY X display to use\n" | 412 " --display=DISPLAY X display to use\n" |
401 #endif | 413 #endif |
402 " -v, --version display the current version and exit\n"), PIDGIN_NAME, VERSION, name); | 414 " -v, --version display the current version and exit\n"), PIDGIN_NAME, DISPLAY_VERSION, name); |
403 } | 415 } |
404 | 416 |
405 purple_print_utf8_to_console(stdout, text); | 417 purple_print_utf8_to_console(stdout, text); |
406 g_free(text); | 418 g_free(text); |
407 } | 419 } |
527 "%swiki/GetABacktrace\n\n" | 539 "%swiki/GetABacktrace\n\n" |
528 "If you need further assistance, please IM either SeanEgn or \n" | 540 "If you need further assistance, please IM either SeanEgn or \n" |
529 "LSchiere (via AIM). Contact information for Sean and Luke \n" | 541 "LSchiere (via AIM). Contact information for Sean and Luke \n" |
530 "on other protocols is at\n" | 542 "on other protocols is at\n" |
531 "%swiki/DeveloperPages\n"), | 543 "%swiki/DeveloperPages\n"), |
532 PIDGIN_NAME, VERSION, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE | 544 PIDGIN_NAME, DISPLAY_VERSION, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE |
533 ); | 545 ); |
534 | 546 |
535 /* we have to convert the message (UTF-8 to console | 547 /* we have to convert the message (UTF-8 to console |
536 charset) early because after a segmentation fault | 548 charset) early because after a segmentation fault |
537 it's not a good practice to allocate memory */ | 549 it's not a good practice to allocate memory */ |
654 #endif | 666 #endif |
655 return 0; | 667 return 0; |
656 } | 668 } |
657 /* show version message */ | 669 /* show version message */ |
658 if (opt_version) { | 670 if (opt_version) { |
659 printf("%s %s\n", PIDGIN_NAME, VERSION); | 671 printf("%s %s\n", PIDGIN_NAME, DISPLAY_VERSION); |
660 #ifdef HAVE_SIGNAL_H | 672 #ifdef HAVE_SIGNAL_H |
661 g_free(segfault_message); | 673 g_free(segfault_message); |
662 #endif | 674 #endif |
663 return 0; | 675 return 0; |
664 } | 676 } |
691 | 703 |
692 gui_check = gtk_init_check(&argc, &argv); | 704 gui_check = gtk_init_check(&argc, &argv); |
693 if (!gui_check) { | 705 if (!gui_check) { |
694 char *display = gdk_get_display(); | 706 char *display = gdk_get_display(); |
695 | 707 |
696 printf("%s %s\n", PIDGIN_NAME, VERSION); | 708 printf("%s %s\n", PIDGIN_NAME, DISPLAY_VERSION); |
697 | 709 |
698 g_warning("cannot open display: %s", display ? display : "unset"); | 710 g_warning("cannot open display: %s", display ? display : "unset"); |
699 g_free(display); | 711 g_free(display); |
700 #ifdef HAVE_SIGNAL_H | 712 #ifdef HAVE_SIGNAL_H |
701 g_free(segfault_message); | 713 g_free(segfault_message); |
764 #endif | 776 #endif |
765 abort(); | 777 abort(); |
766 } | 778 } |
767 | 779 |
768 if (opt_si && !purple_core_ensure_single_instance()) { | 780 if (opt_si && !purple_core_ensure_single_instance()) { |
781 purple_debug_info("main", "exiting because another libpurple client is already running\n"); | |
769 purple_core_quit(); | 782 purple_core_quit(); |
770 #ifdef HAVE_SIGNAL_H | 783 #ifdef HAVE_SIGNAL_H |
771 g_free(segfault_message); | 784 g_free(segfault_message); |
772 #endif | 785 #endif |
773 return 0; | 786 return 0; |