summaryrefslogtreecommitdiff
path: root/gio/src/tlsconnection.ccg
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2020-08-12 12:52:31 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2020-08-12 12:52:31 +0200
commit2da4503d039da6a12cbd61cbbfea0af4ba572229 (patch)
tree1b5b9b34418ae73b1efcb0eb1a6ead58c956f582 /gio/src/tlsconnection.ccg
parentbb806ba91b7c8ae08b721826996d877b748200b2 (diff)
downloadglibmm-2da4503d039da6a12cbd61cbbfea0af4ba572229.tar.gz
Rewrite Gio::Tls[Client,Server]ConnectionImpl
TlsConnection_Class::wrap_new() can wrap a C object in a TlsConnection, TlsClientConnectionImpl or TlsServerConnectionImpl depending on which interface, if any, the C object implements. No need for special wrap*() functions in Tls[Client,Server]Connection or SocketClient::signal_event(). This is similar to Gdk::DeviceWithPad.
Diffstat (limited to 'gio/src/tlsconnection.ccg')
-rw-r--r--gio/src/tlsconnection.ccg19
1 files changed, 19 insertions, 0 deletions
diff --git a/gio/src/tlsconnection.ccg b/gio/src/tlsconnection.ccg
index 4ec8d7e4..7697ed9f 100644
--- a/gio/src/tlsconnection.ccg
+++ b/gio/src/tlsconnection.ccg
@@ -18,4 +18,23 @@
#include <giomm/cancellable.h>
#include <giomm/tlsdatabase.h>
#include <giomm/tlsinteraction.h>
+#include <giomm/tlsclientconnectionimpl.h>
+#include <giomm/tlsserverconnectionimpl.h>
#include "slot_async.h"
+
+namespace Gio
+{
+
+// Custom wrap_new() because we want to create
+// a TlsClientConnectionImpl if the underlying C class implements the GTlsClientConnection interface,
+// a TlsServerConnectionImpl if the underlying C class implements the GTlsServerConnection interface.
+Glib::ObjectBase* TlsConnection_Class::wrap_new(GObject* object)
+{
+ if (G_IS_TLS_CLIENT_CONNECTION(object))
+ return new TlsClientConnectionImpl((GTlsConnection*)object);
+ if (G_IS_TLS_SERVER_CONNECTION(object))
+ return new TlsServerConnectionImpl((GTlsConnection*)object);
+ return new TlsConnection((GTlsConnection*)object);
+}
+
+} // namespace Gio