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 /tests/testtreecolumns.c | |
parent | 1145da3ea5a60387ea4bc7a93ee52f08a3c20b80 (diff) | |
download | gtk+-b8cf7ea1c6ee97c3ad1a95717d62bcfe33786116.tar.gz |
dnd: Port the TreeModel machinery to GValue DND
Diffstat (limited to 'tests/testtreecolumns.c')
-rw-r--r-- | tests/testtreecolumns.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/tests/testtreecolumns.c b/tests/testtreecolumns.c index c71f2c912a..6ad42964a5 100644 --- a/tests/testtreecolumns.c +++ b/tests/testtreecolumns.c @@ -268,17 +268,11 @@ view_column_model_tree_model_init (GtkTreeModelIface *iface) iface->iter_parent = view_column_model_iter_parent; } -static gboolean -view_column_model_drag_data_get (GtkTreeDragSource *drag_source, - GtkTreePath *path, - GtkSelectionData *selection_data) -{ - if (gtk_tree_set_row_drag_data (selection_data, - GTK_TREE_MODEL (drag_source), - path)) - return TRUE; - else - return FALSE; +static GdkContentProvider * +view_column_model_drag_data_get (GtkTreeDragSource *drag_source, + GtkTreePath *path) +{ + return gtk_tree_create_row_drag_content (GTK_TREE_MODEL (drag_source), path); } static gboolean @@ -291,13 +285,13 @@ view_column_model_drag_data_delete (GtkTreeDragSource *drag_source, } static gboolean -view_column_model_row_drop_possible (GtkTreeDragDest *drag_dest, - GtkTreePath *dest_path, - GtkSelectionData *selection_data) +view_column_model_row_drop_possible (GtkTreeDragDest *drag_dest, + GtkTreePath *dest_path, + const GValue *value) { GtkTreeModel *src_model; - if (gtk_tree_get_row_drag_data (selection_data, + if (gtk_tree_get_row_drag_data (value, &src_model, NULL)) { @@ -311,15 +305,15 @@ view_column_model_row_drop_possible (GtkTreeDragDest *drag_dest, } static gboolean -view_column_model_drag_data_received (GtkTreeDragDest *drag_dest, - GtkTreePath *dest, - GtkSelectionData *selection_data) +view_column_model_drag_data_received (GtkTreeDragDest *drag_dest, + GtkTreePath *dest, + const GValue *value) { GtkTreeModel *src_model; 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)) { @@ -703,10 +697,6 @@ selection_changed (GtkTreeSelection *selection, GtkWidget *button) gtk_widget_set_sensitive (button, FALSE); } -static const char *row_targets[] = { - "GTK_TREE_MODEL_ROW" -}; - static void quit_cb (GtkWidget *widget, gpointer data) @@ -874,7 +864,7 @@ main (int argc, char *argv[]) /* Drag and Drop */ - targets = gdk_content_formats_new (row_targets, G_N_ELEMENTS (row_targets)); + targets = gdk_content_formats_new_for_gtype (GTK_TYPE_TREE_ROW_DATA); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (left_tree_view), GDK_BUTTON1_MASK, targets, |