From: cedlemo <ce...@gm...> - 2016-07-21 19:49:01
|
Thomas, When you use the GObjectInstrospection::Loader, you don't need to subclass GLib::Object. Look at the vte3 loader : https://github.com/ruby-gnome2/ruby-gnome2/blob/master/vte3/lib/vte3.rb which is really simple then if you do irb -r vte3 >Vte::Terminal.ancestors [Vte::Terminal, Gtk::Scrollable, Gtk::Widget, Gtk::Buildable, Atk::Implementor, GLib::Interface, GLib::InitiallyUnowned, GLib::Object, GLib::Instantiatable, Object, Kernel, BasicObject] All the hierarchy of classes, sub-class, dependencies have been done. I didn't know about the interfaces or if they are supported. I am sure that Kou will give you a better answer on this advanced topic. cedlemo On 21/07/2016 21:00, Thomas Martitz wrote: > 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 > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity planning > reports.http://sdm.link/zohodev2dev > _______________________________________________ > ruby-gnome2-devel-en mailing list > rub...@li... > https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en |