To: Jun.Furuse at inria.fr Cc: lablgtk at kaba.or.jp Subject: Re: GTree.view#set_model does not work with GTree.tree_store In-Reply-To: References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030529103544W.garrigue at kurims.kyoto-u.ac.jp> Date: Thu, 29 May 2003 10:35:44 +0900 From: Jacques Garrigue Lines: 36 From: Jun.Furuse at inria.fr > I have a trouble of using GTree.view#set_model method > to apply a GTree.tree_store model: > > treeview#set_model tree_store#coerce; > > prints out a critical gobject warning: > > (!@#$:25259): GLib-GObject-CRITICAL **: file gobject.c: line 1552 (g_value_set_object): assertion `g_value_type_compatible (G_OBJECT_TYPE (v_object), G_VALUE_TYPE (value))' failed > > and the treeview does not display the content. (And even the program > crashes sometimes.) > > I found that treeview#set_model is implemented as a setting of > GObject property. It seems to work with pure models, > but not with tree_stores. Well, there were two problems: a stupid bug in GtkTree.TreeView.Properties.model, that refered to vadjustement in place of model, and another problem with accessing values whose type are interfaces. I've fixed it (maybe not 100% correct, but I have no idea what an interface on a non-object would be). > To avoid this problem, I reimplemented the set_model method using > gtk_tree_view_set_model C function, instead of the property setting. > Then it works correctly with tree_stores, too. > > Is there anyone who knows the difference between modifying model > property and gtk_tree_view_set_model ? In most cases the C function is called to changed the property, so there is no difference. I was just trying to have the properties work properly, as in some cases there is no C function available. Jacques