Enable parsing command line options without a valid X display.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2129 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-12-23 17:06:11 +00:00
parent 6b2df19863
commit 2ca754ab0f
2 changed files with 16 additions and 5 deletions

View File

@ -3,6 +3,8 @@
* src/keybindings.c: Fix inverted move tab first/last commands.
* src/templates.c:
Add Python filetype template (patch by Elena of Valhalla, thanks).
* src/main.c:
Enable parsing command line options without a valid X display.
2007-12-21 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -423,14 +423,20 @@ static void locale_init()
static void parse_command_line_options(gint *argc, gchar ***argv)
{
GError *error = NULL;
GOptionContext *context;
context = g_option_context_new(_("[FILES...]"));
g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
g_option_group_set_translation_domain(g_option_context_get_main_group(context), GETTEXT_PACKAGE);
g_option_context_add_group(context, gtk_get_option_group(FALSE));
g_option_context_parse(context, argc, argv, &error);
g_option_context_free(context);
// first initialise cl_options fields with default values
cl_options.load_session = TRUE;
cl_options.goto_line = -1;
cl_options.goto_column = -1;
gtk_init_with_args(argc, argv, _("[FILES...]"), entries, GETTEXT_PACKAGE, &error);
if (error != NULL)
{
g_printerr("Geany: %s\n", error->message);
@ -514,6 +520,12 @@ static void parse_command_line_options(gint *argc, gchar ***argv)
vte_info.lib_vte = lib_vte;
#endif
cl_options.ignore_global_tags = ignore_global_tags;
if (! gtk_init_check(NULL, NULL))
{ // check whether we have a valid X display and exit if not
g_printerr("Geany: cannot open display\n");
exit(1);
}
}
@ -641,11 +653,8 @@ gint main(gint argc, gchar **argv)
setup_paths();
locale_init();
// gtk_init() is called within parse_command_line_options()
parse_command_line_options(&argc, &argv);
gtk_set_locale();
signal(SIGTERM, signal_cb);
#ifdef G_OS_UNIX
// SIGQUIT is used to kill spawned children and we get also this signal, so ignore