Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Ports
planner
planner-cmdline.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File planner-cmdline.patch of Package planner
From f9840c342e4b5767ee35f0d326b7f7eaf56850ed Mon Sep 17 00:00:00 2001 From: Alexandre Franke <alexandre.franke@gmail.com> Date: Mon, 05 Mar 2012 17:22:56 +0000 Subject: Fix for broken "open file on startup" behaviour Switch to gtk_init_with_args from GnomeProgam broke opening of files from command line and when double clicking on file in file browser. Based on patches 193670 and 193835 by Maxim Zakharov. https://bugzilla.gnome.org/show_bug.cgi?id=656373 --- diff --git a/src/planner-main.c b/src/planner-main.c index cdeb8ea..c0aabd2 100644 --- a/src/planner-main.c +++ b/src/planner-main.c @@ -37,7 +37,7 @@ static gchar **args_remaining = NULL; static GOptionEntry options[] = { { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, N_("Create the initial window with the given geometry."), N_("GEOMETRY")}, - { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args_remaining, NULL, N_("FILES") }, + { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &args_remaining, NULL, N_("FILES|URIs") }, { NULL } }; @@ -92,26 +92,27 @@ main (int argc, char **argv) gtk_widget_show_all (main_window); - if (argc > 1) { - i = 1; - while (argv[i]) { - if (g_str_has_prefix (argv[i], "file:")) { + if (args_remaining != NULL) { + for (i = 0; args_remaining[i]; i++) { + gchar *scheme = g_uri_parse_scheme(args_remaining[i]); + if (scheme != NULL) { planner_window_open_in_existing_or_new ( - PLANNER_WINDOW (main_window), argv[i], FALSE); + PLANNER_WINDOW (main_window), args_remaining[i], FALSE); + g_free(scheme); } else { gchar *uri; - if (!g_path_is_absolute (argv[i])) { + if (!g_path_is_absolute (args_remaining[i])) { /* Relative path. */ gchar *cwd, *tmp; cwd = g_get_current_dir (); - tmp = g_build_filename (cwd, argv[i], NULL); + tmp = g_build_filename (cwd, args_remaining[i], NULL); uri = g_filename_to_uri (tmp, NULL, NULL); g_free (tmp); g_free (cwd); } else { - uri = g_filename_to_uri (argv[i], NULL, NULL); + uri = g_filename_to_uri (args_remaining[i], NULL, NULL); } if (uri) { @@ -120,8 +121,6 @@ main (int argc, char **argv) g_free (uri); } } - - i++; } } diff --git a/src/planner-window.c b/src/planner-window.c index 73f1766..b0536c3 100644 --- a/src/planner-window.c +++ b/src/planner-window.c @@ -1726,36 +1726,24 @@ planner_window_open_in_existing_or_new (PlannerWindow *window, { PlannerWindowPriv *priv; GtkWidget *new_window; - gchar *filename; gboolean ret; priv = window->priv; - - filename = g_filename_from_uri (uri, NULL, NULL); - if (!filename) { - return FALSE; - } - if (mrp_project_is_empty (priv->project)) { - ret = planner_window_open (window, filename, internal); - g_free (filename); + ret = planner_window_open (window, uri, internal); return ret; } else { new_window = planner_application_new_window (priv->application); - if (planner_window_open (PLANNER_WINDOW (new_window), filename, internal)) { - g_free (filename); + if (planner_window_open (PLANNER_WINDOW (new_window), uri, internal)) { gtk_widget_show_all (new_window); return TRUE; } else { - g_free (filename); g_signal_emit (new_window, signals[CLOSED], 0, NULL); gtk_widget_destroy (new_window); return FALSE; } } - g_free (filename); - return FALSE; } -- cgit v0.9.0.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor