summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--installed-tests/js/testGObjectClass.js4
-rw-r--r--libgjs-private/gjs-util.c2
-rw-r--r--libgjs-private/gjs-util.h2
-rw-r--r--modules/core/overrides/GObject.js8
4 files changed, 13 insertions, 3 deletions
diff --git a/installed-tests/js/testGObjectClass.js b/installed-tests/js/testGObjectClass.js
index 459a9932..1e95e3a6 100644
--- a/installed-tests/js/testGObjectClass.js
+++ b/installed-tests/js/testGObjectClass.js
@@ -1176,6 +1176,8 @@ describe('Property bindings', function () {
});
it('can be set up as a group', function () {
+ if (GObject.BindingGroup === undefined)
+ pending('GLib version too old');
const group = new GObject.BindingGroup({source: a});
group.bind('string', b, 'string', GObject.BindingFlags.NONE);
a.string = 'foo';
@@ -1184,6 +1186,8 @@ describe('Property bindings', function () {
});
it('can be set up as a group with custom mappings', function () {
+ if (GObject.BindingGroup === undefined)
+ pending('GLib version too old');
const group = new GObject.BindingGroup({source: a});
group.bind_full('bool', b, 'string', GObject.BindingFlags.NONE,
(bind, source) => [true, `${source}`],
diff --git a/libgjs-private/gjs-util.c b/libgjs-private/gjs-util.c
index 6e9ffec2..b264aec1 100644
--- a/libgjs-private/gjs-util.c
+++ b/libgjs-private/gjs-util.c
@@ -125,6 +125,7 @@ GBinding* gjs_g_object_bind_property_full(
to_closure, from_closure);
}
+#if GLIB_CHECK_VERSION(2, 72, 0)
void gjs_g_binding_group_bind_full(
GBindingGroup* source, const char* source_property, GObject* target,
const char* target_property, GBindingFlags flags,
@@ -146,6 +147,7 @@ void gjs_g_binding_group_bind_full(
target_property, flags,
to_closure, from_closure);
}
+#endif
#undef G_CLOSURE_NOTIFY
diff --git a/libgjs-private/gjs-util.h b/libgjs-private/gjs-util.h
index f67d1db6..7ee83e0d 100644
--- a/libgjs-private/gjs-util.h
+++ b/libgjs-private/gjs-util.h
@@ -141,6 +141,7 @@ GBinding* gjs_g_object_bind_property_full(
GDestroyNotify to_notify, GjsBindingTransformFunc from_callback,
void* from_data, GDestroyNotify from_notify);
+#if GLIB_CHECK_VERSION(2, 72, 0)
/**
* gjs_g_binding_group_bind_full:
* @source:
@@ -162,6 +163,7 @@ void gjs_g_binding_group_bind_full(
GjsBindingTransformFunc to_callback, void* to_data,
GDestroyNotify to_notify, GjsBindingTransformFunc from_callback,
void* from_data, GDestroyNotify from_notify);
+#endif
/* For imports.overrides.Gtk */
GJS_EXPORT
diff --git a/modules/core/overrides/GObject.js b/modules/core/overrides/GObject.js
index 54781526..cf41f3ca 100644
--- a/modules/core/overrides/GObject.js
+++ b/modules/core/overrides/GObject.js
@@ -691,9 +691,11 @@ function _init() {
return GjsPrivate.g_object_bind_property_full(this, ...args);
};
- GObject.BindingGroup.prototype.bind_full = function (...args) {
- return GjsPrivate.g_binding_group_bind_full(this, ...args);
- };
+ if (GObject.BindingGroup !== undefined) {
+ GObject.BindingGroup.prototype.bind_full = function (...args) {
+ return GjsPrivate.g_binding_group_bind_full(this, ...args);
+ };
+ }
// fake enum for signal accumulators, keep in sync with gi/object.c
GObject.AccumulatorType = {