# HG changeset patch # User Luke Schierer # Date 1068072286 0 # Node ID d3400dadc59428d2f539744925cfe6e18824fddb # Parent bb9c06e7cf6ddbb39c4ec4e390cee857b84e4c03 [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 diff -r bb9c06e7cf6d -r d3400dadc594 src/main.c --- 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());