[nautilus/gtk4-preparation-trunk: 56/64] general: Disable Drag-and-drop
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gtk4-preparation-trunk: 56/64] general: Disable Drag-and-drop
- Date: Thu, 23 Dec 2021 02:10:17 +0000 (UTC)
commit 44d5bc9218fe99838e3e5d9f14c7578af679059e
Author: António Fernandes <antoniof gnome org>
Date: Fri Dec 17 15:09:20 2021 +0000
general: Disable Drag-and-drop
GTK 4 changes how DND is implemented compared to GTK 3.
Disable this code before the switch. It shall be reimplemented
once we are building against GTK 4.
src/nautilus-dnd.c | 5 +++++
src/nautilus-dnd.h | 6 +++++-
src/nautilus-files-view-dnd.c | 2 ++
src/nautilus-files-view-dnd.h | 3 ++-
src/nautilus-list-model.c | 4 ++++
src/nautilus-list-view-dnd.c | 2 ++
src/nautilus-list-view-dnd.h | 2 ++
src/nautilus-list-view-private.h | 4 ++++
src/nautilus-list-view.c | 12 ++++++++++++
src/nautilus-location-entry.c | 7 ++++++-
src/nautilus-notebook.c | 2 ++
src/nautilus-pathbar.c | 2 ++
src/nautilus-properties-window.c | 8 ++++++--
src/nautilus-tree-view-drag-dest.c | 2 ++
src/nautilus-tree-view-drag-dest.h | 4 +++-
src/nautilus-window-slot-dnd.c | 2 ++
src/nautilus-window-slot-dnd.h | 4 +++-
src/nautilus-window.c | 4 ++++
src/nautilus-window.h | 2 ++
19 files changed, 70 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-dnd.c b/src/nautilus-dnd.c
index daa785a12..2dcc05283 100644
--- a/src/nautilus-dnd.c
+++ b/src/nautilus-dnd.c
@@ -21,6 +21,8 @@
* Ettore Perazzoli <ettore gnu org>
*/
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
+
#include <config.h>
#include "nautilus-dnd.h"
@@ -397,6 +399,7 @@ source_is_deletable (GFile *file)
NautilusDragInfo *
nautilus_drag_get_source_data (GdkDragContext *context)
{
+ return NULL;
GtkWidget *source_widget;
NautilusDragInfo *source_data;
@@ -988,3 +991,5 @@ nautilus_drag_autoscroll_stop (NautilusDragInfo *drag_info)
drag_info->auto_scroll_timeout_id = 0;
}
}
+
+#endif
diff --git a/src/nautilus-dnd.h b/src/nautilus-dnd.h
index 0bb5e732f..e9342cf39 100644
--- a/src/nautilus-dnd.h
+++ b/src/nautilus-dnd.h
@@ -27,6 +27,8 @@
#include <gtk/gtk.h>
#include "nautilus-file.h"
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
+
#define HOVER_TIMEOUT 500
/* Drag & Drop target names. */
@@ -139,4 +141,6 @@ void nautilus_drag_autoscroll_stop
(NautilusDragInfo *drag_info);
NautilusDragInfo * nautilus_drag_get_source_data (GdkDragContext
*context);
-GList * nautilus_drag_file_list_from_selection_list (const GList
*selection_list);
+GList * nautilus_drag_file_list_from_selection_list (const GList
+ *selection_list);
+#endif
diff --git a/src/nautilus-files-view-dnd.c b/src/nautilus-files-view-dnd.c
index 9c803b54d..fbb0e2ee7 100644
--- a/src/nautilus-files-view-dnd.c
+++ b/src/nautilus-files-view-dnd.c
@@ -23,6 +23,7 @@
* Pavel Cisler <pavel eazel com>
*/
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <config.h>
#include "nautilus-files-view-dnd.h"
@@ -407,3 +408,4 @@ nautilus_files_view_handle_hover (NautilusFilesView *view,
g_object_unref (location);
nautilus_file_unref (target_file);
}
+#endif
diff --git a/src/nautilus-files-view-dnd.h b/src/nautilus-files-view-dnd.h
index 73b9263a7..7cfdb53b0 100644
--- a/src/nautilus-files-view-dnd.h
+++ b/src/nautilus-files-view-dnd.h
@@ -25,7 +25,7 @@
*/
#pragma once
-
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include "nautilus-files-view.h"
void nautilus_files_view_handle_uri_list_drop (NautilusFilesView *view,
@@ -53,3 +53,4 @@ void nautilus_files_view_drop_proxy_received_uris (NautilusFilesView *view,
const GList *uris,
const char *target_location,
GdkDragAction action);
+#endif
diff --git a/src/nautilus-list-model.c b/src/nautilus-list-model.c
index ebafcebf8..e828ab5b5 100644
--- a/src/nautilus-list-model.c
+++ b/src/nautilus-list-model.c
@@ -105,11 +105,13 @@ G_DEFINE_TYPE_WITH_CODE (NautilusListModel, nautilus_list_model, G_TYPE_OBJECT,
nautilus_list_model_sortable_init)
G_ADD_PRIVATE (NautilusListModel));
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
static const GtkTargetEntry drag_types [] =
{
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
};
+#endif
static void
file_entry_free (FileEntry *file_entry)
@@ -1625,6 +1627,7 @@ nautilus_list_model_get_drag_view (NautilusListModel *model,
return priv->drag_view;
}
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
GtkTargetList *
nautilus_list_model_get_drag_target_list ()
{
@@ -1635,6 +1638,7 @@ nautilus_list_model_get_drag_target_list ()
return target_list;
}
+#endif
int
nautilus_list_model_add_column (NautilusListModel *model,
diff --git a/src/nautilus-list-view-dnd.c b/src/nautilus-list-view-dnd.c
index 21910060f..9941642bd 100644
--- a/src/nautilus-list-view-dnd.c
+++ b/src/nautilus-list-view-dnd.c
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <config.h>
#include "nautilus-list-view-dnd.h"
@@ -303,3 +304,4 @@ nautilus_list_view_dnd_drag_begin (NautilusListView *list_view,
-1);
}
}
+#endif
diff --git a/src/nautilus-list-view-dnd.h b/src/nautilus-list-view-dnd.h
index 03e102ed3..97a7d2112 100644
--- a/src/nautilus-list-view-dnd.h
+++ b/src/nautilus-list-view-dnd.h
@@ -17,6 +17,7 @@
*/
#pragma once
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <gdk/gdk.h>
@@ -32,3 +33,4 @@ void nautilus_list_view_dnd_drag_begin (NautilusListView *list_view,
NautilusDragInfo *
nautilus_list_view_dnd_get_drag_source_data (NautilusListView *list_view,
GdkDragContext *context);
+#endif
diff --git a/src/nautilus-list-view-private.h b/src/nautilus-list-view-private.h
index 5f890e488..3d8d201ca 100644
--- a/src/nautilus-list-view-private.h
+++ b/src/nautilus-list-view-private.h
@@ -38,7 +38,9 @@ struct NautilusListViewDetails {
NautilusListZoomLevel zoom_level;
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
NautilusTreeViewDragDest *drag_dest;
+#endif
GtkTreePath *first_click_path; /* Both clicks in a double click need to be on the same row */
@@ -56,7 +58,9 @@ struct NautilusListViewDetails {
gboolean drag_started;
gboolean row_selected_on_button_down;
gboolean active;
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
NautilusDragInfo *drag_source_info;
+#endif
GHashTable *columns;
GtkWidget *column_editor;
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 202f0996c..67cf493ed 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1202,6 +1202,7 @@ sort_column_changed_callback (GtkTreeSortable *sortable,
view->details->last_sort_attr = sort_attr;
}
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
static char *
get_root_uri_callback (NautilusTreeViewDragDest *dest,
gpointer user_data)
@@ -1286,6 +1287,7 @@ move_copy_items_callback (NautilusTreeViewDragDest *dest,
target_uri,
action);
}
+#endif
static void
column_header_menu_toggled (GtkCheckButton *menu_item,
@@ -2016,7 +2018,9 @@ on_tree_view_drag_gesture_drag_begin (GtkGestureDrag *gesture,
gdouble start_y,
gpointer user_data)
{
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
nautilus_list_view_dnd_init (NAUTILUS_LIST_VIEW (user_data));
+#endif
}
static void
@@ -2025,6 +2029,7 @@ on_tree_view_drag_gesture_drag_update (GtkGestureDrag *gesture,
gdouble offset_y,
gpointer user_data)
{
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
GdkEventSequence *sequence;
const GdkEvent *event;
NautilusListView *list_view;
@@ -2034,6 +2039,7 @@ on_tree_view_drag_gesture_drag_update (GtkGestureDrag *gesture,
list_view = NAUTILUS_LIST_VIEW (user_data);
nautilus_list_view_dnd_drag_begin (list_view, offset_x, offset_y, event);
+#endif
}
static void
@@ -2068,8 +2074,10 @@ create_and_set_up_tree_view (NautilusListView *view)
NULL);
gtk_tree_view_set_enable_search (view->details->tree_view, FALSE);
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
view->details->drag_dest =
nautilus_tree_view_drag_dest_new (view->details->tree_view);
+#endif
/* Stop the tree view from performing select-all actions.
* It is desireable that the action is disabled while directory
@@ -2078,6 +2086,7 @@ create_and_set_up_tree_view (NautilusListView *view)
g_signal_connect (view->details->tree_view, "select-all",
G_CALLBACK (g_signal_stop_emission_by_name), "select-all");
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
g_signal_connect_object (view->details->drag_dest,
"get-root-uri",
G_CALLBACK (get_root_uri_callback),
@@ -2098,6 +2107,7 @@ create_and_set_up_tree_view (NautilusListView *view)
G_CALLBACK (list_view_handle_raw), view, 0);
g_signal_connect_object (view->details->drag_dest, "handle-hover",
G_CALLBACK (list_view_handle_hover), view, 0);
+#endif
g_signal_connect_object (gtk_tree_view_get_selection (view->details->tree_view),
"changed",
@@ -3618,11 +3628,13 @@ nautilus_list_view_dispose (GObject *object)
list_view->details->model = NULL;
}
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
if (list_view->details->drag_dest)
{
g_object_unref (list_view->details->drag_dest);
list_view->details->drag_dest = NULL;
}
+#endif
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
g_signal_handlers_disconnect_by_func (clipboard, on_clipboard_owner_changed, list_view);
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 75c925d59..b8a0fd689 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <string.h>
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#define NAUTILUS_DND_URI_LIST_TYPE "text/uri-list"
#define NAUTILUS_DND_TEXT_PLAIN_TYPE "text/plain"
@@ -59,6 +60,7 @@ static const GtkTargetEntry drop_types [] =
{ NAUTILUS_DND_URI_LIST_TYPE, 0, NAUTILUS_DND_URI_LIST },
{ NAUTILUS_DND_TEXT_PLAIN_TYPE, 0, NAUTILUS_DND_TEXT_PLAIN },
};
+#endif
typedef struct _NautilusLocationEntryPrivate
{
@@ -228,6 +230,7 @@ nautilus_location_entry_set_location (NautilusLocationEntry *entry,
g_free (formatted_uri);
}
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
static void
drag_data_received_callback (GtkWidget *widget,
GdkDragContext *context,
@@ -357,7 +360,7 @@ drag_data_get_callback (GtkWidget *widget,
g_free (uri);
g_object_unref (location);
}
-
+#endif
static void
set_prefix_dimming (GtkCellRenderer *completion_cell,
@@ -897,6 +900,7 @@ nautilus_location_entry_init (NautilusLocationEntry *entry)
g_signal_connect (priv->completer, "got-completion-data",
G_CALLBACK (got_completion_data_callback), entry);
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
/* Drag source */
g_signal_connect_object (entry, "drag-data-get",
G_CALLBACK (drag_data_get_callback), entry, 0);
@@ -908,6 +912,7 @@ nautilus_location_entry_init (NautilusLocationEntry *entry)
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
g_signal_connect (entry, "drag-data-received",
G_CALLBACK (drag_data_received_callback), NULL);
+#endif
g_signal_connect_object (entry, "activate",
G_CALLBACK (editable_activate_callback), entry, G_CONNECT_AFTER);
diff --git a/src/nautilus-notebook.c b/src/nautilus-notebook.c
index e8e93943f..d71e2f331 100644
--- a/src/nautilus-notebook.c
+++ b/src/nautilus-notebook.c
@@ -281,7 +281,9 @@ build_tab_label (GtkNotebook *notebook,
gtk_widget_show (close_button);
g_object_set_data (G_OBJECT (box), "nautilus-notebook-tab", GINT_TO_POINTER (1));
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
nautilus_drag_slot_proxy_init (box, NULL, slot);
+#endif
g_object_set_data (G_OBJECT (box), "label", label);
g_object_set_data (G_OBJECT (box), "spinner", spinner);
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 53d191234..dd443cf67 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -1196,7 +1196,9 @@ make_button_data (NautilusPathBar *self,
g_signal_connect (button_data->multi_press_gesture, "pressed",
G_CALLBACK (on_multi_press_gesture_pressed), button_data);
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
nautilus_drag_slot_proxy_init (button_data->button, button_data->file, NULL);
+#endif
g_object_unref (path);
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 9ae34ccda..265874e58 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -466,6 +466,7 @@ update_properties_window_icon (NautilusPropertiesWindow *self)
gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon_button_image), pixbuf);
}
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
/* utility to test if a uri refers to a local image */
static gboolean
uri_is_local_image (const char *uri)
@@ -488,7 +489,7 @@ uri_is_local_image (const char *uri)
return TRUE;
}
-
+#endif
static void
reset_icon (NautilusPropertiesWindow *self)
@@ -507,7 +508,7 @@ reset_icon (NautilusPropertiesWindow *self)
}
}
-
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
static void
nautilus_properties_window_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
@@ -564,6 +565,7 @@ nautilus_properties_window_drag_data_received (GtkWidget *widget,
}
}
}
+#endif
static void
setup_image_widget (NautilusPropertiesWindow *self,
@@ -579,8 +581,10 @@ setup_image_widget (NautilusPropertiesWindow *self,
target_table, G_N_ELEMENTS (target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE);
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
g_signal_connect (self->icon_button_image, "drag-data-received",
G_CALLBACK (nautilus_properties_window_drag_data_received), NULL);
+#endif
g_signal_connect (self->icon_button, "clicked",
G_CALLBACK (select_image_button_callback), self);
gtk_stack_set_visible_child (self->icon_stack, self->icon_button);
diff --git a/src/nautilus-tree-view-drag-dest.c b/src/nautilus-tree-view-drag-dest.c
index cd87f187f..ffe897480 100644
--- a/src/nautilus-tree-view-drag-dest.c
+++ b/src/nautilus-tree-view-drag-dest.c
@@ -24,6 +24,7 @@
* contain a hierarchy of files
*/
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <config.h>
#include "nautilus-tree-view-drag-dest.h"
@@ -1301,3 +1302,4 @@ nautilus_tree_view_drag_dest_new (GtkTreeView *tree_view)
return dest;
}
+#endif
diff --git a/src/nautilus-tree-view-drag-dest.h b/src/nautilus-tree-view-drag-dest.h
index b2134c681..288eec348 100644
--- a/src/nautilus-tree-view-drag-dest.h
+++ b/src/nautilus-tree-view-drag-dest.h
@@ -26,6 +26,7 @@
#pragma once
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <gtk/gtk.h>
#include "nautilus-file.h"
@@ -93,4 +94,5 @@ struct _NautilusTreeViewDragDestClass {
GType nautilus_tree_view_drag_dest_get_type (void);
NautilusTreeViewDragDest *nautilus_tree_view_drag_dest_new (GtkTreeView *tree_view);
-G_END_DECLS
\ No newline at end of file
+G_END_DECLS
+#endif
diff --git a/src/nautilus-window-slot-dnd.c b/src/nautilus-window-slot-dnd.c
index e0b79308d..254084cb1 100644
--- a/src/nautilus-window-slot-dnd.c
+++ b/src/nautilus-window-slot-dnd.c
@@ -23,6 +23,7 @@
* Ettore Perazzoli <ettore gnu org>
*/
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <config.h>
#include "nautilus-notebook.h"
@@ -559,3 +560,4 @@ nautilus_drag_slot_proxy_init (GtkWidget *widget,
G_CALLBACK (slot_proxy_drag_leave),
drag_info);
}
+#endif
diff --git a/src/nautilus-window-slot-dnd.h b/src/nautilus-window-slot-dnd.h
index 2b7b05f37..0988dffb2 100644
--- a/src/nautilus-window-slot-dnd.h
+++ b/src/nautilus-window-slot-dnd.h
@@ -25,6 +25,7 @@
#pragma once
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
#include <gio/gio.h>
#include <gtk/gtk.h>
@@ -34,4 +35,5 @@
void nautilus_drag_slot_proxy_init (GtkWidget *widget,
NautilusFile *target_file,
- NautilusWindowSlot *target_slot);
\ No newline at end of file
+ NautilusWindowSlot *target_slot);
+#endif
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index a178bcbcb..8136186c4 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -966,6 +966,7 @@ places_sidebar_show_starred_location (NautilusWindow *window,
g_object_unref (location);
}
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
static GList *
build_selection_list_from_gfile_list (GList *gfile_list)
{
@@ -1105,6 +1106,7 @@ places_sidebar_drag_perform_drop_cb (NautilusGtkPlacesSidebar *sidebar,
g_free (dest_uri);
g_list_free_full (source_uri_list, g_free);
}
+#endif
/* Callback used in the "empty trash" menu item from the places sidebar */
static void
@@ -1335,12 +1337,14 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
G_CALLBACK (open_location_cb), window);
g_signal_connect (window->places_sidebar, "show-error-message",
G_CALLBACK (places_sidebar_show_error_message_cb), window);
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
g_signal_connect (window->places_sidebar, "drag-action-requested",
G_CALLBACK (places_sidebar_drag_action_requested_cb), window);
g_signal_connect (window->places_sidebar, "drag-action-ask",
G_CALLBACK (places_sidebar_drag_action_ask_cb), window);
g_signal_connect (window->places_sidebar, "drag-perform-drop",
G_CALLBACK (places_sidebar_drag_perform_drop_cb), window);
+#endif
g_signal_connect (window->places_sidebar, "populate-popup",
G_CALLBACK (places_sidebar_populate_popup_cb), window);
g_signal_connect (window->places_sidebar, "unmount",
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index ad721a8bc..af38441f1 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -97,10 +97,12 @@ void nautilus_window_sync_title (NautilusWindow *window,
void nautilus_window_show_operation_notification (NautilusWindow *window,
gchar *main_label,
GFile *folder_to_open);
+#if 0 && NAUTILUS_DND_NEEDS_GTK4_REIMPLEMENTATION
void nautilus_window_start_dnd (NautilusWindow *window,
GdkDragContext *context);
void nautilus_window_end_dnd (NautilusWindow *window,
GdkDragContext *context);
+#endif
void nautilus_window_search (NautilusWindow *window,
NautilusQuery *query);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]