forked from AuroraMiddleware/gtk
New function to walk through a model in a depth first manner, with the
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to walk through a model in a depth first manner, with the option to break out.
This commit is contained in:
parent
b6f809739b
commit
db93c6131e
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Fri Jun 29 00:13:34 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreemodel.c (gtk_tree_model_foreach): New function to
|
||||||
|
walk through a model in a depth first manner, with the option to
|
||||||
|
break out.
|
||||||
|
|
||||||
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
Fri Jun 8 18:52:10 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
* gtk/gtktreeview.[hc]: Patch Thomas Broyer from
|
||||||
|
@ -1116,6 +1116,61 @@ gtk_tree_model_reordered (GtkTreeModel *tree_model,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_tree_model_foreach_helper (GtkTreeModel *model,
|
||||||
|
GtkTreeIter *iter,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeModelForeachFunc func,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_tree_path_append_index (path, 0);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
GtkTreeIter child;
|
||||||
|
|
||||||
|
if (gtk_tree_model_iter_children (model, &child, iter))
|
||||||
|
{
|
||||||
|
if (gtk_tree_model_foreach_helper (model, &child, path, func, user_data))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((* func) (model, path, iter, user_data))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
gtk_tree_path_next (path);
|
||||||
|
}
|
||||||
|
while (gtk_tree_model_iter_next (model, iter));
|
||||||
|
|
||||||
|
gtk_tree_path_up (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_tree_model_foreach:
|
||||||
|
* @model: A #GtkTreeModel
|
||||||
|
* @func: A function to be called on each row
|
||||||
|
* @user_data: User data to passed to func.
|
||||||
|
*
|
||||||
|
* Calls func on each node in model in a depth-first fashion. If func returns
|
||||||
|
* %TRUE, then the tree ceases to be walked, and gtk_tree_model_foreach returns.
|
||||||
|
**/
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_tree_model_foreach (GtkTreeModel *model,
|
||||||
|
GtkTreeModelForeachFunc func,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkTreePath *path;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
path = gtk_tree_path_new_root ();
|
||||||
|
gtk_tree_model_get_iter (model, &iter, path);
|
||||||
|
gtk_tree_model_foreach_helper (model, &iter, path, func, user_data);
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GtkTreeRowReference
|
* GtkTreeRowReference
|
||||||
*/
|
*/
|
||||||
@ -1520,3 +1575,4 @@ gtk_tree_row_reference_reordered (GObject *proxy,
|
|||||||
gtk_tree_row_ref_reordered_callback (NULL, path, iter, new_order, proxy);
|
gtk_tree_row_ref_reordered_callback (NULL, path, iter, new_order, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ typedef struct _GtkTreePath GtkTreePath;
|
|||||||
typedef struct _GtkTreeRowReference GtkTreeRowReference;
|
typedef struct _GtkTreeRowReference GtkTreeRowReference;
|
||||||
typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
|
typedef struct _GtkTreeModel GtkTreeModel; /* Dummy typedef */
|
||||||
typedef struct _GtkTreeModelIface GtkTreeModelIface;
|
typedef struct _GtkTreeModelIface GtkTreeModelIface;
|
||||||
|
typedef gboolean (* GtkTreeModelForeachFunc) (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -215,6 +216,11 @@ void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
|
|||||||
va_list var_args);
|
va_list var_args);
|
||||||
|
|
||||||
|
|
||||||
|
void gtk_tree_model_foreach (GtkTreeModel *model,
|
||||||
|
GtkTreeModelForeachFunc func,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void gtk_tree_model_range_changed (GtkTreeModel *tree_model,
|
void gtk_tree_model_range_changed (GtkTreeModel *tree_model,
|
||||||
GtkTreePath *start_path,
|
GtkTreePath *start_path,
|
||||||
|
Loading…
Reference in New Issue
Block a user