Blame SOURCES/0012-clipboard-Use-text-based-clipboard-only.patch

1e3c33
From 228971be31f92625f641531e1b78b8c8e63677b0 Mon Sep 17 00:00:00 2001
1e3c33
From: Carlos Soriano <csoriano@redhat.com>
1e3c33
Date: Tue, 31 Jul 2018 22:10:03 +0200
1e3c33
Subject: [PATCH] clipboard: Use text based clipboard only
1e3c33
1e3c33
---
1e3c33
 src/nautilus-canvas-view.c |  13 ++++++-------
1e3c33
 src/nautilus-clipboard.c   | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------
1e3c33
 src/nautilus-clipboard.h   |   5 +++--
1e3c33
 src/nautilus-files-view.c  | 112 +++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------
1e3c33
 src/nautilus-list-view.c   |  13 ++++++-------
1e3c33
 5 files changed, 102 insertions(+), 154 deletions(-)
1e3c33
1e3c33
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
1e3c33
index f99ddd9..7de0808 100644
1e3c33
--- a/src/nautilus-canvas-view.c
1e3c33
+++ b/src/nautilus-canvas-view.c
1e3c33
@@ -549,9 +549,9 @@ nautilus_canvas_view_begin_loading (NautilusFilesView *view)
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
-on_clipboard_contents_received (GtkClipboard     *clipboard,
1e3c33
-                                GtkSelectionData *selection_data,
1e3c33
-                                gpointer          user_data)
1e3c33
+on_clipboard_contents_received (GtkClipboard *clipboard,
1e3c33
+                                const gchar  *selection_data,
1e3c33
+                                gpointer      user_data)
1e3c33
 {
1e3c33
     NautilusCanvasView *canvas_view;
1e3c33
 
1e3c33
@@ -590,10 +590,9 @@ static void
1e3c33
 update_clipboard_status (NautilusCanvasView *view)
1e3c33
 {
1e3c33
     g_object_ref (view);     /* Need to keep the object alive until we get the reply */
1e3c33
-    gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                    nautilus_clipboard_get_atom (),
1e3c33
-                                    on_clipboard_contents_received,
1e3c33
-                                    view);
1e3c33
+    gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
+                                on_clipboard_contents_received,
1e3c33
+                                view);
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
diff --git a/src/nautilus-clipboard.c b/src/nautilus-clipboard.c
1e3c33
index 267d7a3..752ff13 100644
1e3c33
--- a/src/nautilus-clipboard.c
1e3c33
+++ b/src/nautilus-clipboard.c
1e3c33
@@ -33,30 +33,32 @@
1e3c33
 #include <gtk/gtk.h>
1e3c33
 #include <string.h>
1e3c33
 
1e3c33
-static GdkAtom copied_files_atom;
1e3c33
-
1e3c33
 typedef struct
1e3c33
 {
1e3c33
     gboolean cut;
1e3c33
     GList *files;
1e3c33
 } ClipboardInfo;
1e3c33
 
1e3c33
 static GList *
1e3c33
-convert_lines_to_str_list (char **lines)
1e3c33
+convert_selection_data_to_str_list (const gchar *data)
1e3c33
 {
1e3c33
     int i;
1e3c33
     GList *result;
1e3c33
+    size_t number_of_lines;
1e3c33
+    gchar **lines;
1e3c33
 
1e3c33
-    if (lines[0] == NULL)
1e3c33
-    {
1e3c33
-        return NULL;
1e3c33
-    }
1e3c33
-
1e3c33
+    lines = g_strsplit (data, "\n", 0);
1e3c33
     result = NULL;
1e3c33
-    for (i = 0; lines[i] != NULL; i++)
1e3c33
+    number_of_lines = g_strv_length (lines);
1e3c33
+    /* Also, this skips the last line, since it would be an
1e3c33
+     * empty string from the split */
1e3c33
+    for (i = 0; i < number_of_lines - 1; i++)
1e3c33
     {
1e3c33
         result = g_list_prepend (result, g_strdup (lines[i]));
1e3c33
     }
1e3c33
+
1e3c33
+    g_strfreev (lines);
1e3c33
+
1e3c33
     return g_list_reverse (result);
1e3c33
 }
1e3c33
 
1e3c33
@@ -77,7 +79,8 @@ convert_file_list_to_string (ClipboardInfo *info,
1e3c33
     }
1e3c33
     else
1e3c33
     {
1e3c33
-        uris = g_string_new (info->cut ? "cut" : "copy");
1e3c33
+        uris = g_string_new ("x-special/nautilus-clipboard\n");
1e3c33
+        g_string_append (uris, info->cut ? "cut\n" : "copy\n");
1e3c33
     }
1e3c33
 
1e3c33
     for (i = 0, l = info->files; l != NULL; l = l->next, i++)
1e3c33
@@ -100,16 +103,12 @@ convert_file_list_to_string (ClipboardInfo *info,
1e3c33
                 g_string_append (uris, uri);
1e3c33
             }
1e3c33
 
1e3c33
-            /* skip newline for last element */
1e3c33
-            if (i + 1 < g_list_length (info->files))
1e3c33
-            {
1e3c33
-                g_string_append_c (uris, '\n');
1e3c33
-            }
1e3c33
+            g_string_append_c (uris, '\n');
1e3c33
         }
1e3c33
         else
1e3c33
         {
1e3c33
-            g_string_append_c (uris, '\n');
1e3c33
             g_string_append (uris, uri);
1e3c33
+            g_string_append_c (uris, '\n');
1e3c33
         }
1e3c33
 
1e3c33
         g_free (uri);
1e3c33
@@ -120,43 +119,60 @@ convert_file_list_to_string (ClipboardInfo *info,
1e3c33
 }
1e3c33
 
1e3c33
 static GList *
1e3c33
-get_item_list_from_selection_data (GtkSelectionData *selection_data)
1e3c33
+get_item_list_from_selection_data (const gchar *selection_data)
1e3c33
 {
1e3c33
-    GList *items;
1e3c33
-    char **lines;
1e3c33
+    GList *items = NULL;
1e3c33
 
1e3c33
-    if (gtk_selection_data_get_data_type (selection_data) != copied_files_atom
1e3c33
-        || gtk_selection_data_get_length (selection_data) <= 0)
1e3c33
+    if (selection_data != NULL)
1e3c33
     {
1e3c33
-        items = NULL;
1e3c33
-    }
1e3c33
-    else
1e3c33
-    {
1e3c33
-        gchar *data;
1e3c33
+        gboolean valid_data = TRUE;
1e3c33
         /* Not sure why it's legal to assume there's an extra byte
1e3c33
          * past the end of the selection data that it's safe to write
1e3c33
          * to. But gtk_editable_selection_received does this, so I
1e3c33
          * think it is OK.
1e3c33
          */
1e3c33
-        data = (gchar *) gtk_selection_data_get_data (selection_data);
1e3c33
-        data[gtk_selection_data_get_length (selection_data)] = '\0';
1e3c33
-        lines = g_strsplit (data, "\n", 0);
1e3c33
-        items = convert_lines_to_str_list (lines);
1e3c33
-        g_strfreev (lines);
1e3c33
+        items = convert_selection_data_to_str_list (selection_data);
1e3c33
+        if (items == NULL || g_strcmp0 (items->data, "x-special/nautilus-clipboard") != 0)
1e3c33
+        {
1e3c33
+            valid_data = FALSE;
1e3c33
+        }
1e3c33
+        else if (items->next == NULL)
1e3c33
+        {
1e3c33
+            valid_data = FALSE;
1e3c33
+        }
1e3c33
+        else if (g_strcmp0 (items->next->data, "cut") != 0 &&
1e3c33
+                 g_strcmp0 (items->next->data, "copy") != 0)
1e3c33
+        {
1e3c33
+            valid_data = FALSE;
1e3c33
+        }
1e3c33
+
1e3c33
+        if (!valid_data)
1e3c33
+        {
1e3c33
+            g_list_free_full (items, g_free);
1e3c33
+            items = NULL;
1e3c33
+        }
1e3c33
     }
1e3c33
 
1e3c33
     return items;
1e3c33
 }
1e3c33
 
1e3c33
+gboolean
1e3c33
+nautilus_clipboard_is_data_valid_from_selection_data (const gchar *selection_data)
1e3c33
+{
1e3c33
+    return nautilus_clipboard_get_uri_list_from_selection_data (selection_data) != NULL;
1e3c33
+}
1e3c33
+
1e3c33
 GList *
1e3c33
-nautilus_clipboard_get_uri_list_from_selection_data (GtkSelectionData *selection_data)
1e3c33
+nautilus_clipboard_get_uri_list_from_selection_data (const gchar *selection_data)
1e3c33
 {
1e3c33
     GList *items;
1e3c33
 
1e3c33
     items = get_item_list_from_selection_data (selection_data);
1e3c33
     if (items)
1e3c33
     {
1e3c33
-        /* Line 0 is "cut" or "copy", so uris start at line 1. */
1e3c33
+        /* Line 0 is x-special/nautilus-clipboard. */
1e3c33
+        items = g_list_remove (items, items->data);
1e3c33
+        /* Line 1 is "cut" or "copy", so uris start at line 2. */
1e3c33
         items = g_list_remove (items, items->data);
1e3c33
     }
1e3c33
 
1e3c33
@@ -174,13 +190,12 @@ void
1e3c33
 nautilus_clipboard_clear_if_colliding_uris (GtkWidget   *widget,
1e3c33
                                             const GList *item_uris)
1e3c33
 {
1e3c33
-    GtkSelectionData *data;
1e3c33
+    g_autofree gchar *data = NULL;
1e3c33
     GList *clipboard_item_uris, *l;
1e3c33
     gboolean collision;
1e3c33
 
1e3c33
     collision = FALSE;
1e3c33
-    data = gtk_clipboard_wait_for_contents (nautilus_clipboard_get (widget),
1e3c33
-                                            copied_files_atom);
1e3c33
+    data = gtk_clipboard_wait_for_text (nautilus_clipboard_get (widget));
1e3c33
     if (data == NULL)
1e3c33
     {
1e3c33
         return;
1e3c33
@@ -210,14 +225,14 @@ nautilus_clipboard_clear_if_colliding_uris (GtkWidget   *widget,
1e3c33
 }
1e3c33
 
1e3c33
 gboolean
1e3c33
-nautilus_clipboard_is_cut_from_selection_data (GtkSelectionData *selection_data)
1e3c33
+nautilus_clipboard_is_cut_from_selection_data (const gchar *selection_data)
1e3c33
 {
1e3c33
     GList *items;
1e3c33
     gboolean is_cut_from_selection_data;
1e3c33
 
1e3c33
     items = get_item_list_from_selection_data (selection_data);
1e3c33
     is_cut_from_selection_data = items != NULL &&
1e3c33
-                                 g_strcmp0 ((gchar *) items->data, "cut") == 0;
1e3c33
+                                 g_strcmp0 ((gchar *) items->next->data, "cut") == 0;
1e3c33
 
1e3c33
     g_list_free_full (items, g_free);
1e3c33
 
1e3c33
@@ -262,17 +277,8 @@ on_get_clipboard (GtkClipboard     *clipboard,
1e3c33
         char *str;
1e3c33
         gsize len;
1e3c33
 
1e3c33
-        str = convert_file_list_to_string (clipboard_info, TRUE, &len;;
1e3c33
-        gtk_selection_data_set_text (selection_data, str, len);
1e3c33
-        g_free (str);
1e3c33
-    }
1e3c33
-    else if (target == copied_files_atom)
1e3c33
-    {
1e3c33
-        char *str;
1e3c33
-        gsize len;
1e3c33
-
1e3c33
         str = convert_file_list_to_string (clipboard_info, FALSE, &len;;
1e3c33
-        gtk_selection_data_set (selection_data, copied_files_atom, 8, (guchar *) str, len);
1e3c33
+        gtk_selection_data_set_text (selection_data, str, len);
1e3c33
         g_free (str);
1e3c33
     }
1e3c33
 }
1e3c33
@@ -303,7 +309,6 @@ nautilus_clipboard_prepare_for_files (GtkClipboard *clipboard,
1e3c33
     clipboard_info->files = nautilus_file_list_copy (files);
1e3c33
 
1e3c33
     target_list = gtk_target_list_new (NULL, 0);
1e3c33
-    gtk_target_list_add (target_list, copied_files_atom, 0, 0);
1e3c33
     gtk_target_list_add_uri_targets (target_list, 0);
1e3c33
     gtk_target_list_add_text_targets (target_list, 0);
1e3c33
 
1e3c33
@@ -317,13 +322,3 @@ nautilus_clipboard_prepare_for_files (GtkClipboard *clipboard,
1e3c33
     gtk_target_table_free (targets, n_targets);
1e3c33
 }
1e3c33
 
1e3c33
-GdkAtom
1e3c33
-nautilus_clipboard_get_atom (void)
1e3c33
-{
1e3c33
-    if (!copied_files_atom)
1e3c33
-    {
1e3c33
-        copied_files_atom = gdk_atom_intern_static_string ("x-special/gnome-copied-files");
1e3c33
-    }
1e3c33
-
1e3c33
-    return copied_files_atom;
1e3c33
-}
1e3c33
diff --git a/src/nautilus-clipboard.h b/src/nautilus-clipboard.h
1e3c33
index 613e983..3be19c9 100644
1e3c33
--- a/src/nautilus-clipboard.h
1e3c33
+++ b/src/nautilus-clipboard.h
1e3c33
@@ -28,11 +28,12 @@
1e3c33
 void nautilus_clipboard_clear_if_colliding_uris    (GtkWidget          *widget,
1e3c33
                                                     const GList        *item_uris);
1e3c33
 GtkClipboard* nautilus_clipboard_get               (GtkWidget          *widget);
1e3c33
-GList* nautilus_clipboard_get_uri_list_from_selection_data (GtkSelectionData   *selection_data);
1e3c33
-gboolean nautilus_clipboard_is_cut_from_selection_data (GtkSelectionData *selection_data);
1e3c33
+GList* nautilus_clipboard_get_uri_list_from_selection_data (const gchar *selection_data);
1e3c33
+gboolean nautilus_clipboard_is_cut_from_selection_data (const gchar *selection_data);
1e3c33
 void nautilus_clipboard_prepare_for_files (GtkClipboard *clipboard,
1e3c33
                                            GList        *files,
1e3c33
                                            gboolean      cut);
1e3c33
 GdkAtom nautilus_clipboard_get_atom (void);
1e3c33
+gboolean nautilus_clipboard_is_data_valid_from_selection_data (const gchar *selection_data);
1e3c33
 
1e3c33
 #endif /* NAUTILUS_CLIPBOARD_H */
1e3c33
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
1e3c33
index 8aff33e..a74b691 100644
1e3c33
--- a/src/nautilus-files-view.c
1e3c33
+++ b/src/nautilus-files-view.c
1e3c33
@@ -2551,7 +2551,7 @@ action_open_item_new_window (GSimpleAction *action,
1e3c33
 
1e3c33
 static void
1e3c33
 handle_clipboard_data (NautilusFilesView *view,
1e3c33
-                       GtkSelectionData  *selection_data,
1e3c33
+                       const gchar       *selection_data,
1e3c33
                        char              *destination_uri,
1e3c33
                        GdkDragAction      action)
1e3c33
 {
1e3c33
@@ -2576,7 +2576,7 @@ handle_clipboard_data (NautilusFilesView *view,
1e3c33
 
1e3c33
 static void
1e3c33
 paste_clipboard_data (NautilusFilesView *view,
1e3c33
-                      GtkSelectionData  *selection_data,
1e3c33
+                      const gchar       *selection_data,
1e3c33
                       char              *destination_uri)
1e3c33
 {
1e3c33
     GdkDragAction action;
1e3c33
@@ -2594,9 +2594,9 @@ paste_clipboard_data (NautilusFilesView *view,
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
-paste_clipboard_received_callback (GtkClipboard     *clipboard,
1e3c33
-                                   GtkSelectionData *selection_data,
1e3c33
-                                   gpointer          data)
1e3c33
+paste_clipboard_text_received_callback (GtkClipboard     *clipboard,
1e3c33
+                                        const gchar      *selection_data,
1e3c33
+                                        gpointer          data)
1e3c33
 {
1e3c33
     NautilusFilesView *view;
1e3c33
     NautilusFilesViewPrivate *priv;
1e3c33
@@ -2629,16 +2629,15 @@ action_paste_files (GSimpleAction *action,
1e3c33
     view = NAUTILUS_FILES_VIEW (user_data);
1e3c33
 
1e3c33
     g_object_ref (view);
1e3c33
-    gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                    nautilus_clipboard_get_atom (),
1e3c33
-                                    paste_clipboard_received_callback,
1e3c33
-                                    view);
1e3c33
+    gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
+                                paste_clipboard_text_received_callback,
1e3c33
+                                view);
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
-create_links_clipboard_received_callback (GtkClipboard     *clipboard,
1e3c33
-                                          GtkSelectionData *selection_data,
1e3c33
-                                          gpointer          data)
1e3c33
+create_links_clipboard_received_callback (GtkClipboard *clipboard,
1e3c33
+                                          const gchar  *selection_data,
1e3c33
+                                          gpointer      data)
1e3c33
 {
1e3c33
     NautilusFilesView *view;
1e3c33
     NautilusFilesViewPrivate *priv;
1e3c33
@@ -2671,10 +2670,9 @@ action_create_links (GSimpleAction *action,
1e3c33
     view = NAUTILUS_FILES_VIEW (user_data);
1e3c33
 
1e3c33
     g_object_ref (view);
1e3c33
-    gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                    nautilus_clipboard_get_atom (),
1e3c33
-                                    create_links_clipboard_received_callback,
1e3c33
-                                    view);
1e3c33
+    gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
+                                create_links_clipboard_received_callback,
1e3c33
+                                view);
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
@@ -6016,9 +6014,9 @@ typedef struct
1e3c33
 } PasteIntoData;
1e3c33
 
1e3c33
 static void
1e3c33
-paste_into_clipboard_received_callback (GtkClipboard     *clipboard,
1e3c33
-                                        GtkSelectionData *selection_data,
1e3c33
-                                        gpointer          callback_data)
1e3c33
+paste_into_clipboard_received_callback (GtkClipboard *clipboard,
1e3c33
+                                        const gchar  *selection_data,
1e3c33
+                                        gpointer      callback_data)
1e3c33
 {
1e3c33
     NautilusFilesViewPrivate *priv;
1e3c33
     PasteIntoData *data;
1e3c33
@@ -6058,10 +6056,9 @@ paste_into (NautilusFilesView *view,
1e3c33
     data->view = g_object_ref (view);
1e3c33
     data->target = nautilus_file_ref (target);
1e3c33
 
1e3c33
-    gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                    nautilus_clipboard_get_atom (),
1e3c33
-                                    paste_into_clipboard_received_callback,
1e3c33
-                                    data);
1e3c33
+    gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
+                                paste_into_clipboard_received_callback,
1e3c33
+                                data);
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
@@ -6925,18 +6922,19 @@ can_paste_into_file (NautilusFile *file)
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
-on_clipboard_contents_received (GtkClipboard     *clipboard,
1e3c33
-                                GtkSelectionData *selection_data,
1e3c33
-                                gpointer          user_data)
1e3c33
+on_clipboard_contents_received (GtkClipboard *clipboard,
1e3c33
+                                const gchar  *selection_data,
1e3c33
+                                gpointer      user_data)
1e3c33
 {
1e3c33
     NautilusFilesViewPrivate *priv;
1e3c33
     NautilusFilesView *view;
1e3c33
     gboolean can_link_from_copied_files;
1e3c33
     gboolean settings_show_create_link;
1e3c33
     gboolean is_read_only;
1e3c33
     gboolean selection_contains_recent;
1e3c33
     gboolean selection_contains_starred;
1e3c33
     GAction *action;
1e3c33
+    gboolean is_data_valid;
1e3c33
 
1e3c33
     view = NAUTILUS_FILES_VIEW (user_data);
1e3c33
     priv = nautilus_files_view_get_instance_private (view);
1e3c33
@@ -6949,77 +6947,41 @@ on_clipboard_contents_received (GtkClipboard     *clipboard,
1e3c33
         return;
1e3c33
     }
1e3c33
 
1e3c33
+    is_data_valid = nautilus_clipboard_is_data_valid_from_selection_data (selection_data);
1e3c33
     settings_show_create_link = g_settings_get_boolean (nautilus_preferences,
1e3c33
                                                         NAUTILUS_PREFERENCES_SHOW_CREATE_LINK);
1e3c33
     is_read_only = nautilus_files_view_is_read_only (view);
1e3c33
     selection_contains_recent = showing_recent_directory (view);
1e3c33
     selection_contains_starred = showing_starred_directory (view);
1e3c33
     can_link_from_copied_files = !nautilus_clipboard_is_cut_from_selection_data (selection_data) &&
1e3c33
                                  !selection_contains_recent && !selection_contains_starred &&
1e3c33
-                                 !is_read_only && gtk_selection_data_get_length (selection_data) > 0;
1e3c33
+                                 !is_read_only && selection_data != NULL;
1e3c33
 
1e3c33
     action = g_action_map_lookup_action (G_ACTION_MAP (priv->view_action_group),
1e3c33
                                          "create-link");
1e3c33
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
1e3c33
                                  can_link_from_copied_files &&
1e3c33
                                  settings_show_create_link);
1e3c33
 
1e3c33
-    g_object_unref (view);
1e3c33
-}
1e3c33
-
1e3c33
-static void
1e3c33
-on_clipboard_targets_received (GtkClipboard *clipboard,
1e3c33
-                               GdkAtom      *targets,
1e3c33
-                               int           n_targets,
1e3c33
-                               gpointer      user_data)
1e3c33
-{
1e3c33
-    NautilusFilesViewPrivate *priv;
1e3c33
-    NautilusFilesView *view;
1e3c33
-    gboolean is_data_copied;
1e3c33
-    int i;
1e3c33
-    GAction *action;
1e3c33
-
1e3c33
-    view = NAUTILUS_FILES_VIEW (user_data);
1e3c33
-    priv = nautilus_files_view_get_instance_private (view);
1e3c33
-    is_data_copied = FALSE;
1e3c33
-
1e3c33
-    if (priv->slot == NULL ||
1e3c33
-        !priv->active)
1e3c33
-    {
1e3c33
-        /* We've been destroyed or became inactive since call */
1e3c33
-        g_object_unref (view);
1e3c33
-        return;
1e3c33
-    }
1e3c33
-
1e3c33
-    if (targets)
1e3c33
-    {
1e3c33
-        for (i = 0; i < n_targets; i++)
1e3c33
-        {
1e3c33
-            if (targets[i] == nautilus_clipboard_get_atom ())
1e3c33
-            {
1e3c33
-                is_data_copied = TRUE;
1e3c33
-            }
1e3c33
-        }
1e3c33
-    }
1e3c33
-
1e3c33
     action = g_action_map_lookup_action (G_ACTION_MAP (priv->view_action_group),
1e3c33
                                          "paste");
1e3c33
     /* Take into account if the action was previously disabled for other reasons,
1e3c33
      * like the directory not being writabble */
1e3c33
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
1e3c33
-                                 is_data_copied && g_action_get_enabled (action));
1e3c33
+                                 is_data_valid && g_action_get_enabled (action));
1e3c33
 
1e3c33
     action = g_action_map_lookup_action (G_ACTION_MAP (priv->view_action_group),
1e3c33
                                          "paste-into");
1e3c33
 
1e3c33
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
1e3c33
-                                 is_data_copied && g_action_get_enabled (action));
1e3c33
+                                 is_data_valid && g_action_get_enabled (action));
1e3c33
 
1e3c33
     action = g_action_map_lookup_action (G_ACTION_MAP (priv->view_action_group),
1e3c33
                                          "create-link");
1e3c33
 
1e3c33
     g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
1e3c33
-                                 is_data_copied && g_action_get_enabled (action));
1e3c33
+                                 is_data_valid && g_action_get_enabled (action));
1e3c33
+
1e3c33
 
1e3c33
     g_object_unref (view);
1e3c33
 }
1e3c33
@@ -7565,18 +7527,10 @@ real_update_actions_state (NautilusFilesView *view)
1e3c33
                                  !selection_contains_starred &&
1e3c33
                                  priv->templates_present);
1e3c33
 
1e3c33
-    /* Actions that are related to the clipboard need request, request the data
1e3c33
-     * and update them once we have the data */
1e3c33
-    g_object_ref (view);     /* Need to keep the object alive until we get the reply */
1e3c33
-    gtk_clipboard_request_targets (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                   on_clipboard_targets_received,
1e3c33
-                                   view);
1e3c33
-
1e3c33
     g_object_ref (view);     /* Need to keep the object alive until we get the reply */
1e3c33
-    gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                    nautilus_clipboard_get_atom (),
1e3c33
-                                    on_clipboard_contents_received,
1e3c33
-                                    view);
1e3c33
+    gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
+                                on_clipboard_contents_received,
1e3c33
+                                view);
1e3c33
 
1e3c33
     action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
1e3c33
                                          "select-all");
1e3c33
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
1e3c33
index d2ba388..4f65080 100644
1e3c33
--- a/src/nautilus-list-view.c
1e3c33
+++ b/src/nautilus-list-view.c
1e3c33
@@ -3628,9 +3628,9 @@ list_view_scroll_to_file (NautilusFilesView *view,
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
-on_clipboard_contents_received (GtkClipboard     *clipboard,
1e3c33
-                                GtkSelectionData *selection_data,
1e3c33
-                                gpointer          user_data)
1e3c33
+on_clipboard_contents_received (GtkClipboard *clipboard,
1e3c33
+                                const gchar  *selection_data,
1e3c33
+                                gpointer      user_data)
1e3c33
 {
1e3c33
     NautilusListView *view = NAUTILUS_LIST_VIEW (user_data);
1e3c33
 
1e3c33
@@ -3665,10 +3665,9 @@ static void
1e3c33
 update_clipboard_status (NautilusListView *view)
1e3c33
 {
1e3c33
     g_object_ref (view);     /* Need to keep the object alive until we get the reply */
1e3c33
-    gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
-                                    nautilus_clipboard_get_atom (),
1e3c33
-                                    on_clipboard_contents_received,
1e3c33
-                                    view);
1e3c33
+    gtk_clipboard_request_text (nautilus_clipboard_get (GTK_WIDGET (view)),
1e3c33
+                                on_clipboard_contents_received,
1e3c33
+                                view);
1e3c33
 }
1e3c33
 
1e3c33
 static void
1e3c33
--
1e3c33
libgit2 0.26.0
1e3c33