GNOME Bugzilla – Bug 615545
Let Gtk.Activatable implementors override related-action and use-action-appearance properties
Last modified: 2018-05-22 13:33:17 UTC
For now, gtk+-2.0.vapi contains: public Gtk.Action related_action { get; set; } public bool use_action_appearance { get; set; } so, there is no way to override these props to follow http://library.gnome.org/devel/gtk/unstable/GtkActivatable.html#GtkActivatable--related-action http://library.gnome.org/devel/gtk/unstable/GtkActivatable.html#GtkActivatable--use-action-appearance
Created attachment 159738 [details] [review] gtk+-2.0: mark GtkActivatable properties as virtual Can you modify your gtk+-2.0.vapi to look like this: public virtual Gtk.Action related_action { get; set; } public virtual bool use_action_appearance { get; set; } and give it a try? If it works, I'll go ahead and push the attached patch.
(In reply to comment #1) > Created an attachment (id=159738) [details] [review] > gtk+-2.0: mark GtkActivatable properties as virtual > > Can you modify your gtk+-2.0.vapi to look like this: > > public virtual Gtk.Action related_action { get; set; } > public virtual bool use_action_appearance { get; set; } > > and give it a try? If it works, I'll go ahead and push the attached patch. It doesn't work as is, Activatable is an interface so "virtual" doesn't make sense. I added "abstract" instead and valac correctly generated g_object_class_override_property instead of g_object_class_install_property but C code is not right: foo.c:89: error: ‘GtkActivatableIface’ has no member named ‘get_related_action’ foo.c:90: error: ‘GtkActivatableIface’ has no member named ‘set_related_action’ foo.c:91: error: ‘GtkActivatableIface’ has no member named ‘get_use_action_appearance’ foo.c:92: error: ‘GtkActivatableIface’ has no member named ‘set_use_action_appearance’ To reproduce: public class Sugar.MenuItem : Gtk.Button, Gtk.Activatable { public Gtk.Action related_action { get { return _action; } set { } } public bool use_action_appearance { get { return true; } set { } } private Gtk.Action _action; } $ valac foo.vala --pkg gtk+-2.0 --use-header --header foo.h -C $ gcc `pkg-config --cflags gtk+-2.0` foo.c -c
In my project, I use workaround(w/o changing gtk+-2.0.vapi) with two seds that just replace g_object_class_install_property with g_object_class_override_property in newly generated C code.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/87.