Re: [Vala] Access the "klass" parameter of a class_init() function in vala with "static construct"
- From: Sébastien Wilmet <sebastien wilmet gmail com>
- To: Abderrahim Kitouni <a kitouni gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Access the "klass" parameter of a class_init() function in vala with "static construct"
- Date: Tue, 3 Aug 2010 12:43:58 +0200
2010/8/2 Abderrahim Kitouni <a kitouni gmail com>
How do I add toolbar_item_type in gtk+-2.0.vapi? I've put this inside the
"public class Action" block:
protected GLib.Type toolbar_item_type;
But I have this error (same with public instead of protected):
error: Access to instance member `Gtk.Action.toolbar_item_type' denied
It should be a *class* variable, not an instance variable. So try
something like
protected class GLib.Type toolbar_item_type;
and you won't be able to access it from static construct AFAIK, you need
to use class construct.
Thanks, with a class variable it works too.
Here is my code:
using Gtk;
public class MenuToolAction : Action
{
class construct
{
toolbar_item_type = typeof (MenuToolButton);
}
public MenuToolAction (string name, string? label, string? tooltip,
string? stock_id)
{
GLib.Object (name: name, label: label, tooltip: tooltip, stock_id:
stock_id);
}
}
Now I have a question... How can I modify gtk+-2.0.vapi without copying it
entirely in the code of my project? I just want to add the line you give.
Or can this line be included in the "official" vapi? I can make a bug
report. But if it is done for GtkActionClass.toolbar_item_type, then it must
also be done for all the others (e.g.
GtkWidgetClass.set_scroll_adjustments_signal).
Sébastien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]