[nautilus/wip/antoniof/gtk4-restore-clipboard: 84/89] clipboard: Drop now unnecessary code
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-restore-clipboard: 84/89] clipboard: Drop now unnecessary code
- Date: Sun, 27 Mar 2022 02:12:50 +0000 (UTC)
commit 3448fb5c571aa059fd21029ee1427c07a2d4b856
Author: António Fernandes <antoniof gnome org>
Date: Tue Jan 4 00:15:44 2022 +0000
clipboard: Drop now unnecessary code
Before porting to GdkClipboard, and in order to get a clean diff,
let's start by removing functions definitions which deal with the
old GtkClipboard API and nothing specific with our custom content,
as well as wrapper to get clipboard from a widget, which now is
provided directly by GTK.
src/nautilus-clipboard.c | 77 ++----------------------------------------------
src/nautilus-clipboard.h | 1 -
src/nautilus-list-view.c | 2 +-
3 files changed, 3 insertions(+), 77 deletions(-)
---
diff --git a/src/nautilus-clipboard.c b/src/nautilus-clipboard.c
index 8dee3e6dc..822737cd7 100644
--- a/src/nautilus-clipboard.c
+++ b/src/nautilus-clipboard.c
@@ -34,8 +34,6 @@
#include <gtk/gtk.h>
#include <string.h>
-static GdkAtom copied_files_atom;
-
typedef struct
{
gboolean cut;
@@ -164,13 +162,6 @@ nautilus_clipboard_get_uri_list_from_selection_data (GtkSelectionData *selection
return items;
}
-GtkClipboard *
-nautilus_clipboard_get (GtkWidget *widget)
-{
- return gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (widget)),
- GDK_SELECTION_CLIPBOARD);
-}
-
void
nautilus_clipboard_clear_if_colliding_uris (GtkWidget *widget,
const GList *item_uris)
@@ -180,7 +171,7 @@ nautilus_clipboard_clear_if_colliding_uris (GtkWidget *widget,
gboolean collision;
collision = FALSE;
- data = gtk_clipboard_wait_for_contents (nautilus_clipboard_get (widget),
+ data = gtk_clipboard_wait_for_contents (gtk_widget_get_clipboard (widget),
copied_files_atom);
if (data == NULL)
{
@@ -201,7 +192,7 @@ nautilus_clipboard_clear_if_colliding_uris (GtkWidget *widget,
if (collision)
{
- gtk_clipboard_clear (nautilus_clipboard_get (widget));
+ gtk_clipboard_clear (gtk_widget_get_clipboard (widget));
}
if (clipboard_item_uris)
@@ -225,70 +216,6 @@ nautilus_clipboard_is_cut_from_selection_data (GtkSelectionData *selection_data)
return is_cut_from_selection_data;
}
-static void
-on_get_clipboard (GtkClipboard *clipboard,
- GtkSelectionData *selection_data,
- guint info,
- gpointer user_data)
-{
- char **uris;
- GList *l;
- int i;
- ClipboardInfo *clipboard_info;
- GdkAtom target;
-
- clipboard_info = (ClipboardInfo *) user_data;
-
- target = gtk_selection_data_get_target (selection_data);
-
- if (gtk_targets_include_uri (&target, 1))
- {
- uris = g_malloc ((g_list_length (clipboard_info->files) + 1) * sizeof (char *));
- i = 0;
-
- for (l = clipboard_info->files; l != NULL; l = l->next)
- {
- uris[i] = nautilus_file_get_uri (l->data);
- i++;
- }
-
- uris[i] = NULL;
-
- gtk_selection_data_set_uris (selection_data, uris);
-
- g_strfreev (uris);
- }
- else if (gtk_targets_include_text (&target, 1))
- {
- char *str;
- gsize len;
-
- str = convert_file_list_to_string (clipboard_info, TRUE, &len);
- gtk_selection_data_set_text (selection_data, str, len);
- g_free (str);
- }
- else if (target == copied_files_atom)
- {
- char *str;
- gsize len;
-
- str = convert_file_list_to_string (clipboard_info, FALSE, &len);
- gtk_selection_data_set (selection_data, copied_files_atom, 8, (guchar *) str, len);
- g_free (str);
- }
-}
-
-static void
-on_clear_clipboard (GtkClipboard *clipboard,
- gpointer user_data)
-{
- ClipboardInfo *clipboard_info = (ClipboardInfo *) user_data;
-
- nautilus_file_list_free (clipboard_info->files);
-
- g_free (clipboard_info);
-}
-
void
nautilus_clipboard_prepare_for_files (GtkClipboard *clipboard,
GList *files,
diff --git a/src/nautilus-clipboard.h b/src/nautilus-clipboard.h
index c46bcabaf..c0b950ced 100644
--- a/src/nautilus-clipboard.h
+++ b/src/nautilus-clipboard.h
@@ -27,7 +27,6 @@
void nautilus_clipboard_clear_if_colliding_uris (GtkWidget *widget,
const GList *item_uris);
-GtkClipboard* nautilus_clipboard_get (GtkWidget *widget);
GList* nautilus_clipboard_get_uri_list_from_selection_data (GtkSelectionData *selection_data);
gboolean nautilus_clipboard_is_cut_from_selection_data (GtkSelectionData *selection_data);
void nautilus_clipboard_prepare_for_files (GtkClipboard *clipboard,
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 5c6d66771..aaf6fce91 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -3734,7 +3734,7 @@ static void
update_clipboard_status (NautilusListView *view)
{
g_object_ref (view); /* Need to keep the object alive until we get the reply */
- gtk_clipboard_request_contents (nautilus_clipboard_get (GTK_WIDGET (view)),
+ gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (view)),
nautilus_clipboard_get_atom (),
on_clipboard_contents_received,
view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]