Re: [Vala] How to refer current class in class method like "this" in instance method?
- From: Derek Dai <daiderek gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] How to refer current class in class method like "this" in instance method?
- Date: Wed, 14 Mar 2012 23:15:25 +0800
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, <vala-list-request gnome org> wrote:
Send vala-list mailing list submissions to
vala-list gnome org
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
vala-list-request gnome org
You can reach the person managing the list at
vala-list-owner gnome org
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" <dbahr uci cu>
To: vala-list gnome org
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 <daiderek gmail com>
To: vala-list gnome org
Subject: [Vala] How to refer current class in class method like "this"
in instance method?
Message-ID:
<CAM45307WP8+1VUR=+YrSJJHUnWSEd9sB1K0MjfUPtKU-z65Nzw 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 <luca dionisi gmail com>
To: Derek Dai <daiderek gmail com>
Cc: vala-list gnome org
Subject: Re: [Vala] How to refer current class in class method like
"this" in instance method?
Message-ID:
<CADGFtMXrf=JYi5X3kR6JoQ1jG9ja2xGAVGkgFkL7oSg=ipzKXw 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 <daiderek gmail com> 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
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
------------------------------
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
End of vala-list Digest, Vol 52, Issue 14
*****************************************
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]