[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:11:41 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       x   f   c   e   -   4   .   1   2   
   in repository xfce/thunar.

commit 31cf640f7565e273fbb80cf8e826274dd793e4be
Author: Manuel Grießmayr <abspack at posteo.de>
Date:   Sun Feb 25 23:10:25 2018 +0100

    Fixed creation of .desktop file when dropping URL into folder
    (bug #14239)
---
 thunar/thunar-standard-view.c | 81 ++++++++++++++++++++++---------------------
 1 file changed, 41 insertions(+), 40 deletions(-)

diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 6b078e3..4d248c3 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -3344,50 +3344,51 @@ 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 (toplevel->window));
+                              /* 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 (toplevel->window));
 #endif
+                            }
+
+                          /* terminate the parameter list */
+                          argv[n++] = "--create-new";
+                          argv[n++] = working_directory;
+                          argv[n++] = NULL;
+
+                          /* try to run exo-desktop-item-edit */
+                          succeed = gdk_spawn_on_screen (gtk_widget_get_screen (view), working_directory, argv, NULL,
+                                                         G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
+                                                         NULL, NULL, &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);
+                            }
                         }
-
-                      /* terminate the parameter list */
-                      argv[n++] = "--create-new";
-                      argv[n++] = working_directory;
-                      argv[n++] = NULL;
-
-                      /* try to run exo-desktop-item-edit */
-                      succeed = gdk_spawn_on_screen (gtk_widget_get_screen (view), working_directory, argv, NULL,
-                                                     G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
-                                                     NULL, NULL, &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_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