Thanks Dionisi, but typeof(TypeName) only return a fixed type id, but class
or type id get from an instance vary.

For example
void print_type_id(Object o)
{
    message("%s, %p", o.get_type().name(), o.get_class());
}

print_type_id(new Gtk.Button());
print_type_id(new Gtk.Box());

Derek Dai


On Wed, Mar 14, 2012 at 8:00 PM, <[email protected]> wrote:

> Send vala-list mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.gnome.org/mailman/listinfo/vala-list
> or, via email, send a message with subject or body 'help' to
>        [email protected]
>
> You can reach the person managing the list at
>        [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of vala-list digest..."
>
>
> Today's Topics:
>
>   1. Re: regarding GLib.Process.spawn_async_with_pipes (D.H. Bahr)
>   2. How to refer current class in class method like "this" in
>      instance method? (Derek Dai)
>   3. Re: How to refer current class in class method like "this" in
>      instance method? (Luca Dionisi)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 13 Mar 2012 07:56:23 -0400
> From: "D.H. Bahr" <[email protected]>
> To: [email protected]
> Subject: Re: [Vala] regarding GLib.Process.spawn_async_with_pipes
> Message-ID: <1331639783.1830.5.camel@compaq>
> Content-Type: text/plain; charset="UTF-8"
>
> El Tue, 13-03-2012 a las 11:04 +0100, Jens Georg escribi?:
> > Hi,
> >
> > > I'm trying to write a simple GTK3 front-end for smbpasswd and I'm
> trying
> > > to use ?GLib.Process.spawn_async_with_pipes? based on the ?-s? option
> of
> > > smbpasswd which allows it to use stdin for password prompt.
> > > How can I send the data to ?GLib.Process.spawn_async_with_pipes?'
> stdin?
> >
> > You need to set up an IOWatch on the resulting standard_input fd and
> > check if the app is ready for receiving input; you'll probably also
> > connect to stdout and stderr to properly interact with the command-line
> > app.
> >
>
> Thanks for tips , I'll check that asap..
>
> Best regards,
> --
>
>                                                         Sw.E. D.H. Bahr
>                                         Nova Desktop Development Leader
>                                      CESOL (Free/Libre Software Centre)
>                                UCI (University of Informatics Sciences)
>                                                            Havana, Cuba
>
>
>
>
>
>
> Fin a la injusticia, LIBERTAD AHORA A NUESTROS CINCO COMPATRIOTAS QUE SE
> ENCUENTRAN INJUSTAMENTE EN PRISIONES DE LOS EEUU!
> http://www.antiterroristas.cu
> http://justiciaparaloscinco.wordpress.com
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 14 Mar 2012 17:47:00 +0800
> From: Derek Dai <[email protected]>
> To: [email protected]
> Subject: [Vala] How to refer current class in class method like "this"
>        in      instance method?
> Message-ID:
>        <CAM45307WP8+1VUR=+yrsjjhunwsed9sb1k0mjfuptku-z65...@mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> In vala, before you can invoke a class method, you need an instance. Valac
> generated C code will get class from instance and pass it in class method
> as first argument.
>
> For example,
> class Foo
> {
>    public class void bar() { }
> }
>
> If we invoke bar() like vala code below
> var foo = new Foo();
> foo.bar();
>
> Generated C code will look like
> Foo * foo = foo_new();
> foo_bar(FOO_GET_CLASS(foo));
>
> So, if we invoke bar with difference instance of subclass of Foo, the
> actual class pass in bar() varying.
>
> The question is, if I want access the class argument (say get GType of that
> class) just like "this" in instance method, how can I do it? Thanks!
>
> Derek Dai
>
> ------------------------------
>
> Message: 3
> Date: Wed, 14 Mar 2012 11:13:54 +0100
> From: Luca Dionisi <[email protected]>
> To: Derek Dai <[email protected]>
> Cc: [email protected]
> Subject: Re: [Vala] How to refer current class in class method like
>        "this" in instance method?
> Message-ID:
>        <CADGFtMXrf=JYi5X3kR6JoQ1jG9ja2xGAVGkgFkL7oSg=ipz...@mail.gmail.com
> >
> Content-Type: text/plain; charset=ISO-8859-1
>
> Type t = typeof(Foo);
>
> On Wed, Mar 14, 2012 at 10:47 AM, Derek Dai <[email protected]> wrote:
> > In vala, before you can invoke a class method, you need an instance.
> Valac
> > generated C code will get class from instance and pass it in class method
> > as first argument.
> >
> > For example,
> > class Foo
> > {
> > ? ?public class void bar() { }
> > }
> >
> > If we invoke bar() like vala code below
> > var foo = new Foo();
> > foo.bar();
> >
> > Generated C code will look like
> > Foo * foo = foo_new();
> > foo_bar(FOO_GET_CLASS(foo));
> >
> > So, if we invoke bar with difference instance of subclass of Foo, the
> > actual class pass in bar() varying.
> >
> > The question is, if I want access the class argument (say get GType of
> that
> > class) just like "this" in instance method, how can I do it? Thanks!
> >
> > Derek Dai
> >
> > _______________________________________________
> > vala-list mailing list
> > [email protected]
> > http://mail.gnome.org/mailman/listinfo/vala-list
> >
>
>
> ------------------------------
>
> _______________________________________________
> vala-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/vala-list
>
>
> End of vala-list Digest, Vol 52, Issue 14
> *****************************************
>
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to