diff options
author | Benjamin Otte <otte@redhat.com> | 2020-02-18 01:41:42 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-02-18 02:40:00 +0100 |
commit | b8cf7ea1c6ee97c3ad1a95717d62bcfe33786116 (patch) | |
tree | 109746158e14bbb59256ce98b21963847ca91b87 /gtk/gtkliststore.c | |
parent | 1145da3ea5a60387ea4bc7a93ee52f08a3c20b80 (diff) | |
download | gtk+-b8cf7ea1c6ee97c3ad1a95717d62bcfe33786116.tar.gz |
dnd: Port the TreeModel machinery to GValue DND
Diffstat (limited to 'gtk/gtkliststore.c')
-rw-r--r-- | gtk/gtkliststore.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/gtk/gtkliststore.c b/gtk/gtkliststore.c index 4e7ff1164d..8b582fd526 100644 --- a/gtk/gtkliststore.c +++ b/gtk/gtkliststore.c @@ -248,15 +248,15 @@ static gboolean real_gtk_list_store_row_draggable (GtkTreeDragSource *drag_sourc GtkTreePath *path); static gboolean gtk_list_store_drag_data_delete (GtkTreeDragSource *drag_source, GtkTreePath *path); -static gboolean gtk_list_store_drag_data_get (GtkTreeDragSource *drag_source, - GtkTreePath *path, - GtkSelectionData *selection_data); +static GdkContentProvider * + gtk_list_store_drag_data_get (GtkTreeDragSource *drag_source, + GtkTreePath *path); static gboolean gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest, GtkTreePath *dest, - GtkSelectionData *selection_data); + const GValue *value); static gboolean gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, - GtkSelectionData *selection_data); + const GValue *value); /* sortable */ @@ -1476,35 +1476,22 @@ gtk_list_store_drag_data_delete (GtkTreeDragSource *drag_source, return FALSE; } -static gboolean +static GdkContentProvider * gtk_list_store_drag_data_get (GtkTreeDragSource *drag_source, - GtkTreePath *path, - GtkSelectionData *selection_data) + GtkTreePath *path) { /* Note that we don't need to handle the GTK_TREE_MODEL_ROW * target, because the default handler does it for us, but * we do anyway for the convenience of someone maybe overriding the * default handler. */ - - if (gtk_tree_set_row_drag_data (selection_data, - GTK_TREE_MODEL (drag_source), - path)) - { - return TRUE; - } - else - { - /* FIXME handle text targets at least. */ - } - - return FALSE; + return gtk_tree_create_row_drag_content (GTK_TREE_MODEL (drag_source), path); } static gboolean -gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest, - GtkTreePath *dest, - GtkSelectionData *selection_data) +gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest, + GtkTreePath *dest, + const GValue *value) { GtkTreeModel *tree_model = GTK_TREE_MODEL (drag_dest); GtkListStore *list_store = GTK_LIST_STORE (tree_model); @@ -1513,7 +1500,7 @@ gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest, GtkTreePath *src_path = NULL; gboolean retval = FALSE; - if (gtk_tree_get_row_drag_data (selection_data, + if (gtk_tree_get_row_drag_data (value, &src_model, &src_path) && src_model == tree_model) @@ -1611,7 +1598,7 @@ gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest, static gboolean gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, - GtkSelectionData *selection_data) + const GValue *value) { gint *indices; GtkTreeModel *src_model = NULL; @@ -1622,7 +1609,7 @@ gtk_list_store_row_drop_possible (GtkTreeDragDest *drag_dest, if (GTK_LIST_STORE_IS_SORTED (drag_dest)) return FALSE; - if (!gtk_tree_get_row_drag_data (selection_data, + if (!gtk_tree_get_row_drag_data (value, &src_model, &src_path)) goto out; |