Functions directly under namespace are not available
kugel- opened this issue · comments
Hello, I'm trying to load a typelib (for http://github.com/geany/geany). It seemed to work fine at first but then I found that functions that are directly in the namespace Geany are not avialable.
See example below. I would expect that that I could invoke Geany.build_activate_menu_item
but it's not defined.
Tell me if you want me to upload the .gir and .typelib file. Alternatively you can compile https://github.com/kugel-/peasy against Geany > 1.28
<?xml version="1.0"?>
<!-- This file was automatically generated from C sources - DO NOT EDIT!
To affect the contents of this file, edit the original C definitions,
and/or use gtk-doc annotations. -->
<repository version="1.2"
xmlns="http://www.gtk.org/introspection/core/1.0"
xmlns:c="http://www.gtk.org/introspection/c/1.0"
xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
<include name="GLib" version="2.0"/>
<include name="GObject" version="2.0"/>
<include name="GeanyScintilla" version="1.0"/>
<include name="Gtk" version="3.0"/>
<c:include name="geanyplugin.h"/>
<namespace name="Geany"
version="1.0"
shared-library="libgeany.so.0"
c:identifier-prefixes="Geany"
c:symbol-prefixes="geany">
<function name="build_activate_menu_item"
c:identifier="build_activate_menu_item">
[...]
</function>
</namespace>
[...]
Btw, my code to load the typelib is:
repo = GObjectIntrospection::IRepository.default
repo.require("Geany")
GirFFI.setup(:Geany, '1.0')
I found that, apparently, I can do Geany.setup_method("build_activate_menu_item"), and then invoke it via Geany.build_activate_menu_item(). This seems very inconvenient and requires me to know about all functions.
@kugel- yeah, the setup_method
bit should happen automatically.
Btw, my code to load the typelib is:
repo = GObjectIntrospection::IRepository.default repo.require("Geany") GirFFI.setup(:Geany, '1.0')
The repository handling bit happens automatically, so you can just do:
GirFFI.setup :Geany
@mvz Excuse me, I think the error was on my side, for some reason. I looked at the code and found that such methods should be lazily loaded via method_missing
. Then I tried again and couldn't reproduce the problem (Geany.methods not showing them due to lazy loading added to my confusion).
Maybe just close this. Is there a test case specifically for this?
Yes, lazy loading is what happens with these methods, so if that is working for you I'll close this.