diff options
author | José Alburquerque <jaalburqu@svn.gnome.org> | 2013-01-01 20:19:47 -0500 |
---|---|---|
committer | José Alburquerque <jaalburqu@svn.gnome.org> | 2013-01-01 20:19:47 -0500 |
commit | f6f3801ce576a1186d1bf2dab04498801ef3e8b4 (patch) | |
tree | 276b94be82470f66e0479e4a84c3b7ea68cb37f1 /gio/src/tlsinteraction.hg | |
parent | 30b5a563f61260afbc288a29e1bbb458de217f61 (diff) | |
download | glibmm-f6f3801ce576a1186d1bf2dab04498801ef3e8b4.tar.gz |
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.
Diffstat (limited to 'gio/src/tlsinteraction.hg')
-rw-r--r-- | gio/src/tlsinteraction.hg | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/gio/src/tlsinteraction.hg b/gio/src/tlsinteraction.hg new file mode 100644 index 00000000..b7381091 --- /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 |