[nautilus/wip/antoniof/gtk4-pre-switch-regressions: 2/7] general: Disable clipboard




commit 7a493156d8d54e1feabbf91062d4db7db6082eb3
Author: António Fernandes <antoniof gnome org>
Date:   Fri Dec 17 15:29:46 2021 +0000

    general: Disable clipboard
    
    GTK 4 changes how clipboard is interacted with, compared to GTK 3.
    
    Disable this code before the switch. It shall be reimplemented
    once we are building against GTK 4.

 src/nautilus-canvas-view.c | 16 ++++++++++++++++
 src/nautilus-clipboard.c   |  2 ++
 src/nautilus-clipboard.h   |  2 ++
 src/nautilus-files-view.c  | 32 ++++++++++++++++++++++++++++++++
 src/nautilus-list-view.c   | 14 ++++++++++++++
 5 files changed, 66 insertions(+)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 8c3da7fda..a77ba1142 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -197,15 +197,19 @@ static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortTyp
                                                              gboolean             reversed);
 static const SortCriterion *get_default_sort_order (NautilusFile *file);
 static void                 nautilus_canvas_view_clear (NautilusFilesView *view);
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void on_clipboard_owner_changed (GtkClipboard *clipboard,
                                         GdkEvent     *event,
                                         gpointer      user_data);
+#endif
 
 static void
 nautilus_canvas_view_destroy (GtkWidget *object)
 {
     NautilusCanvasView *canvas_view;
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
+#endif
 
     canvas_view = NAUTILUS_CANVAS_VIEW (object);
 
@@ -217,10 +221,12 @@ nautilus_canvas_view_destroy (GtkWidget *object)
         canvas_view->react_to_canvas_change_idle_id = 0;
     }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
     g_signal_handlers_disconnect_by_func (clipboard,
                                           on_clipboard_owner_changed,
                                           canvas_view);
+#endif
 
     if (canvas_view->icons_not_positioned)
     {
@@ -540,6 +546,7 @@ nautilus_canvas_view_begin_loading (NautilusFilesView *view)
     nautilus_files_view_update_toolbar_menus (view);
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void
 on_clipboard_contents_received (GtkClipboard     *clipboard,
                                 GtkSelectionData *selection_data,
@@ -595,15 +602,18 @@ on_clipboard_owner_changed (GtkClipboard *clipboard,
 {
     update_clipboard_status (NAUTILUS_CANVAS_VIEW (user_data));
 }
+#endif
 
 static void
 nautilus_canvas_view_end_loading (NautilusFilesView *view,
                                   gboolean           all_files_seen)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     NautilusCanvasView *canvas_view;
 
     canvas_view = NAUTILUS_CANVAS_VIEW (view);
     update_clipboard_status (canvas_view);
+#endif
 }
 
 static NautilusCanvasZoomLevel
@@ -1317,8 +1327,10 @@ canvas_view_move_copy_items (NautilusCanvasContainer *container,
                              int                      copy_action,
                              NautilusFilesView       *view)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     nautilus_clipboard_clear_if_colliding_uris (GTK_WIDGET (view),
                                                 item_uris);
+#endif
     nautilus_files_view_move_copy_items (view, item_uris, target_dir,
                                          copy_action);
 }
@@ -1610,7 +1622,9 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
 {
     NautilusCanvasContainer *canvas_container;
     GActionGroup *view_action_group;
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
+#endif
 
     canvas_view->sort = &sort_criteria[0];
     canvas_view->destroyed = FALSE;
@@ -1647,10 +1661,12 @@ nautilus_canvas_view_init (NautilusCanvasView *canvas_view)
     g_signal_connect_object (canvas_container, "handle-hover",
                              G_CALLBACK (canvas_view_handle_hover), canvas_view, 0);
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     /* React to clipboard changes */
     clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
     g_signal_connect (clipboard, "owner-change",
                       G_CALLBACK (on_clipboard_owner_changed), canvas_view);
+#endif
 
     view_action_group = nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (canvas_view));
     g_action_map_add_action_entries (G_ACTION_MAP (view_action_group),
diff --git a/src/nautilus-clipboard.c b/src/nautilus-clipboard.c
index 02bf05497..8dee3e6dc 100644
--- a/src/nautilus-clipboard.c
+++ b/src/nautilus-clipboard.c
@@ -24,6 +24,7 @@
  *          Darin Adler <darin bentspoon com>
  */
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 #include <config.h>
 #include "nautilus-clipboard.h"
 #include "nautilus-file-utilities.h"
@@ -327,3 +328,4 @@ nautilus_clipboard_get_atom (void)
 
     return copied_files_atom;
 }
+#endif
diff --git a/src/nautilus-clipboard.h b/src/nautilus-clipboard.h
index 1dd26d7c2..c46bcabaf 100644
--- a/src/nautilus-clipboard.h
+++ b/src/nautilus-clipboard.h
@@ -21,6 +21,7 @@
  */
 
 #pragma once
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 
 #include <gtk/gtk.h>
 
@@ -33,3 +34,4 @@ void nautilus_clipboard_prepare_for_files (GtkClipboard *clipboard,
                                            GList        *files,
                                            gboolean      cut);
 GdkAtom nautilus_clipboard_get_atom (void);
+#endif
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index dfb7fb26c..988df6d6f 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -320,9 +320,11 @@ static void     trash_or_delete_files (GtkWindow         *parent_window,
                                        NautilusFilesView *view);
 static void     load_directory (NautilusFilesView *view,
                                 NautilusDirectory *directory);
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void on_clipboard_owner_changed (GtkClipboard *clipboard,
                                         GdkEvent     *event,
                                         gpointer      user_data);
+#endif
 static void     open_one_in_new_window (gpointer data,
                                         gpointer callback_data);
 static void     schedule_update_context_menus (NautilusFilesView *view);
@@ -2645,6 +2647,7 @@ action_open_item_new_window (GSimpleAction *action,
     nautilus_file_list_free (selection);
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void
 handle_clipboard_data (NautilusFilesView *view,
                        GtkSelectionData  *selection_data,
@@ -2712,10 +2715,12 @@ paste_clipboard_received_callback (GtkClipboard     *clipboard,
 
     g_object_unref (view);
 }
+#endif
 
 static void
 paste_files (NautilusFilesView *view)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
 
     clipboard = nautilus_clipboard_get (GTK_WIDGET (view));
@@ -2728,6 +2733,7 @@ paste_files (NautilusFilesView *view)
                                     nautilus_clipboard_get_atom (),
                                     paste_clipboard_received_callback,
                                     view);
+#endif
 }
 
 static void
@@ -2764,6 +2770,7 @@ action_paste_files_accel (GSimpleAction *action,
     }
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void
 create_links_clipboard_received_callback (GtkClipboard     *clipboard,
                                           GtkSelectionData *selection_data,
@@ -2787,12 +2794,14 @@ create_links_clipboard_received_callback (GtkClipboard     *clipboard,
 
     g_object_unref (view);
 }
+#endif
 
 static void
 action_create_links (GSimpleAction *action,
                      GVariant      *state,
                      gpointer       user_data)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     NautilusFilesView *view;
 
     g_assert (NAUTILUS_IS_FILES_VIEW (user_data));
@@ -2804,6 +2813,7 @@ action_create_links (GSimpleAction *action,
                                     nautilus_clipboard_get_atom (),
                                     create_links_clipboard_received_callback,
                                     view);
+#endif
 }
 
 static void
@@ -3210,7 +3220,9 @@ nautilus_files_view_dispose (GObject *object)
 {
     NautilusFilesView *view;
     NautilusFilesViewPrivate *priv;
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
+#endif
     GList *node, *next;
 
     view = NAUTILUS_FILES_VIEW (object);
@@ -3291,8 +3303,10 @@ nautilus_files_view_dispose (GObject *object)
     g_signal_handlers_disconnect_by_func (nautilus_trash_monitor_get (),
                                           nautilus_files_view_trash_state_changed_callback, view);
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
     g_signal_handlers_disconnect_by_func (clipboard, on_clipboard_owner_changed, view);
+#endif
 
     nautilus_file_unref (priv->directory_as_file);
     priv->directory_as_file = NULL;
@@ -6083,6 +6097,7 @@ action_copy (GSimpleAction *action,
              GVariant      *state,
              gpointer       user_data)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     NautilusFilesView *view;
     GtkClipboard *clipboard;
     GList *selection;
@@ -6094,6 +6109,7 @@ action_copy (GSimpleAction *action,
     nautilus_clipboard_prepare_for_files (clipboard, selection, FALSE);
 
     nautilus_file_list_free (selection);
+#endif
 }
 
 static void
@@ -6101,6 +6117,7 @@ action_cut (GSimpleAction *action,
             GVariant      *state,
             gpointer       user_data)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     NautilusFilesView *view;
     GList *selection;
     GtkClipboard *clipboard;
@@ -6112,6 +6129,7 @@ action_cut (GSimpleAction *action,
     nautilus_clipboard_prepare_for_files (clipboard, selection, TRUE);
 
     nautilus_file_list_free (selection);
+#endif
 }
 
 static void
@@ -6167,6 +6185,7 @@ action_move_to (GSimpleAction *action,
     copy_or_move_selection (view, TRUE);
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 typedef struct
 {
     NautilusFilesView *view;
@@ -6221,12 +6240,14 @@ paste_into (NautilusFilesView *view,
                                     paste_into_clipboard_received_callback,
                                     data);
 }
+#endif
 
 static void
 action_paste_files_into (GSimpleAction *action,
                          GVariant      *state,
                          gpointer       user_data)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     NautilusFilesView *view;
     g_autolist (NautilusFile) selection = NULL;
 
@@ -6236,6 +6257,7 @@ action_paste_files_into (GSimpleAction *action,
     {
         paste_into (view, NAUTILUS_FILE (selection->data));
     }
+#endif
 }
 
 static void
@@ -7241,6 +7263,7 @@ can_paste_into_file (NautilusFile *file)
     return FALSE;
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void
 on_clipboard_contents_received (GtkClipboard     *clipboard,
                                 GtkSelectionData *selection_data,
@@ -7340,6 +7363,7 @@ on_clipboard_targets_received (GtkClipboard *clipboard,
 
     g_object_unref (view);
 }
+#endif
 
 static void
 file_should_show_foreach (NautilusFile        *file,
@@ -7440,6 +7464,7 @@ can_restore_from_trash (GList *files)
     return can_restore;
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void
 on_clipboard_owner_changed (GtkClipboard *clipboard,
                             GdkEvent     *event,
@@ -7450,6 +7475,7 @@ on_clipboard_owner_changed (GtkClipboard *clipboard,
     /* Update paste menu item */
     nautilus_files_view_update_context_menus (self);
 }
+#endif
 
 static gboolean
 can_delete_all (GList *files)
@@ -7891,6 +7917,7 @@ real_update_actions_state (NautilusFilesView *view)
                                  !selection_contains_starred &&
                                  priv->templates_menu != NULL);
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     /* Actions that are related to the clipboard need request, request the data
      * and update them once we have the data */
     g_object_ref (view);     /* Need to keep the object alive until we get the reply */
@@ -7903,6 +7930,7 @@ real_update_actions_state (NautilusFilesView *view)
                                     nautilus_clipboard_get_atom (),
                                     on_clipboard_contents_received,
                                     view);
+#endif
 
     action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
                                          "select-all");
@@ -9727,7 +9755,9 @@ nautilus_files_view_init (NautilusFilesView *view)
     NautilusDirectory *scripts_directory;
     NautilusDirectory *templates_directory;
     gchar *templates_uri;
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
+#endif
     GApplication *app;
     const gchar *open_accels[] =
     {
@@ -9925,10 +9955,12 @@ nautilus_files_view_init (NautilusFilesView *view)
     g_signal_connect_object (nautilus_trash_monitor_get (), "trash-state-changed",
                              G_CALLBACK (nautilus_files_view_trash_state_changed_callback), view, 0);
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     /* React to clipboard changes */
     clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
     g_signal_connect (clipboard, "owner-change",
                       G_CALLBACK (on_clipboard_owner_changed), view);
+#endif
 
     /* Register to menu provider extension signal managing menu updates */
     g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed",
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index c31985fd7..3ff2c953a 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -95,9 +95,11 @@ static char **get_visible_columns (NautilusListView *list_view);
 static char **get_default_visible_columns (NautilusListView *list_view);
 static char **get_column_order (NautilusListView *list_view);
 static char **get_default_column_order (NautilusListView *list_view);
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void on_clipboard_owner_changed (GtkClipboard *clipboard,
                                         GdkEvent     *event,
                                         gpointer      user_data);
+#endif
 static void popup_column_header_menu (NautilusListView *list_view,
                                       gdouble           x,
                                       gdouble           y);
@@ -3558,7 +3560,9 @@ static void
 nautilus_list_view_dispose (GObject *object)
 {
     NautilusListView *list_view;
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
+#endif
 
     list_view = NAUTILUS_LIST_VIEW (object);
 
@@ -3576,8 +3580,10 @@ nautilus_list_view_dispose (GObject *object)
     }
 #endif
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
     g_signal_handlers_disconnect_by_func (clipboard, on_clipboard_owner_changed, list_view);
+#endif
     g_signal_handlers_disconnect_by_func (nautilus_preferences,
                                           default_sort_order_changed_callback,
                                           list_view);
@@ -3722,6 +3728,7 @@ list_view_scroll_to_file (NautilusFilesView *view,
     }
 }
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
 static void
 on_clipboard_contents_received (GtkClipboard     *clipboard,
                                 GtkSelectionData *selection_data,
@@ -3773,12 +3780,15 @@ on_clipboard_owner_changed (GtkClipboard *clipboard,
 {
     update_clipboard_status (NAUTILUS_LIST_VIEW (user_data));
 }
+#endif
 
 static void
 nautilus_list_view_end_loading (NautilusFilesView *view,
                                 gboolean           all_files_seen)
 {
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     update_clipboard_status (NAUTILUS_LIST_VIEW (view));
+#endif
 }
 
 static guint
@@ -4000,7 +4010,9 @@ static void
 nautilus_list_view_init (NautilusListView *list_view)
 {
     GActionGroup *view_action_group;
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     GtkClipboard *clipboard;
+#endif
 
     list_view->details = g_new0 (NautilusListViewDetails, 1);
 
@@ -4029,10 +4041,12 @@ nautilus_list_view_init (NautilusListView *list_view)
                               G_CALLBACK (default_column_order_changed_callback),
                               list_view);
 
+#if 0 && NAUTILUS_CLIPBOARD_NEEDS_GTK4_REIMPLEMENTATION
     /* React to clipboard changes */
     clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
     g_signal_connect (clipboard, "owner-change",
                       G_CALLBACK (on_clipboard_owner_changed), list_view);
+#endif
 
     nautilus_list_view_click_policy_changed (NAUTILUS_FILES_VIEW (list_view));
 


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