[nautilus/wip/corey/rework-clipboard: 1/6] files-view: Add PasteCallbackData struct




commit dea21115dca56912b506974533e79dba576d256d
Author: Corey Berla <corey berla me>
Date:   Tue Sep 20 10:57:34 2022 -0700

    files-view: Add PasteCallbackData struct
    
    This will allow a more straight forward clipboard handling code

 src/nautilus-files-view.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index f19fab712..6821dd4a9 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -2727,6 +2727,41 @@ action_open_item_new_window (GSimpleAction *action,
     nautilus_file_list_free (selection);
 }
 
+typedef struct _PasteCallbackData
+{
+    NautilusFilesView *view;
+    GdkDragAction action;
+    gchar *dest_uri;
+} PasteCallbackData;
+
+static void
+paste_callback_data_free (PasteCallbackData *data)
+{
+    g_free (data->dest_uri);
+    g_free (data);
+}
+
+static PasteCallbackData *
+paste_callback_data_new (NautilusFilesView *view,
+                         gchar             *dest_uri,
+                         GdkDragAction      action)
+{
+    PasteCallbackData *data = g_new0 (PasteCallbackData, 1);
+
+    if (dest_uri == NULL)
+    {
+        data->dest_uri = nautilus_files_view_get_backing_uri (view);
+    }
+    else
+    {
+        data->dest_uri = dest_uri;
+    }
+    data->action = action;
+    data->view = view;
+
+    return data;
+}
+
 static void
 handle_clipboard_data (NautilusFilesView *view,
                        NautilusClipboard *clip,


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