changeset 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 bb9c06e7cf6d
children 3a51b301a805
files src/main.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Wed Nov 05 22:13:12 2003 +0000
+++ b/src/main.c	Wed Nov 05 22:44:46 2003 +0000
@@ -621,6 +621,7 @@
 #endif
 	int opt, opt_user = 0;
 	int i;
+	gboolean gui_check;
 
 	struct option long_options[] = {
 		{"acct", no_argument, NULL, 'a'},
@@ -759,7 +760,7 @@
 	 */
 
 	gtk_set_locale();
-	gtk_init(&argc, &argv);
+	gui_check=gtk_init_check(&argc, &argv);
 
 	/* scan command-line options */
 	opterr = 1;
@@ -815,6 +816,12 @@
 		return 0;
 	}
 
+	if(! gui_check) {
+	    const char *display_name_arg = gdk_get_display_arg_name ();
+	    g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : " ");
+	    return 1;
+	}
+
 	gaim_gtk_stock_init();
 
 	gaim_core_set_ui_ops(gaim_gtk_core_get_ui_ops());