From: Thomas M. <ku...@ro...> - 2016-07-21 19:00:31
|
Am 21.07.2016 um 20:49 schrieb cedlemo: > Hi Thomas, I don't really understand what you are calling an interface. > Are you building a Peas ruby module > based on the GObjectInstrospection::Loader? > > I don't understand why you try to create a subclass of GLib::Object > directly. > > If you could explain me this, I should be more helpful. PeasActivatable is a GObject interface, see [1] and [2]. I want to create a ruby class that implements this interface. Finally I want libpeas (a C library) to interact with instances of that class (have libpeas call activate, deactivate and update_state methods()). In ruby, a module seems to correspond largely to an interface in GObject. libpeas provides a typelib, therefore I use GObjectInstrospection::Loader to load the typelib and import libpeas bindings into Ruby space. This part seems to work fine, as I'm able to introspect most (if not all) of libpeas bindings. In GObject, interfaces can have "prerequisite type", which means that implementations of the interface must also be a subclass of that class type. PeasActivatable specifies G_TYPE_OBJECT as the prerequisite. Therefore I want to subclass GLib::Object. [1] https://developer.gnome.org/gobject/stable/gtype-non-instantiable-classed.html [2] https://developer.gnome.org/libpeas/stable/PeasActivatable.html Best regards |