summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2020-12-14 16:31:32 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2020-12-14 16:31:32 +0100
commit24b17dc618b9a0f1211c8a1c0e2c250ad8056b2c (patch)
treea687986e0027ed40171015df5fe001e372e5be70 /glib
parent3ac399bcc946ef5e398cdf7eaf603f7430ca1f28 (diff)
downloadglibmm-24b17dc618b9a0f1211c8a1c0e2c250ad8056b2c.tar.gz
Glib::Binding, TimeZone: Ignore deprecation of some glib functions
g_binding_get_source(), g_binding_get_target() and g_time_zone_new() are deprecated in glib 2.68. We can't use the replacement functions, which are new in glib 2.68. We want to build with -Dwarnings=fatal and run with both glib 2.68 and older versions of glib.
Diffstat (limited to 'glib')
-rw-r--r--glib/src/binding.ccg26
-rw-r--r--glib/src/binding.hg67
-rw-r--r--glib/src/timezone.ccg11
-rw-r--r--glib/src/timezone.hg9
4 files changed, 107 insertions, 6 deletions
diff --git a/glib/src/binding.ccg b/glib/src/binding.ccg
index 0c07a07c..a1b40e91 100644
--- a/glib/src/binding.ccg
+++ b/glib/src/binding.ccg
@@ -117,6 +117,31 @@ Binding::bind_property_value(const PropertyProxy_Base& source_property,
return Glib::make_refptr_for_instance<Binding>(new Binding(binding));
}
+// We hand-code get_source() and get_target().
+// g_binding_get_source() and g_binding_get_target() are deprecated in glib 2.68.
+// We can't use the replacements g_binding_dup_source() and g_binding_dup_target(),
+// which are new in glib 2.68. This version of glibmm does not require glib 2.68.
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+Glib::ObjectBase* Binding::get_source()
+{
+ return Glib::wrap_auto(g_binding_get_source(gobj()));
+}
+
+const Glib::ObjectBase* Binding::get_source() const
+{
+ return const_cast<Binding*>(this)->get_source();
+}
+
+Glib::ObjectBase* Binding::get_target()
+{
+ return Glib::wrap_auto(g_binding_get_target(gobj()));
+}
+
+const Glib::ObjectBase* Binding::get_target() const
+{
+ return const_cast<Binding*>(this)->get_target();
+}
+
void
Binding::unbind()
{
@@ -124,5 +149,6 @@ Binding::unbind()
if (g_binding_get_source(gobj()))
g_binding_unbind(gobj());
}
+G_GNUC_END_IGNORE_DEPRECATIONS
} // namespace Glib
diff --git a/glib/src/binding.hg b/glib/src/binding.hg
index 73451ba4..dbd64480 100644
--- a/glib/src/binding.hg
+++ b/glib/src/binding.hg
@@ -381,12 +381,69 @@ public:
slot_transform_from.empty() ? SlotTransform() : TransformProp<T_target, T_source>(slot_transform_from));
}
-#m4 _CONVERSION(`GObject*',`Glib::ObjectBase*',`Glib::wrap_auto($3)')
- _WRAP_METHOD(Glib::ObjectBase* get_source(), g_binding_get_source, newin "2,44")
- _WRAP_METHOD(const Glib::ObjectBase* get_source() const, g_binding_get_source, constversion, newin "2,44")
+ // We hand-code get_source() and get_target().
+ // g_binding_get_source() and g_binding_get_target() are deprecated in glib 2.68.
+ // We can't use the replacements g_binding_dup_source() and g_binding_dup_target(),
+ // which are new in glib 2.68. This version of glibmm does not require glib 2.68.
+ //#m4 _CONVERSION(`GObject*',`Glib::ObjectBase*',`Glib::wrap_auto($3)')
+ //_WRAP_METHOD(Glib::ObjectBase* get_source(), g_binding_get_source, newin "2,44")
+ //_WRAP_METHOD(const Glib::ObjectBase* get_source() const, g_binding_get_source, constversion, newin "2,44")
+ _IGNORE(g_binding_get_source)
+
+ /** Retrieves the Glib::ObjectBase instance used as the source of the binding.
+ *
+ * A %Glib::Binding can outlive the source Glib::ObjectBase as the binding does not hold a
+ * strong reference to the source. If the source is destroyed before the
+ * binding then this function will return a <tt>nullptr</tt>.
+ *
+ * @newin{2,44}
+ *
+ * @return The source Glib::ObjectBase.
+ */
+ Glib::ObjectBase* get_source();
+
+ /** Retrieves the Glib::ObjectBase instance used as the source of the binding.
+ *
+ * A %Glib::Binding can outlive the source Glib::ObjectBase as the binding does not hold a
+ * strong reference to the source. If the source is destroyed before the
+ * binding then this function will return a <tt>nullptr</tt>.
+ *
+ * @newin{2,44}
+ *
+ * @return The source Glib::ObjectBase.
+ */
+ const Glib::ObjectBase* get_source() const;
+
_WRAP_METHOD(Glib::ustring get_source_property() const, g_binding_get_source_property, newin "2,44")
- _WRAP_METHOD(Glib::ObjectBase* get_target(), g_binding_get_target, newin "2,44")
- _WRAP_METHOD(const Glib::ObjectBase* get_target() const, g_binding_get_target, constversion, newin "2,44")
+
+ //_WRAP_METHOD(Glib::ObjectBase* get_target(), g_binding_get_target, newin "2,44")
+ //_WRAP_METHOD(const Glib::ObjectBase* get_target() const, g_binding_get_target, constversion, newin "2,44")
+ _IGNORE(g_binding_get_target)
+
+ /** Retrieves the Glib::ObjectBase instance used as the target of the binding.
+ *
+ * A %Glib::Binding can outlive the target Glib::ObjectBase as the binding does not hold a
+ * strong reference to the target. If the target is destroyed before the
+ * binding then this function will return a <tt>nullptr</tt>.
+ *
+ * @newin{2,44}
+ *
+ * @return The target Glib::ObjectBase.
+ */
+ Glib::ObjectBase* get_target();
+
+ /** Retrieves the Glib::ObjectBase instance used as the target of the binding.
+ *
+ * A %Glib::Binding can outlive the target Glib::ObjectBase as the binding does not hold a
+ * strong reference to the target. If the target is destroyed before the
+ * binding then this function will return a <tt>nullptr</tt>.
+ *
+ * @newin{2,44}
+ *
+ * @return The target Glib::ObjectBase.
+ */
+ const Glib::ObjectBase* get_target() const;
+
_WRAP_METHOD(Glib::ustring get_target_property() const, g_binding_get_target_property, newin "2,44")
_WRAP_METHOD(Flags get_flags() const, g_binding_get_flags, newin "2,44")
diff --git a/glib/src/timezone.ccg b/glib/src/timezone.ccg
index 7faf86e2..b2af6cb5 100644
--- a/glib/src/timezone.ccg
+++ b/glib/src/timezone.ccg
@@ -19,4 +19,15 @@
namespace Glib
{
+// We hand-code create(const Glib::ustring& identifier).
+// g_time_zone_new() is deprecated in glib 2.68.
+// We can't use the replacement g_time_zone_new_identifier(),
+// which is new in glib 2.68. This version of glibmm does not require glib 2.68.
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+TimeZone TimeZone::create(const Glib::ustring& identifier)
+{
+ return Glib::wrap(g_time_zone_new(identifier.c_str()));
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
} // namespace Glib
diff --git a/glib/src/timezone.hg b/glib/src/timezone.hg
index 6ba871ec..8d28c4e4 100644
--- a/glib/src/timezone.hg
+++ b/glib/src/timezone.hg
@@ -61,7 +61,14 @@ class GLIBMM_API TimeZone
_IGNORE(g_time_zone_ref, g_time_zone_unref)
public:
- _WRAP_METHOD(static TimeZone create(const Glib::ustring& identifier), g_time_zone_new)
+ // We hand-code create(const Glib::ustring& identifier).
+ // g_time_zone_new() is deprecated in glib 2.68.
+ // We can't use the replacement g_time_zone_new_identifier(),
+ // which is new in glib 2.68. This version of glibmm does not require glib 2.68.
+ //_WRAP_METHOD(static TimeZone create(const Glib::ustring& identifier), g_time_zone_new_identifier)
+ _WRAP_METHOD_DOCS_ONLY(g_time_zone_new)
+ static TimeZone create(const Glib::ustring& identifier);
+
_WRAP_METHOD(static TimeZone create_local(), g_time_zone_new_local)
_WRAP_METHOD(static TimeZone create_utc(), g_time_zone_new_utc)