[Gtk-sharp-list] Support for custom GObject properties in Gtk#

Christian Hoff christian_hoff at gmx.net
Sun May 25 14:30:14 EDT 2008


Hi,

I have added a new feature to Gtk# which makes it possible to register 
managed properties within the GObject type system.

A scenario where this feature proves really useful is when developing 
custom cell renderers and you want to set an attribute mapping to make 
it display the data of a tree model.
So after having the attached patch applied(with "patch -p0 > patchfile" 
from the gtk-sharp svn directory) it is possible to write

MyTreeView.AppendColumn("European article number", EANRenderer, "ean", 0);
or
MyColumn.AddAttribute(EANRenderer, "ean", 0);

And in the cell renderer you could write:

[GLib.RegisterPropertyAttribute("ean")]
public System.Int64 EAN {
    get {
        // ....
    }
    set {
        // ....
    }
}

The patch was really a lot of work(although it is not as much new code 
as I have expected) and I would be great if you commit it to SVN or give 
me any feedback on the patch. I have also included a demo application 
with MonoDevelop which is attached, too.

Christian Hoff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CellRendererAttributeTest.tar.gz
Type: application/gzip
Size: 5923 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080525/fdb3e890/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk-vtable-properties-patch.patch
Type: text/x-diff
Size: 11359 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20080525/fdb3e890/attachment-0003.bin 


More information about the Gtk-sharp-list mailing list