Re: gtk_tree_selection_selected_foreach example?



On Tue, Oct 09, 2001 at 04:07:22PM -0500, Skip Montanaro wrote:
> Does someone have a fairly simple example of using
> gtk_tree_selection_selected_foreach?  I can't find any use of it in the gtk
> sources.  I'm trying to wrap it in PyGtk, but can't figure out what I'm
> supposed to do with the GtkTreeIter* argument to the user's foreach func.

Is this simple enough?

static void
_selected_helper (GtkTreeModel *model,
		  GtkTreePath *path,
		  GtkTreeIter *iter,
		  gpointer data)
{
  GSList **headp = data;
  AppIp *ip;

  gtk_tree_model_get (model, iter, 0, &ip, -1);

  *headp = g_slist_prepend (*headp, ip);
}

{
  ...
  GSList *current = NULL;
  gtk_tree_selection_selected_foreach (selection, _selected_helper, &current);
  ...
}

-- 
Victory to the Divine Mother!!
  http://sahajayoga.org




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