[Gtk-sharp-list] GLib.Values and Gtk.ListStores

David R Bacon dbacon@cis.ksu.edu
Fri, 27 Dec 2002 22:36:14 -0600


Hi all,

I have found that you can associate extra, non-visible data
to a row in a TreeView by putting it in the ListStore.
However, in C# it seems I am limited to the types
GLib.TypeFundamentals.Type*.  I tried to derive my extra data
from a GLib.Object, but this(below) simple test shows that even
GLib.Object fails as a GLib.Value.  This is with mono 0.17 and
gtk-sharp 0.6.

Am I misunderstanding GLib.Value?  Other examples (mphoto,
monotalk) work around it by using strings and doing searches to
recover references to objects.  Is there a better way to
associate an arbitrarily typed reference to a row in a ListStore?

Thanks for any help,
Dave

namespace TestMe
{
  using GLib;
  public class Test
  {
    public static void Main(string[] args)
    {
      Value value = new Value(new Object());
    }
  }
}

--

$ mcs /r:glib-sharp.dll Value.cs
Compilation succeeded
$ mono Value.exe
 
(Value.exe:3471): GLib-GObject-CRITICAL **: file gobject.c: line 1541 (g_value_set_object): assertion `G_VALUE_HOLDS_OBJECT (value)' failed
$

-- 
Dave Bacon <dbacon@cis.ksu.edu>
    work: Nichols 119   (785)532-6350 ext 38
    home: 2429 Himes Rd (785)565-0787