Re: GtkTree*



On 17 Aug 2001, Jonathan Blandford wrote:

> Tim Janik <timj gtk org> writes:

> > so what you probably want is gtk_tree_view_freeze()/gtk_tree_view_thaw(),
> > so users get a chance to tell the tree view when to not pay attention
> > to possibly expensive model chnges, no matter what state the tree view
> > is in (since freeze/thaw should work incrementally like in other APIs
> > we have, it might be convenient to auto-freeze the view upon creation and
> > thaw upon the first size request).
> 
> Freeze and thaw are evil.  I'd rather not add them.

hm, can you elaborate why you think tehy're evil?

> > if the treeview doesn't come with freeze/thaw APIs, you basically force
> > users that need to code around long model update periods after realization
> > time to implement hacks like:
> > /* emulate freeze */
> > gtk_tree_view_set_model (tree_view, NULL);
> > update_mdoel (model);
> > /* emulate thaw */
> > gtk_tree_view_set_model (tree_view, model);
> > which would be a pity API wise.
> 
> A better idea is to add incremental reflow.  *Sigh*.  That should go in
> bugzilla somewhere.

hm, i'm not sure what you mean with incremental reflow, am i right
in assuming that you mean any signal from the model should just
"queue" an update in the tree view via idle handler and that
way multiple updates get coalesced?
that still can have subtle issues with thing like the selection
API, e.g. you'd basically need something like:

static void
idle_update_func (GtkTreeView *tree_view)
{
  GDK_THREADS_ENTER ();
  /* update stuff */
  GDK_THREADS_LEAVE ();
}

static void
some_model_signal_callback (GtkTreeView *tree_view)
{
  /* the model changed, need to update at some point */
  if (!tree_view->idle_updater)
    tree_view->idle_updater = g_idle_add (..., idle_update_func, ... );
}

void
_gtk_tree_view_find_node (...)
{
  /* hm, we might have updates queued, but were called
   * from something like gtk_tree_selection_select_path()
   * in order to work correctly here, we need the updated tree _now_
   */
 if (tree_view->idle_updater)
   {
     g_source_remove (tree_view->idle_updater);
     tree_view->idle_updater = 0;
     GDK_THREADS_LEAVE ();
     idle_update_func (tree_view);   /* force updates */
     GDK_THREADS_ENTER ();
   }
  /* continue as usual */
}

> 
> -Jonathan
> 

---
ciaoTJ





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