After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 570793 - Make Gtk2::Orientable implementable by Perl subclasses
Make Gtk2::Orientable implementable by Perl subclasses
Status: RESOLVED OBSOLETE
Product: gnome-perl
Classification: Bindings
Component: Gtk2
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk2-perl-bugs
gtk2-perl-bugs
Depends on: 570792
Blocks:
 
 
Reported: 2009-02-06 15:31 UTC by Torsten Schoenfeld
Modified: 2021-07-05 12:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Torsten Schoenfeld 2009-02-06 15:31:56 UTC
Once support for interface properties has landed in Glib, we can make Gtk2::Orientable implementable.  (I'm starting to feel like I'm talking Java with all those "-able"s.)

Emmanuel already wrote the _ADD_INTERFACE xsub:

=for apidoc __hide__
=cut
void
_ADD_INTERFACE (class, const char * target_class)
    CODE:
    {
	static const GInterfaceInfo iface_info = {
		(GInterfaceInitFunc) NULL,
		(GInterfaceFinalizeFunc) NULL,
		(gpointer) NULL
	};
	GType gtype = gperl_object_type_from_package (target_class);
	g_type_add_interface_static (gtype, GTK_TYPE_ORIENTABLE, &iface_info);
    }
Comment 1 Kevin Ryde 2010-11-08 20:00:54 UTC
Adding this could make it implementable now, if a class also made its own

    properties=>[Glib::ParamSpec->boolean('orientation')]

Not sure that's to be recommended though, if the glib interface stuff is going to automatically create the interface properties later on.

Depends perhaps what the glib stuff is going to do if it finds the property in question already exists.  You'd be inclined to make it an error/warning/log/whatever, but I suppose it could quietly assume the subclass knew what it was doing and omit interface properties already in the subclass (and not in a superclass).  Would that be a bit painful?  One thing it might allow though is the pspec=>,get=>,set=> style property creation dispatching to individual handler funcs instead of GET_PROPERTY/SET_PROPERTY.

    properties => [ { pspec => Glib::ParamSpec->override
                               ('orientation',
                                 Gtk2::Orientable->find_property('orientation')),
                      get => \&_my_orient_get,
                      set => \&_my_orient_set,
                    } ]

Bit tedious to write as well as to implement maybe :-).
Comment 2 Kevin Ryde 2010-12-27 22:37:56 UTC
Another thing that allowing a subclass to add the property itself could do is allow a different default value in the ParamSpec, if you made an "orientation" property which was the same as in Orientable except for the default_value field.

Can you claim to be "Orientable" if your default is not the interface pspec default?  You'd like to think so, though I expect prefering the "horizontal" per the interface would be clearest most of the time.
Comment 3 GNOME Infrastructure Team 2021-07-05 12:22:22 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME?utf8=%E2%9C%93&filter=perl-

Thank you for your understanding and your help.