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 648027 - g_settings_bind_with_mapping: no support for passing multiple callbacks with only one user_data
g_settings_bind_with_mapping: no support for passing multiple callbacks with ...
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings: GLib
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
Vala maintainers
Depends on: 602712
Blocks:
 
 
Reported: 2011-04-17 16:48 UTC by Michael Hofmann
Modified: 2016-09-15 07:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Hack to pass the user_data parameter explicitly (1.90 KB, patch)
2011-04-17 20:29 UTC, Michael Hofmann
none Details | Review
gio patch (9.25 KB, patch)
2011-04-17 20:51 UTC, Allison Karlitskaya (desrt)
none Details | Review

Description Michael Hofmann 2011-04-17 16:48:22 UTC
Bindings for the following are broken:

void g_settings_bind_with_mapping(GSettings *settings, const gchar *key, gpointer object, const gchar *property, GSettingsBindFlags flags, GSettingsBindGetMapping get_mapping, GSettingsBindSetMapping set_mapping, gpointer user_data, GDestroyNotify destroy);

Bindings would need to support get_mapping and set_mapping with only one user_data.

Current non-working bindings:
Settings.bind_with_mapping (string key, void* object, string property, GLib.SettingsBindFlags flags, GLib.SettingsBindGetMapping get_mapping, GLib.SettingsBindSetMapping set_mapping, GLib.DestroyNotify destroy);
Comment 1 Michael Hofmann 2011-04-17 16:50:09 UTC
IRC log regarding this issue:
<Lethalman> a workaround would be to make BindGetMapping and BindSetMapping have has_target=false
<Lethalman> more than a workaround, that's unfortunately the right fix
Comment 2 Allison Karlitskaya (desrt) 2011-04-17 20:23:57 UTC
or could fix this with new API upstream, possibly a GClosure-enabled variant.
Comment 3 Michael Hofmann 2011-04-17 20:29:13 UTC
Created attachment 186159 [details] [review]
Hack to pass the user_data parameter explicitly
Comment 4 Allison Karlitskaya (desrt) 2011-04-17 20:51:16 UTC
Created attachment 186163 [details] [review]
gio patch

This adds the required API to gio (which we could then bind from vala with some minimal adjustments).

I want a sign-off from someone from gobject-introspection first.
Comment 5 Allison Karlitskaya (desrt) 2011-04-17 21:29:09 UTC
So, I looked a bit into the go-i side and I discovered a few things:

  1) py-gi and gjs both seem to lack support for functions with
     multiple callbacks (completely).  They say:

TypeError: Function Gio.bind_with_mapping_full has multiple callbacks, not supported

and

Error: Function Gio.bind_with_mapping_full has multiple callbacks, not supported

which leads me to believe that the error is coming from a lower level (since it is exactly the same for both of them).

I did discover (from asking in #gobject-introspection) that we should probably include a 'Rename to:' attribute on the _full function.  I tried that and it had no effect, though.
Comment 6 Rico Tzschichholz 2016-09-15 07:53:49 UTC
commit 67200696ee5b4abcb388046270aa1d864f9ea367
Author: Evan Nemerson <evan@coeus-group.com>
Date:   Tue Jun 26 01:38:31 2012 -0700

    gio-2.0: fix Settings.bind_with_mapping
    
    This method is skipped in the GIR because of the shared user_data
    parameter.  Vala doesn't support this, either, so to get around it
    we have to set has_target = false on the delegates and pass the void*
    manually.  This also changes the names of the relevant delegates so
    there is no collision if/when the issue is resolved in GIO.