[gtk/dnd-gestures-2: 46/63] testlist3: Convert to GtkDropTarget
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/dnd-gestures-2: 46/63] testlist3: Convert to GtkDropTarget
- Date: Sat, 4 Jan 2020 03:15:02 +0000 (UTC)
commit 1489b87f2a7dbe91984d53a296b449ddba6d4df6
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jan 2 08:21:49 2020 -0500
testlist3: Convert to GtkDropTarget
tests/testlist3.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/tests/testlist3.c b/tests/testlist3.c
index 8c9036e853..d1d3563873 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -24,18 +24,15 @@ drag_begin (GtkDragSource *source,
}
static void
-drag_data_received (GtkWidget *widget,
- GdkDrop *drop,
+drag_data_received (GtkDropTarget *dest,
GtkSelectionData *selection_data,
gpointer data)
{
- GtkWidget *target;
+ GtkWidget *target = data;
GtkWidget *row;
GtkWidget *source;
int pos;
- target = widget;
-
pos = gtk_list_box_row_get_index (GTK_LIST_BOX_ROW (target));
row = (gpointer)* (gpointer*)gtk_selection_data_get_data (selection_data);
source = gtk_widget_get_ancestor (row, GTK_TYPE_LIST_BOX_ROW);
@@ -57,6 +54,7 @@ create_row (const gchar *text)
GdkContentProvider *content;
GdkContentFormats *targets;
GtkDragSource *source;
+ GtkDropTarget *dest;
row = gtk_list_box_row_new ();
image = gtk_image_new_from_icon_name ("open-menu-symbolic");
@@ -75,9 +73,9 @@ create_row (const gchar *text)
gtk_drag_source_attach (source, image, GDK_BUTTON1_MASK);
targets = gdk_content_formats_new (entries, 1);
-
- gtk_drag_dest_set (row, GTK_DEST_DEFAULT_ALL, targets, GDK_ACTION_MOVE);
- g_signal_connect (row, "drag-data-received", G_CALLBACK (drag_data_received), NULL);
+ dest = gtk_drop_target_new (GTK_DEST_DEFAULT_ALL, targets, GDK_ACTION_MOVE);
+ g_signal_connect (dest, "drag-data-received", G_CALLBACK (drag_data_received), row);
+ gtk_drop_target_attach (dest, row);
gdk_content_formats_unref (targets);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]