[Xfce4-commits] [xfce/thunar] 01/01: Fixed creation of .desktop file when dropping URL into folder (bug #14239)
noreply at xfce.org
noreply at xfce.org
Sun Feb 25 23:14:02 CET 2018
This is an automated email from the git hooks/post-receive script.
a l e x p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar.
commit 15fdf175cb2708b09f8581cb29811ee4a3045acd
Author: Manuel Grießmayr <abspack at posteo.de>
Date: Sun Feb 25 22:46:00 2018 +0100
Fixed creation of .desktop file when dropping URL into folder (bug
#14239)
---
thunar/thunar-standard-view.c | 98 ++++++++++++++++++++++---------------------
1 file changed, 50 insertions(+), 48 deletions(-)
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 2bddff8..de76671 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -3339,58 +3339,60 @@ thunar_standard_view_drag_data_received (GtkWidget *view,
if (G_LIKELY (file != NULL))
{
/* determine the absolute path to the target directory */
- working_directory = thunar_file_dup_uri (file);
-
- /* prepare the basic part of the command */
- argv[n++] = "exo-desktop-item-edit";
- argv[n++] = "--type=Link";
- argv[n++] = "--url";
- argv[n++] = bits[0];
- argv[n++] = "--name";
- argv[n++] = bits[1];
-
- /* determine the toplevel window */
- toplevel = gtk_widget_get_toplevel (view);
- if (toplevel != NULL && gtk_widget_is_toplevel (toplevel))
+ working_directory = g_file_get_path (thunar_file_get_file (file));
+ if (G_LIKELY (working_directory != NULL))
{
+ /* prepare the basic part of the command */
+ argv[n++] = "exo-desktop-item-edit";
+ argv[n++] = "--type=Link";
+ argv[n++] = "--url";
+ argv[n++] = bits[0];
+ argv[n++] = "--name";
+ argv[n++] = bits[1];
+
+ /* determine the toplevel window */
+ toplevel = gtk_widget_get_toplevel (view);
+ if (toplevel != NULL && gtk_widget_is_toplevel (toplevel))
+ {
#if defined(GDK_WINDOWING_X11)
- /* on X11, we can supply the parent window id here */
- argv[n++] = "--xid";
- argv[n++] = g_newa (gchar, 32);
- g_snprintf (argv[n - 1], 32, "%ld", (glong) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (toplevel))));
+ /* on X11, we can supply the parent window id here */
+ argv[n++] = "--xid";
+ argv[n++] = g_newa (gchar, 32);
+ g_snprintf (argv[n - 1], 32, "%ld", (glong) GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (toplevel))));
#endif
+ }
+
+ /* terminate the parameter list */
+ argv[n++] = "--create-new";
+ argv[n++] = working_directory;
+ argv[n++] = NULL;
+
+ screen = gtk_widget_get_screen (GTK_WIDGET (view));
+
+ if (screen != NULL)
+ display = g_strdup (gdk_display_get_name (gdk_screen_get_display (screen)));
+
+ /* try to run exo-desktop-item-edit */
+ succeed = g_spawn_async (working_directory, argv, NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
+ thunar_setup_display_cb, display, &pid, &error);
+
+ if (G_UNLIKELY (!succeed))
+ {
+ /* display an error dialog to the user */
+ thunar_dialogs_show_error (standard_view, error, _("Failed to create a link for the URL \"%s\""), bits[0]);
+ g_free (working_directory);
+ g_error_free (error);
+ }
+ else
+ {
+ /* reload the directory when the command terminates */
+ g_child_watch_add_full (G_PRIORITY_LOW, pid, tsv_reload_directory, working_directory, g_free);
+ }
+
+ /* cleanup */
+ g_free (display);
}
-
- /* terminate the parameter list */
- argv[n++] = "--create-new";
- argv[n++] = working_directory;
- argv[n++] = NULL;
-
- screen = gtk_widget_get_screen (GTK_WIDGET (view));
-
- if (screen != NULL)
- display = g_strdup (gdk_display_get_name (gdk_screen_get_display (screen)));
-
- /* try to run exo-desktop-item-edit */
- succeed = g_spawn_async (working_directory, argv, NULL,
- G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
- thunar_setup_display_cb, display, &pid, &error);
-
- if (G_UNLIKELY (!succeed))
- {
- /* display an error dialog to the user */
- thunar_dialogs_show_error (standard_view, error, _("Failed to create a link for the URL \"%s\""), bits[0]);
- g_free (working_directory);
- g_error_free (error);
- }
- else
- {
- /* reload the directory when the command terminates */
- g_child_watch_add_full (G_PRIORITY_LOW, pid, tsv_reload_directory, working_directory, g_free);
- }
-
- /* cleanup */
- g_free (display);
g_object_unref (G_OBJECT (file));
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list