Re: Model View Controller. How to implement?
- From: stian nixia no
- To: "Paul Davis" <paul linuxaudiosystems com>
- Cc: Peter <volkov_peter list ru>, gtk-list gnome org
- Subject: Re: Model View Controller. How to implement?
- Date: Thu, 10 Mar 2005 21:02:37 +0100 (CET)
> you are already using threads, so this is enough. the problem,
> i think, is that GObject signals are not inherently cross-thread
> constructs. Emitting a signal from your computation thread and hoping
> that the view will update itself correctly will only work if you are
> doing the appropriate locking/unlocking using gdk_threads_enter() and
> gdk_threads_leave(). Otherwise you have two threads potentially trying
> to do GUI operations at the same time, leading to many problems.
Read the thread-section in glib and gtk reference manual, they describe
the usage og gdk_threads_enter/gdk_threads_leave. Any thread can update
any widget, since a change will enqueue a draw event that will be executed
in the gtk_main() thread.
A classic example for mvc is to store your data in a gtk_list_store og
gtk_tree_store. You can even filter and sort, by stacking models. And
Treeview is the presentation. However, to mangle and change values in the
model you would need to do by hand.
] [Thread Prev