After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 63768 - Can't instantiate a GtkTreeStore with just g_object_new()
Can't instantiate a GtkTreeStore with just g_object_new()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
1.3.x
Other Linux
: Normal enhancement
: future
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks: 86865
 
 
Reported: 2001-11-05 00:18 UTC by Murray Cumming
Modified: 2005-12-22 15:09 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Adds properties to GtkTreeStore, GtkListStore and GtkTreeModelSort (17.51 KB, patch)
2001-11-08 10:36 UTC, Murray Cumming
none Details | Review

Description Murray Cumming 2001-11-05 00:18:21 UTC
*_new() functions should be just convenience wrappers, but there doesn't
seem to be a way to instantiate a GtkTreeStore with only g_object_new() as
there are no construct-time properties to correspond to the number of
columns, and array of column types.

At the least there should be a public gtk_tree_store_constructv() function
that's called from gtk_tree_store_newv(). I'm happy to code that if necessary.
Comment 1 Jeff Franks 2001-11-08 02:22:46 UTC
The same applies to GtkListStore.
Comment 2 Murray Cumming 2001-11-08 10:36:12 UTC
Created attachment 5984 [details] [review]
Adds properties to GtkTreeStore, GtkListStore and GtkTreeModelSort
Comment 3 Murray Cumming 2001-11-08 10:37:22 UTC
The patch, also posted to gtk-devel, fixes this.
Comment 4 Jonathan Blandford 2001-11-14 02:09:06 UTC
Committed a fix.  Rather than use the construct properties to
ListStore and TreeStore, I added a ::set_column_types function that
can be called immediately after the object is created.  The rationale
for this is that the G_TYPE_POINTER value for the array of types is
basically useless, and possibly dangerous.
Comment 5 Murray Cumming 2001-11-14 22:23:36 UTC
This is enough for gtkmm, but I'm not convinced that it's enough for
language bindings and GUI-builders in general, because it still
doesn't seem possible to instantiate a *valid* GtkTreeStore with just
g_object_new(). How is the use of gtk_tree_store_set_column_types()
immediately after g_object_new() any different than the now-incorrect
use of _construct() functions?

After I made this patch I noticed that there is an array parameter
type. Maybe this would be useful.
Comment 6 Jonathan Blandford 2001-11-14 22:46:51 UTC
I'm not sure.  This is essentially a construct function.  However, an
array of Types is pretty ugly.  Maybe we can add one later for 2.2,
but not for 2.0
Comment 7 Murray Cumming 2001-11-15 01:17:59 UTC
Well, officially the use of construct functions instead of
construct-time properties is incorrect, so this bug should stay open,
with a different target milestone. Then it can be fixed later.
Comment 8 Owen Taylor 2001-11-15 04:14:21 UTC
"Officially" is up to the library API designers ... there are
a lot of other GObject types you can't instantiate with g_object_new() -
GdkWindow, GdkVisual, PangoLayout, .... I could go on and on.

In any case, a G_TYPE_POINTER typed parameter does absolutetely
_nothing_ for a GUI builder. It is a C only API as much
as what we have now.

I'm putting this on the future milestone with Severity Enhancement,
but IMO, it probably isn't really worth worrying about this at all.
Comment 9 Kristian Rietveld 2002-05-02 19:40:59 UTC
Reassigning bugs to new component owner. Sorry for the flood.
Comment 10 Matthias Clasen 2003-07-25 08:54:34 UTC
Looks like the remaining problem here is closely related to bug 81040:


G_TYPE_GTYPE is missing from fundamental types.
Comment 11 Murray Cumming 2003-09-30 13:58:00 UTC
Yes, that looks useful.
Comment 12 Murray Cumming 2004-01-21 18:43:09 UTC
Closing this. Thank you. We'll see if any glade developers complain
when they try to implement model-design in Glade.