comparison src/main.c @ 7438:d3400dadc594

[gaim-migrate @ 8043] "This patch solves the problem, that "gaim --version" or "gaim --help" only works, if DISPLAY is set properly. With this patch it's possible to call "--version" or "--help" without X. This is for instance useful for shell scripts, which check Gaim's version." --Bjoern Voigt committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 05 Nov 2003 22:44:46 +0000
parents 643cbc9a6035
children 08ce2a94d9c7
comparison
equal deleted inserted replaced
7437:bb9c06e7cf6d 7438:d3400dadc594
619 sigset_t sigset; 619 sigset_t sigset;
620 void (*prev_sig_disp)(); 620 void (*prev_sig_disp)();
621 #endif 621 #endif
622 int opt, opt_user = 0; 622 int opt, opt_user = 0;
623 int i; 623 int i;
624 gboolean gui_check;
624 625
625 struct option long_options[] = { 626 struct option long_options[] = {
626 {"acct", no_argument, NULL, 'a'}, 627 {"acct", no_argument, NULL, 'a'},
627 /*{"away", optional_argument, NULL, 'w'}, */ 628 /*{"away", optional_argument, NULL, 'w'}, */
628 {"help", no_argument, NULL, 'h'}, 629 {"help", no_argument, NULL, 'h'},
757 exit(0); 758 exit(0);
758 } 759 }
759 */ 760 */
760 761
761 gtk_set_locale(); 762 gtk_set_locale();
762 gtk_init(&argc, &argv); 763 gui_check=gtk_init_check(&argc, &argv);
763 764
764 /* scan command-line options */ 765 /* scan command-line options */
765 opterr = 1; 766 opterr = 1;
766 while ((opt = getopt_long(argc, argv, 767 while ((opt = getopt_long(argc, argv,
767 #ifndef _WIN32 768 #ifndef _WIN32
813 if (opt_version) { 814 if (opt_version) {
814 printf("Gaim %s\n",VERSION); 815 printf("Gaim %s\n",VERSION);
815 return 0; 816 return 0;
816 } 817 }
817 818
819 if(! gui_check) {
820 const char *display_name_arg = gdk_get_display_arg_name ();
821 g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : " ");
822 return 1;
823 }
824
818 gaim_gtk_stock_init(); 825 gaim_gtk_stock_init();
819 826
820 gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops()); 827 gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops());
821 828
822 #ifdef _WIN32 829 #ifdef _WIN32