[gtkada] Problem calling Gtk.Tree_Store.Reorder at root level
Damien Carbonne
aetdcarbonne at free.fr
Wed Sep 19 23:34:39 CEST 2007
Hi all,
I'm having problems with :
procedure Reorder
(Tree_Store : access Gtk_Tree_Store_Record;
Parent : Gtk_Tree_Iter;
New_Order : Gint_Array);
in Gtk.Tree_Store.
I want to reorder root nodes and it fails.
Everything works fine when Reorder is called on a node that is not at
the root level.
C code for reorder is:
void
gtk_tree_store_reorder (GtkTreeStore *tree_store,
GtkTreeIter *parent,
gint *new_order)
{
gint i, length = 0;
GNode *level, *node;
GtkTreePath *path;
SortTuple *sort_array;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
g_return_if_fail (!GTK_TREE_STORE_IS_SORTED (tree_store));
g_return_if_fail (parent == NULL || VALID_ITER (parent, tree_store));
g_return_if_fail (new_order != NULL);
...
So it seems it is possible to call reorder at root level by using NULL
for parent.
Can you confirm this ?
However, in Ada it is not possible to pass NULL, so I use Null_Iter, but
C does not accept it and fails on:
g_return_if_fail (parent == NULL || VALID_ITER (parent, tree_store));
Should not we change the Ada body from:
procedure Reorder
(Tree_Store : access Gtk_Tree_Store_Record;
Parent : Gtk_Tree_Iter;
New_Order : Gint_Array)
is
procedure Internal
(Tree_Store : System.Address;
Parent : Gtk_Tree_Iter;
New_Order : System.Address);
pragma Import (C, Internal, "gtk_tree_store_reorder");
begin
Internal (Get_Object (Tree_Store), Parent,
New_Order (New_Order'First)'Address);
end Reorder;
To something like:
procedure Reorder
(Tree_Store : access Gtk_Tree_Store_Record;
Parent : Gtk_Tree_Iter;
New_Order : Gint_Array)
is
procedure Internal
(Tree_Store : System.Address;
Parent : System.Address;
New_Order : System.Address);
pragma Import (C, Internal, "gtk_tree_store_reorder");
begin
if Parent = Null_Iter then
Internal (Get_Object (Tree_Store), System.Null_Address,
New_Order (New_Order'First)'Address);
else
Internal (Get_Object (Tree_Store), Parent'Address,
New_Order (New_Order'First)'Address);
end if;
end Reorder;
Best regards,
Damien Carbonne
More information about the gtkada
mailing list