[glibmm] add async versions of Resolver methods



commit 8b70ef30a84f46e1e5dc68221f7a7c68747b6dc6
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Thu Jul 16 23:25:26 2009 -0500

    add async versions of Resolver methods

 ChangeLog            |    5 +++
 gio/src/resolver.ccg |   90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 gio/src/resolver.hg  |   15 +++++++-
 3 files changed, 108 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c633f31..59914b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 2009-07-16  Jonathon Jongsma  <jonathon jongsma collabora co uk>
 
 	* gio/src/resolver.ccg:
+	* gio/src/resolver.hg: add async versions of Resolver methods
+
+2009-07-16  Jonathon Jongsma  <jonathon jongsma collabora co uk>
+
+	* gio/src/resolver.ccg:
 	* gio/src/resolver.hg: add overloads for resolver methods without a
 	  cancellable object
 
diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg
index 60b5639..f786bce 100644
--- a/gio/src/resolver.ccg
+++ b/gio/src/resolver.ccg
@@ -18,6 +18,7 @@
  */
 
 #include <gio/gio.h>
+#include "slot_async.h"
 
 namespace Gio
 {
@@ -92,4 +93,93 @@ ListHandle_SrvTarget Resolver::lookup_service(const Glib::ustring& service, cons
 
 }
 
+void
+Resolver::lookup_by_name_async(const Glib::ustring& hostname,
+                               const SlotAsyncReady& slot,
+                               const Glib::RefPtr<Cancellable>& cancellable)
+{
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_resolver_lookup_by_name_async (gobj(),
+                                   hostname.c_str(),
+                                   cancellable->gobj(),
+                                   &SignalProxy_async_callback,
+                                   slot_copy);
+}
+
+void
+Resolver::lookup_by_name_async(const Glib::ustring& hostname,
+                               const SlotAsyncReady& slot)
+{
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_resolver_lookup_by_name_async (gobj(),
+                                   hostname.c_str(),
+                                   0,
+                                   &SignalProxy_async_callback,
+                                   slot_copy);
+}
+
+void
+Resolver::lookup_by_address_async(const Glib::RefPtr<InetAddress>& address,
+                                  const SlotAsyncReady& slot,
+                                  const Glib::RefPtr<Cancellable>& cancellable)
+{
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_resolver_lookup_by_address_async (gobj(),
+                                      address->gobj(),
+                                      cancellable->gobj(),
+                                      &SignalProxy_async_callback,
+                                      slot_copy);
+}
+
+void
+Resolver::lookup_by_address_async(const Glib::RefPtr<InetAddress>& address,
+                                  const SlotAsyncReady& slot)
+{
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_resolver_lookup_by_address_async (gobj(),
+                                      address->gobj(),
+                                      0,
+                                      &SignalProxy_async_callback,
+                                      slot_copy);
+}
+
+void
+Resolver::lookup_service_async(const Glib::ustring& service,
+                               const Glib::ustring& protocol,
+                               const Glib::ustring& domain,
+                               const SlotAsyncReady& slot,
+                               const Glib::RefPtr<Cancellable>& cancellable)
+{
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_resolver_lookup_service_async (gobj(),
+                                   service.c_str(),
+                                   protocol.c_str(),
+                                   domain.c_str(),
+                                   cancellable->gobj(),
+                                   &SignalProxy_async_callback,
+                                   slot_copy);
+}
+
+void
+Resolver::lookup_service_async(const Glib::ustring& service,
+                               const Glib::ustring& protocol,
+                               const Glib::ustring& domain,
+                               const SlotAsyncReady& slot)
+{
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_resolver_lookup_service_async (gobj(),
+                                   service.c_str(),
+                                   protocol.c_str(),
+                                   domain.c_str(),
+                                   0,
+                                   &SignalProxy_async_callback,
+                                   slot_copy);
+}
+
 } //namespace Gio
diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg
index 4e8d589..f3d9d43 100644
--- a/gio/src/resolver.hg
+++ b/gio/src/resolver.hg
@@ -21,6 +21,7 @@
 #include <giomm/inetaddress.h>
 #include <giomm/cancellable.h>
 #include <giomm/srvtarget.h>
+#include <giomm/asyncresult.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -63,7 +64,10 @@ public:
 #else
   Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name(const Glib::ustring& hostname, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
-  //TODO lookup_by_name_async
+  void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+  void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot);
+  _IGNORE(g_resolver_lookup_by_name_async)
+  _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<InetAddress> > lookup_by_name_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_name_finish, errthrow)
 
 #m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<InetAddress> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
   _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_by_address, errthrow)
@@ -72,7 +76,10 @@ public:
 #else
   Glib::ustring lookup_by_address(const Glib::RefPtr<InetAddress>& address, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
-  //TODO lookup_by_address_async
+  void lookup_by_address_async(const Glib::RefPtr<InetAddress>& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+  void lookup_by_address_async(const Glib::RefPtr<InetAddress>& address, const SlotAsyncReady& slot);
+  _IGNORE(g_resolver_lookup_by_address_async)
+  _WRAP_METHOD(Glib::ustring lookup_by_address_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_by_address_finish, errthrow)
 
 #m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_SHALLOW)')
   _WRAP_METHOD(ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr<Cancellable>& cancellable), g_resolver_lookup_service, errthrow)
@@ -81,6 +88,10 @@ public:
 #else
   ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, std::auto_ptr<Glib::Error>& error);
 #endif //GLIBMM_EXCEPTIONS_ENABLED
+  void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
+  void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot);
+  _IGNORE(g_resolver_lookup_service_async)
+  _WRAP_METHOD(ListHandle_SrvTarget lookup_service_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_service_finish, errthrow)
 };
 
 } // namespace Gio



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