GNOME Bugzilla – Bug 552069
Signal elements have several issues
Last modified: 2018-01-24 17:00:45 UTC
Please describe the problem: Signals are associated with class field offset by g_signal_new in many cases to associate default handlers for signals. This association should be explicit in the GIR. In recent GAPI, we add a field_name attribute to signals to indicate the association. In addition to making this association, it would be desirable to provide meaningful names for the signal parameter elements instead of simply P0, P1, etc... since they can be determined from the corresponding callback parameter names. It appears that signal parameter reporting has an off-by-one problem. The "this" parameter is not included in the list, but the first parameter reported is always named "object" with P0 on the real P1, etc... See AccelGroup::accel-activate and AccelGroup:accel-changed as examples of the off-by-one. GtkObject::destroy is an example a signal without a "this" parameter, in case the real problem is that the this parameter is supposed to be in the list. Since the class method entries include the "this" parameter, I'm guesing the signals probably should as well for consistency. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
With go-i 0.9.12, I am still seeing the off-by-one issue in the parameters. For example, in Gio-2.0.gir from glib-2.27.4 I see the following signal in GMountOperation: <glib:signal name="ask-question" introspectable="0"> <doc xml:whitespace="preserve">Emitted when asking the user a question and gives a list of choices for the user to choose from. If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a #GtkMessageDialog.</doc> <return-value transfer-ownership="none"> <type name="none"/> </return-value> <parameters> <parameter name="object" transfer-ownership="none"> <doc xml:whitespace="preserve">string containing a message to display to the user.</doc> <type name="utf8"/> </parameter> <parameter name="p0" transfer-ownership="none"> <doc xml:whitespace="preserve">an array of strings for each possible choice.</doc> <type/> </parameter> </parameters> </glib:signal> The doc element for the "object" param is really the p0 parameter, which is documented as name="message" on gtk.org instead of p0. Of larger concern, the real p1 parameter element is missing. The docs for it are placed on p0, and the type element is empty, instead of GStrv, assuming it's really p1's data. This is probably a blocking issue for using gir for us.
Can you please try goi-0.10.1? It produced following signal description: <glib:signal name="ask-question"> <doc xml:whitespace="preserve">Emitted when asking the user a question and gives a list of choices for the user to choose from. If the message contains a line break, the first line should be presented as a heading. For example, it may be used as the primary text in a #GtkMessageDialog.</doc> <return-value transfer-ownership="none"> <type name="none"/> </return-value> <parameters> <parameter name="message" transfer-ownership="none"> <doc xml:whitespace="preserve">string containing a message to display to the user.</doc> <type name="utf8"/> </parameter> <parameter name="choices" transfer-ownership="none"> <doc xml:whitespace="preserve">an array of strings for each possible choice.</doc> <array> <type name="utf8"/> </array> </parameter> </parameters> </glib:signal> Which is IMHO correct.
is this still relevant?
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
No answer in 4 years → OBSOLETE