user-defined data types & GtkListStore



Hi, I'm brand new to the list, but didn't see anything about this while
searching the archives.  It looks like the core GTK developers monitor this
list, which must be an incredible asset!

I want to store DBDATETIME structs in a column of GtkListStore, because it
has the full date/time representation that our database has, instead of
requiring me to muck with GTime or GDate conversions and possible loss of
data.  Customizing the text renderer for my TreeView was no problem because
I had customized them before, so displaying would be simple.

So much for foresight!  The approach I took was to define a new fundamental
GType (G_USER_TYPE_DBDATETIME), and register it.  It seemed simple, because
my struct type easily fits in the data field of GValue.  I based my setup &
registration code after what was done in gvaluetypes.c, and it successfully
registers to the next fundamental type (196) without warnings.  But then
when I try to pass this new GType value into gtk_list_store_new() and traced
into that code, it was glaringly obvious that  it relies on
gtktreedatalist.c->_gtk_tree_data_list_check_type (type), which has all the
fundamental types hardcoded!  Why why why?  Wouldn't it be better to have
the check_type function loop through a range of registered fundamental
types, instead of explicitly switching through a certain list?

So there's my dilemma.  Is there a better way to achieve my goal than
creating a new user type?  Can I make my current approach work without
modifying the core gtk code?

-Bryan Kubishta





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