[Mono-dev] Usage of construct properties in a wrapped GObject library

Rafael Teixeira monoman at gmail.com
Mon Apr 27 17:06:53 EDT 2009


You simply write a new constructor using the already existing one, for
instance:

public Map(string propertyName, string propertyValue) : this()
{
  Add(propertyName, propertyValue)
}

Hope it helps,

On Mon, Apr 27, 2009 at 3:42 PM, MardyTardi <mardy at users.sourceforge.net>wrote:

>
> Michael Hutchinson wrote:
> > On Sun, Apr 26, 2009 at 11:38 AM, mardy.tardi
> > <mardy at users.sourceforge.net> wrote:
> >> I guess that by modifying the C library by adding more _new() methods I
> >> can
> >> get more constructors in the C# API, but is there some other way around
> >> it,
> >> without modifying the C API?
> >
> > Use .custom files to add custom constructors into the C# wrapper.
> >
> > http://mono-project.com/GAPI#.custom_files
>
> Thank you both. Actually what I need is an explanation on how to write the
> actual code; I know GObject well, but I'm totally new to C#.
> The auto generated constructor is:
>
> =============
>        public Map () : base (IntPtr.Zero)
>        {
>            if (GetType () != typeof (Map)) {
>                CreateNativeObject (new string [0], new GLib.Value[0]);
>                return;
>            }
>            Raw = osm_gps_map_new();
>        }
> =============
> osm_gps_map_new() is the C constructor of my GObject, but what I'd like to
> have is a constructor which accepts a list of properties + values, and pass
> it to g_object_newv(). But I cannot find an equivalent for g_object_newv()
> in C#, that's why I'm stuck.
>
> Any hints?
>
> Ciao,
>  Alberto
>
> --
> http://www.mardy.it <- geek in un lingua international!
> --
> View this message in context:
> http://n2.nabble.com/Usage-of-construct-properties-in-a-wrapped-GObject-library-tp2726035p2727814.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



-- 
Rafael "Monoman" Teixeira
---------------------------------------
"To be creative means to be in love with life. You can be creative only if
you love life enough that you want to enhance its beauty, you want to bring
a little more music to it, a little more poetry to it, a little more dance
to it."
Osho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090427/e260d3a5/attachment-0001.html 


More information about the Mono-devel-list mailing list