[glibmm] giomm: Add the TlsInteraction class.



commit f6f3801ce576a1186d1bf2dab04498801ef3e8b4
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Tue Jan 1 20:19:47 2013 -0500

    giomm: Add the TlsInteraction class.
    
    	* gio/src/tlsinteraction.{ccg,hg}:
    	* gio/src/filelist.am: Add the sources wrapping the C functions and
    	include the sources in the build.
    	* gio/src/gio_vfuncs.defs: Add the virtual functions of the class.
    	The vfuncs are not wrapped yet so that gmmproc can be modified so that
    	virtual functions with slot parameters can be wrapped as is already
    	possible with methods.
    	* tools/m4/convert_gio.m4: Add necessary conversions.

 ChangeLog                  |   13 ++++++++
 gio/src/filelist.am        |    1 +
 gio/src/gio_vfuncs.defs    |   32 +++++++++++++++++++
 gio/src/tlsinteraction.ccg |   26 +++++++++++++++
 gio/src/tlsinteraction.hg  |   73 ++++++++++++++++++++++++++++++++++++++++++++
 tools/m4/convert_gio.m4    |    8 +++-
 6 files changed, 151 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ad2e6ed..87109ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2013-01-01  Josà Alburquerque  <jaalburquerque gmail com>
+
+	giomm: Add the TlsInteraction class.
+
+	* gio/src/tlsinteraction.{ccg,hg}:
+	* gio/src/filelist.am: Add the sources wrapping the C functions and
+	include the sources in the build.
+	* gio/src/gio_vfuncs.defs: Add the virtual functions of the class.
+	The vfuncs are not wrapped yet so that gmmproc can be modified so that
+	virtual functions with slot parameters can be wrapped as is already
+	possible with methods.
+	* tools/m4/convert_gio.m4: Add necessary conversions.
+
 2012-12-28  Josà Alburquerque  <jaalburquerque gmail com>
 
 	gmmproc: _WRAP_METHOD: Ensure that slot parameters can be optional.
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 3a9d479..58e9764 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -114,6 +114,7 @@ giomm_files_any_hg =			\
 	threadedsocketservice.hg	\
 	themedicon.hg			\
 	tlscertificate.hg		\
+	tlsinteraction.hg		\
 	tlspassword.hg			\
 	volume.hg			\
 	volumemonitor.hg		\
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index 94e6fec..19b5c88 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -725,6 +725,38 @@
  )
 )
 
+; GTlsInteraction
+
+(define-vfunc ask_password
+  (of-object "GTlsInteraction")
+  (return-type "GTlsInteractionResult")
+  (parameters
+   '("GTlsPassword*" "password")
+   '("GCancellable*" "cancellable")
+   '("GError**" "error")
+  )
+)
+
+(define-vfunc ask_password_async
+  (of-object "GTlsInteraction")
+  (return-type "void")
+  (parameters
+   '("GTlsPassword*" "password")
+   '("GCancellable*" "cancellable")
+   '("GAsyncReadyCallback" "callback")
+   '("gpointer" "user_data")
+  )
+)
+
+(define-vfunc ask_password_finish
+  (of-object "GTlsInteraction")
+  (return-type "GTlsInteractionResult")
+  (parameters
+   '("GAsyncResult*" "result")
+   '("GError**" "error")
+  )
+)
+
 ; GTlsPassword
 
 (define-vfunc get_value
diff --git a/gio/src/tlsinteraction.ccg b/gio/src/tlsinteraction.ccg
new file mode 100644
index 0000000..45074f6
--- /dev/null
+++ b/gio/src/tlsinteraction.ccg
@@ -0,0 +1,26 @@
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gio/gio.h>
+#include <giomm/cancellable.h>
+#include <giomm/tlspassword.h>
+#include "slot_async.h"
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/tlsinteraction.hg b/gio/src/tlsinteraction.hg
new file mode 100644
index 0000000..b738109
--- /dev/null
+++ b/gio/src/tlsinteraction.hg
@@ -0,0 +1,73 @@
+/* Copyright (C) 2012 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <giomm/asyncresult.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+_WRAP_ENUM(TlsInteractionResult, GTlsInteractionResult)
+
+class Cancellable;
+class TlsPassword;
+
+/** TlsInteraction - Interaction with the user during TLS operations.
+ * TlsInteraction provides a mechanism for the TLS connection and database code to interact with the user. It can be used to ask the user for passwords.
+ *
+ * To use a TlsInteraction with a TLS connection use
+ * Gio::TlSconnection::set_interaction().
+ *
+ * Callers should instantiate a derived class that implements the various
+ * interaction methods to show the required dialogs.
+ *
+ * Callers should use the 'invoke' functions like invoke_ask_password() to run
+ * interaction methods. These functions make sure that the interaction is
+ * invoked in the main loop and not in the current thread, if the current
+ * thread is not running the main loop.
+ *
+ * Derived classes can choose to implement whichever interactions methods
+ * they'd like to support by overriding those virtual methods in their class
+ * initialization function. Any interactions not implemented will return
+ * Gio::TLS_INTERACTION_UNHANDLED. If a derived class implements an async
+ * method, it must also implement the corresponding finish method. 
+ * @newin{2,36}
+ */
+class TlsInteraction : public Glib::Object
+{
+  _CLASS_GOBJECT(TlsInteraction, GTlsInteraction, G_TLS_INTERACTION, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_METHOD(TlsInteractionResult ask_password(const Glib::RefPtr<const TlsPassword>& password, const Glib::RefPtr<Cancellable>& cancellable{?}), g_tls_interaction_ask_password, errthrow)
+  _WRAP_METHOD(void ask_password_async(const Glib::RefPtr<const TlsPassword>& password, const SlotAsyncReady& slot{callback?}, const Glib::RefPtr<Cancellable>& cancellable{.?}), g_tls_interaction_ask_password_async, slot_name slot, slot_callback SignalProxy_async_callback)
+  _WRAP_METHOD(TlsInteractionResult ask_password_finish(const Glib::RefPtr<AsyncResult>& result), g_tls_interaction_ask_password_finish, errthrow)
+  _WRAP_METHOD(TlsInteractionResult invoke_ask_password(const Glib::RefPtr<const TlsPassword>& password, const Glib::RefPtr<Cancellable>& cancellable{?}), g_tls_interaction_invoke_ask_password, errthrow)
+
+/* TODO:
+  _WRAP_VFUNC(TlsInteractionResult ask_password(const Glib::RefPtr<TlsPassword>& password, const Glib::RefPtr<Cancellable>& cancellable), "ask_password", errthrow)
+  _WRAP_VFUNC(void ask_password_async(const Glib::RefPtr<TlsPassword>& password, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable), "ask_password_async")
+  _WRAP_VFUNC(TlsInteractionResult ask_password_finish(const Glib::RefPtr<AsyncResult>& result), "ask_password_finish", errthrow)
+*/
+};
+
+} // namespace Gio
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index ed34d9d..7028675 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -39,8 +39,9 @@ _CONV_ENUM(G,SocketFamily)
 _CONV_ENUM(G,SocketMsgFlags)
 _CONV_ENUM(G,SocketProtocol)
 _CONV_ENUM(G,SocketType)
-_CONV_ENUM(G, TlsCertificateFlags)
-_CONV_ENUM(G, TlsPasswordFlags)
+_CONV_ENUM(G,TlsCertificateFlags)
+_CONV_ENUM(G,TlsInteractionResult)
+_CONV_ENUM(G,TlsPasswordFlags)
 _CONV_ENUM(G,UnixSocketAddressType)
 _CONV_ENUM(G,ZlibCompressorFormat)
 
@@ -267,6 +268,9 @@ _CONVERSION(`GTimeZoneMonitor*',`Glib::RefPtr<TimeZoneMonitor>',`Glib::wrap($3)'
 _CONVERSION(`GTlsCertificate*', `Glib::RefPtr<TlsCertificate>', `Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<const TlsCertificate>&', `GTlsCertificate*', `const_cast<GTlsCertificate*>(Glib::unwrap($3))')
 
+#TlsPassword
+_CONVERSION(`const Glib::RefPtr<const TlsPassword>&',`GTlsPassword*',`const_cast<GTlsPassword*>(Glib::unwrap($3))')
+
 #UnixFDList
 _CONVERSION(`GUnixFDList*',`Glib::RefPtr<UnixFDList>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<UnixFDList>&',`GUnixFDList*',`Glib::unwrap($3)')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]