---
libvirt-gobject/libvirt-gobject-domain.c | 61 ++++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 10 ++++++
libvirt-gobject/libvirt-gobject.sym | 2 ++
3 files changed, 73 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c
b/libvirt-gobject/libvirt-gobject-domain.c
index 8f48c2e..7fd5043 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -1621,3 +1621,64 @@ GList *gvir_domain_get_snapshots(GVirDomain *dom)
return snapshots;
}
+
+
+
+static void _fetch_snapshots_async_thread(GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *cancellable) {
+ GError *error = NULL;
+ gboolean status;
+
+ status = gvir_domain_fetch_snapshots(source_object,
+ GPOINTER_TO_UINT(task_data),
+ cancellable,
+ &error);
+ if (status)
+ g_task_return_boolean(task, TRUE);
+ else
+ g_task_return_error(task, error);
+}
+
+
+/**
+ *
+ * @dom: The domain
+ * @list_flags: bitwise-OR of #GVirDomainSnapshotListFlags
+ * @cancellable: (allow-none)(transfer-none): cancellation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ */
+void gvir_domain_fetch_snapshots_async(GVirDomain *dom,
+ guint list_flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data) {
+ GTask *task;
+
+ g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ task = g_task_new(dom, cancellable, callback, user_data);
+ g_task_set_task_data(task, GUINT_TO_POINTER(list_flags), NULL);
+ g_task_run_in_thread(task, _fetch_snapshots_async_thread);
+ g_object_unref(task);
+}
+
+
+/**
+ * gvir_domain_fetch_snapshots_finish:
+ * @dom: a #GVirDomain
+ * @res: (transfer none): async method result
+ *
+ * Returns: TRUE on success, FALSE otherwise.
+ */
+gboolean gvir_domain_fetch_snapshots_finish(GVirDomain *dom,
+ GAsyncResult *res,
+ GError **error) {
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(g_task_is_valid(res, dom), FALSE);
+
+ return g_task_propagate_boolean(G_TASK(res), error);
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h
b/libvirt-gobject/libvirt-gobject-domain.h
index 22870c1..9846375 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -370,6 +370,16 @@ gboolean gvir_domain_fetch_snapshots(GVirDomain *dom,
GList *gvir_domain_get_snapshots(GVirDomain *dom);
+void gvir_domain_fetch_snapshots_async(GVirDomain *dom,
+ guint list_flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean gvir_domain_fetch_snapshots_finish(GVirDomain *dom,
+ GAsyncResult *res,
+ GError **error);
+
G_END_DECLS
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 28e547a..6aa8b86 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -237,6 +237,8 @@ LIBVIRT_GOBJECT_0.1.5 {
LIBVIRT_GOBJECT_0.1.9 {
global:
gvir_domain_fetch_snapshots;
+ gvir_domain_fetch_snapshots_async;
+ gvir_domain_fetch_snapshots_finish;
gvir_domain_get_snapshots;
gvir_domain_snapshot_delete;
gvir_domain_snapshot_list_flags_get_type;
--
2.0.1