diff options
author | Nicolás Reynolds <fauno@endefensadelsl.org> | 2014-01-24 03:49:02 +0000 |
---|---|---|
committer | Nicolás Reynolds <fauno@endefensadelsl.org> | 2014-01-24 03:49:02 +0000 |
commit | 58a72e3d6c07ca57231ada1576ba86af346197d4 (patch) | |
tree | 1e2ab396a5c53f24fedef939833ca53fd8566847 /community/planner/f9840c342e4b5767ee35f0d326b7f7eaf56850ed.patch | |
parent | 1a04b89cbb8e27e4622005c896745498af51ef45 (diff) |
Fri Jan 24 03:41:27 UTC 2014
Diffstat (limited to 'community/planner/f9840c342e4b5767ee35f0d326b7f7eaf56850ed.patch')
-rw-r--r-- | community/planner/f9840c342e4b5767ee35f0d326b7f7eaf56850ed.patch | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/community/planner/f9840c342e4b5767ee35f0d326b7f7eaf56850ed.patch b/community/planner/f9840c342e4b5767ee35f0d326b7f7eaf56850ed.patch new file mode 100644 index 000000000..1ee60f528 --- /dev/null +++ b/community/planner/f9840c342e4b5767ee35f0d326b7f7eaf56850ed.patch @@ -0,0 +1,114 @@ +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.2 |