[gnome-commander] Migrate away from gnome_vfs_uri_list_parse



commit cbf8f2584b319faf5a0704d742243d2f8ee0c382
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sat Oct 2 22:41:58 2021 +0200

    Migrate away from gnome_vfs_uri_list_parse
    
    I hope this works in all Drag-n-Drop cases, in my local tests it did

 src/gnome-cmd-file-list.cc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 12ff2c2e..f5110ec5 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -3069,12 +3069,14 @@ static void autoscroll_if_appropriate (GnomeCmdFileList *fl, gint x, gint y)
 static void drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, 
guint info, guint32 time, GnomeCmdFileList *fl)
 {
     int len;
-    GList *files;
+    GList *files = nullptr;
 
     gchar *data = (gchar *) build_selected_file_list (fl, &len);
 
     if (!data) return;
 
+    gchar **uriCharList, **uriCharListTmp = nullptr;
+
     switch (info)
     {
         case TARGET_URI_LIST:
@@ -3083,10 +3085,16 @@ static void drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelect
             break;
 
         case TARGET_URL:
-            files = gnome_vfs_uri_list_parse (data);
+            uriCharList = uriCharListTmp = g_uri_list_extract_uris (data);
+            for (auto uriChar = *uriCharListTmp; uriChar; uriChar=*++uriCharListTmp)
+            {
+                auto gFile = g_file_new_for_uri(uriChar);
+                files = g_list_append(files, gFile);
+            }
             if (files)
                 gtk_selection_data_set (selection_data, selection_data->target, 8, (const guchar *) 
files->data, strlen ((const char *) files->data));
-            g_list_foreach (files, (GFunc) g_free, nullptr);
+            g_list_foreach (files, (GFunc) g_object_unref, nullptr);
+            g_strfreev(uriCharList);
             break;
 
         default:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]