RE: TreeView/ListStore reordering by DND



The "row_inserted" and "row_deleted" signals in the GtkTreeModel are each called with the GtkTreePath of the 
row in question:

The "row-inserted" signal

void                user_function                      (GtkTreeModel *tree_model,
                                                        GtkTreePath  *path,
                                                        GtkTreeIter  *iter,
                                                        gpointer      user_data)


The "row-deleted" signal

void                user_function                      (GtkTreeModel *tree_model,
                                                        GtkTreePath  *path,
                                                        gpointer      user_data)

-----Original Message-----
From: gtk-list [mailto:gtk-list-bounces gnome org] On Behalf Of Stefan Salewski
Sent: Friday, February 28, 2014 5:33 PM
To: gtk-list gnome org
Subject: TreeView/ListStore reordering by DND

I have a simple list display built of a ListView and ListStore as described in 
https://developer.gnome.org/gtk3/stable/GtkTreeView.html

I used gtk_tree_view_set_reorderable () to allow the user to reorder the list by grabbing rows and moving it 
up or down.

From 

https://developer.gnome.org/gtk3/stable/GtkTreeView.html#gtk-tree-view-set-reorderable

we have:

"The developer can listen to these changes by connecting to the model's row_inserted and row_deleted signals."

It seems that a "row_inserted" signal is emitted followed by a "row_deleted" signal.

But how can I detect the row numbers of the two exchanged rows?

gtk_tree_path_get_indices ()
https://developer.gnome.org/gtk3/stable/GtkTreeModel.html#gtk-tree-path-get-indices

may work in the signal handler? But it is not very easy to find the relation between the two exchanged rows 
and the indices.

Are better options available?


_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list


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