[glibmm] Resolver: Add the lookup_records_async() methods.
- From: Josà Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Resolver: Add the lookup_records_async() methods.
- Date: Tue, 30 Oct 2012 03:26:35 +0000 (UTC)
commit e5bf40e75d6302162ab048a280a9a674f396c71c
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Mon Oct 29 23:12:34 2012 -0400
Resolver: Add the lookup_records_async() methods.
* gio/src/resolver.{ccg,hg}: Add the methods (cancellable and
non-cancellable versions) adding TODO's about wrapping the remaining
related methods (lookup_records() and lookup_records_finish()).
* tools/m4/convert_gio.m4: Add a necessary enum conversion.
* glib/src/variant.hg: Typo discovered while adding above methods.
ChangeLog | 10 ++++++++++
gio/src/resolver.ccg | 32 ++++++++++++++++++++++++++++++++
gio/src/resolver.hg | 38 ++++++++++++++++++++++++++++++++++++++
glib/src/variant.hg | 2 +-
tools/m4/convert_gio.m4 | 1 +
5 files changed, 82 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3ee9ca3..e2b5063 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2012-10-29 Josà Alburquerque <jaalburquerque gmail com>
+ Resolver: Add the lookup_records_async() methods.
+
+ * gio/src/resolver.{ccg,hg}: Add the methods (cancellable and
+ non-cancellable versions) adding TODO's about wrapping the remaining
+ related methods (lookup_records() and lookup_records_finish()).
+ * tools/m4/convert_gio.m4: Add a necessary enum conversion.
+ * glib/src/variant.hg: Typo discovered while adding above methods.
+
+2012-10-29 Josà Alburquerque <jaalburquerque gmail com>
+
Add some TODO's.
* gio/src/menuitem.hg:
diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg
index f3065d6..d6b1a3c 100644
--- a/gio/src/resolver.ccg
+++ b/gio/src/resolver.ccg
@@ -19,6 +19,7 @@
#include <gio/gio.h>
#include <glibmm/error.h>
+#include <glibmm/variant.h>
#include "slot_async.h"
namespace Gio
@@ -123,6 +124,37 @@ Resolver::lookup_service_async(const Glib::ustring& service,
slot_copy);
}
+void
+Resolver::lookup_records_async(const Glib::ustring& rrname,
+ ResolverRecordType record_type,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable)
+{
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_resolver_lookup_records_async(gobj(),
+ (rrname.empty() ? 0 : rrname.c_str()),
+ static_cast<GResolverRecordType>(record_type),
+ Glib::unwrap(cancellable),
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
+void
+Resolver::lookup_records_async(const Glib::ustring& rrname,
+ ResolverRecordType record_type,
+ const SlotAsyncReady& slot)
+{
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_resolver_lookup_records_async(gobj(),
+ (rrname.empty() ? 0 : rrname.c_str()),
+ static_cast<GResolverRecordType>(record_type),
+ 0,
+ &SignalProxy_async_callback,
+ slot_copy);
+}
+
std::string
hostname_to_ascii (const Glib::ustring& hostname)
{
diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg
index b9b9b09..a01a733 100644
--- a/gio/src/resolver.hg
+++ b/gio/src/resolver.hg
@@ -26,9 +26,20 @@
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
+
+// Forward declarations for classes in the Glib namespace.
+namespace Glib
+{
+
+class VariantContainerBase;
+
+}
+
namespace Gio
{
+_WRAP_ENUM(ResolverRecordType, GResolverRecordType)
+
/** Asynchronous and cancellable DNS resolver
*
* Resolver provides cancellable synchronous and asynchronous DNS resolution,
@@ -132,6 +143,33 @@ public:
_WRAP_METHOD(ListHandle_SrvTarget lookup_service_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_service_finish, errthrow)
+/* TODO: Wrapping this does not work for some reason.
+#m4 _CONVERSION(`GList*',`std::vector<Glib::VariantContainerBase>',`Glib::ListHandler<Glib::VariantContainerBase>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
+
+ _WRAP_METHOD(std::vector<Glib::VariantContainerBase> lookup_records(const Glib::ustring& rrname, ResolverRecordType record_type, const Glib::RefPtr<Cancellable>& cancellable{?}), g_resolver_lookup_records, errthrow)
+*/
+
+ /** Begins asynchronously performing a DNS lookup for the given @a rrname,
+ * and eventually calls @a slot, which must call lookup_records_finish() to
+ * get the final result. See lookup_records() for more details.
+ *
+ * @param rrname The DNS name to lookup the record for.
+ * @param record_type The type of DNS record to lookup.
+ * @param cancellable A Cancellable.
+ * @param slot The slot to call after the resolution completes.
+ * @newin{2,36}
+ */
+ void lookup_records_async(const Glib::ustring& rrname,
+ ResolverRecordType record_type, const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable);
+
+ /// A non-cancellable version of lookup_records_async().
+ void lookup_records_async(const Glib::ustring& rrname,
+ ResolverRecordType record_type, const SlotAsyncReady& slot);
+
+/* TODO: Wrapping this does not work for some reason.
+ _WRAP_METHOD(std::vector<Glib::VariantContainerBase> lookup_records_finish(const Glib::RefPtr<AsyncResult>& result), g_resolver_lookup_records_finish, errthrow)
+*/
//TODO: Remove no_default_handler when we can break ABI:
_WRAP_SIGNAL(void reload(), reload, no_default_handler)
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 97f8e71..110bbe5 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -37,7 +37,7 @@ namespace Glib
* information about the type of that value. The range of possible
* values is determined by the type. The type system used is VariantType.
*
- * See the VariantBase class and it's derived types, such as VariantContainerbase,
+ * See the VariantBase class and it's derived types, such as VariantContainerBase,
* and the Variant<> template type.
*
* Variant instances always have a type and a value (which are given
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 5c78e12..6e5f60e 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -33,6 +33,7 @@ _CONV_ENUM(G,MountOperationResult)
_CONV_ENUM(G,MountUnmountFlags)
_CONV_ENUM(G,OutputStreamSpliceFlags)
_CONV_ENUM(G,PasswordSave)
+_CONV_ENUM(G,ResolverRecordType)
_CONV_ENUM(G,SettingsBindFlags)
_CONV_ENUM(G,SocketFamily)
_CONV_ENUM(G,SocketMsgFlags)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]