From addefe3130f1723d2271e3a16cf40596b7eb3f1f Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Fri, 25 Feb 2022 15:57:31 +0100 Subject: Glib, Gio: Use _WRAP_METHOD(..., ignore_deprecations) --- gio/src/socketclient.ccg | 12 ------------ gio/src/socketclient.hg | 7 ++++--- gio/src/tlsclientconnection.ccg | 12 ------------ gio/src/tlsclientconnection.hg | 7 ++++--- glib/src/binding.ccg | 27 --------------------------- glib/src/binding.hg | 31 ++++++++----------------------- glib/src/timezone.ccg | 11 ----------- glib/src/timezone.hg | 6 ++---- 8 files changed, 18 insertions(+), 95 deletions(-) diff --git a/gio/src/socketclient.ccg b/gio/src/socketclient.ccg index f3592421..8f17c65d 100644 --- a/gio/src/socketclient.ccg +++ b/gio/src/socketclient.ccg @@ -125,16 +125,4 @@ SocketClient::connect_to_uri_async( gobj(), uri.c_str(), default_port, nullptr, &SignalProxy_async_callback, slot_copy); } -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -TlsCertificateFlags SocketClient::get_tls_validation_flags() const -{ - return ((TlsCertificateFlags)(g_socket_client_get_tls_validation_flags(const_cast(gobj())))); -} - -void SocketClient::set_tls_validation_flags(TlsCertificateFlags flags) -{ - g_socket_client_set_tls_validation_flags(gobj(), ((GTlsCertificateFlags)(flags))); -} -G_GNUC_END_IGNORE_DEPRECATIONS - } // namespace Gio diff --git a/gio/src/socketclient.hg b/gio/src/socketclient.hg index b48bfd05..215f7eae 100644 --- a/gio/src/socketclient.hg +++ b/gio/src/socketclient.hg @@ -157,7 +157,8 @@ public: * * @return The TLS validation flags. */ - TlsCertificateFlags get_tls_validation_flags() const; + _WRAP_METHOD(TlsCertificateFlags get_tls_validation_flags() const, + g_socket_client_get_tls_validation_flags, ignore_deprecations) /** Sets the TLS validation flags used when creating TLS connections * via this socket client. The default value is Gio::TLS_CERTIFICATE_VALIDATE_ALL. @@ -169,8 +170,8 @@ public: * * @param flags The validation flags. */ - void set_tls_validation_flags(TlsCertificateFlags flags); - _IGNORE(g_socket_client_get_tls_validation_flags, g_socket_client_set_tls_validation_flags) + _WRAP_METHOD(void set_tls_validation_flags(TlsCertificateFlags flags), + g_socket_client_set_tls_validation_flags, ignore_deprecations) _WRAP_METHOD(Glib::RefPtr get_proxy_resolver(), g_socket_client_get_proxy_resolver, refreturn) _WRAP_METHOD(Glib::RefPtr get_proxy_resolver() const, g_socket_client_get_proxy_resolver, refreturn, constversion) diff --git a/gio/src/tlsclientconnection.ccg b/gio/src/tlsclientconnection.ccg index f19dc7f4..c2785a42 100644 --- a/gio/src/tlsclientconnection.ccg +++ b/gio/src/tlsclientconnection.ccg @@ -25,16 +25,4 @@ TlsClientConnection::TlsClientConnection(GTlsClientConnection* castitem) { } -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -void TlsClientConnection::set_validation_flags(TlsCertificateFlags flags) -{ - g_tls_client_connection_set_validation_flags(gobj(), ((GTlsCertificateFlags)(flags))); -} - -TlsCertificateFlags TlsClientConnection::get_validation_flags() const -{ - return ((TlsCertificateFlags)(g_tls_client_connection_get_validation_flags(const_cast(gobj())))); -} -G_GNUC_END_IGNORE_DEPRECATIONS - } // namespace Gio diff --git a/gio/src/tlsclientconnection.hg b/gio/src/tlsclientconnection.hg index a8f63874..4db487e7 100644 --- a/gio/src/tlsclientconnection.hg +++ b/gio/src/tlsclientconnection.hg @@ -66,7 +66,8 @@ public: * * @param flags The TlsCertificateFlags to use. */ - void set_validation_flags(TlsCertificateFlags flags); + _WRAP_METHOD(void set_validation_flags(TlsCertificateFlags flags), + g_tls_client_connection_set_validation_flags, ignore_deprecations) /** Gets this client connection's validation flags * @@ -77,8 +78,8 @@ public: * * @return The validation flags. */ - TlsCertificateFlags get_validation_flags() const; - _IGNORE(g_tls_client_connection_set_validation_flags, g_tls_client_connection_get_validation_flags) + _WRAP_METHOD(TlsCertificateFlags get_validation_flags() const, + g_tls_client_connection_get_validation_flags, ignore_deprecations) _WRAP_METHOD(void set_use_ssl3(bool use_ssl3 = true), g_tls_client_connection_set_use_ssl3, deprecated "SSL 3.0 is insecure, and this function does not generally enable or disable it, despite its name.") diff --git a/glib/src/binding.ccg b/glib/src/binding.ccg index f9fa92cf..a3a2aabf 100644 --- a/glib/src/binding.ccg +++ b/glib/src/binding.ccg @@ -119,37 +119,10 @@ Binding::bind_property_value(const PropertyProxy_Base& source_property, return Glib::RefPtr(new Binding(binding)); } -// We must 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::RefPtr Binding::get_source() -{ - Glib::RefPtr retvalue = Glib::wrap(g_binding_get_source(gobj())); - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. - return retvalue; -} - -Glib::RefPtr Binding::get_source() const -{ - return const_cast(this)->get_source(); -} - -Glib::RefPtr Binding::get_target() -{ - Glib::RefPtr retvalue = Glib::wrap(g_binding_get_target(gobj())); - if(retvalue) - retvalue->reference(); //The function does not do a ref for us. - return retvalue; -} - -Glib::RefPtr Binding::get_target() const -{ - return const_cast(this)->get_target(); -} - void Binding::unbind() { diff --git a/glib/src/binding.hg b/glib/src/binding.hg index afddd669..39424954 100644 --- a/glib/src/binding.hg +++ b/glib/src/binding.hg @@ -382,18 +382,6 @@ public: slot_transform_from.empty() ? SlotTransform() : TransformProp(slot_transform_from)); } - // We must 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. - // - //_WRAP_METHOD(Glib::RefPtr get_source(), g_binding_get_source, refreturn, newin "2,44") - //_WRAP_METHOD(Glib::RefPtr get_source() const, g_binding_get_source, refreturn, constversion, newin "2,44") - // or - //_WRAP_METHOD(Glib::RefPtr get_source(), g_binding_dup_source, newin "2,44") - //_WRAP_METHOD(Glib::RefPtr get_source() const, g_binding_dup_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 @@ -404,7 +392,8 @@ public: * * @return The source Glib::ObjectBase. */ - Glib::RefPtr get_source(); + _WRAP_METHOD(Glib::RefPtr get_source(), g_binding_get_source, + refreturn, newin "2,44", ignore_deprecations) /** Retrieves the Glib::ObjectBase instance used as the source of the binding. * @@ -416,17 +405,11 @@ public: * * @return The source Glib::ObjectBase. */ - Glib::RefPtr get_source() const; + _WRAP_METHOD(Glib::RefPtr get_source() const, g_binding_get_source, + refreturn, constversion, newin "2,44", ignore_deprecations) _WRAP_METHOD(Glib::ustring get_source_property() const, g_binding_get_source_property, newin "2,44") - //_WRAP_METHOD(Glib::RefPtr get_target(), g_binding_get_target, refreturn, newin "2,44") - //_WRAP_METHOD(Glib::RefPtr get_target() const, g_binding_get_target, refreturn, constversion, newin "2,44") - // or - //_WRAP_METHOD(Glib::RefPtr get_target(), g_binding_dup_target, newin "2,44") - //_WRAP_METHOD(Glib::RefPtr get_target() const, g_binding_dup_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 @@ -437,7 +420,8 @@ public: * * @return The target Glib::ObjectBase. */ - Glib::RefPtr get_target(); + _WRAP_METHOD(Glib::RefPtr get_target(), g_binding_get_target, + refreturn, newin "2,44", ignore_deprecations) /** Retrieves the Glib::ObjectBase instance used as the target of the binding. * @@ -449,7 +433,8 @@ public: * * @return The target Glib::ObjectBase. */ - Glib::RefPtr get_target() const; + _WRAP_METHOD(Glib::RefPtr get_target() const, g_binding_get_target, + refreturn, constversion, newin "2,44", ignore_deprecations) _WRAP_METHOD(Glib::ustring get_target_property() const, g_binding_get_target_property, newin "2,44") _WRAP_METHOD(BindingFlags get_flags() const, g_binding_get_flags, newin "2,44") diff --git a/glib/src/timezone.ccg b/glib/src/timezone.ccg index bfe236a7..42a5ae1c 100644 --- a/glib/src/timezone.ccg +++ b/glib/src/timezone.ccg @@ -19,17 +19,6 @@ namespace Glib { -// We must 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 - // Glib::Value GType Value::value_type() { diff --git a/glib/src/timezone.hg b/glib/src/timezone.hg index 345c51d3..0ededce8 100644 --- a/glib/src/timezone.hg +++ b/glib/src/timezone.hg @@ -60,13 +60,11 @@ class GLIBMM_API TimeZone _IGNORE(g_time_zone_ref, g_time_zone_unref) public: - // We must 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(const Glib::ustring& identifier), g_time_zone_new, + ignore_deprecations) _WRAP_METHOD(static TimeZone create_local(), g_time_zone_new_local) _WRAP_METHOD(static TimeZone create_utc(), g_time_zone_new_utc) -- cgit v1.2.1