From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
Add a predicate and property to check if domain is persistent or not.
---
libvirt-gobject/libvirt-gobject-domain.c | 29 +++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 1 +
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c
b/libvirt-gobject/libvirt-gobject-domain.c
index 967ff67..2974bb8 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -45,6 +45,7 @@ G_DEFINE_TYPE(GVirDomain, gvir_domain, G_TYPE_OBJECT);
enum {
PROP_0,
PROP_HANDLE,
+ PROP_PERSISTENT,
};
enum {
@@ -80,6 +81,10 @@ static void gvir_domain_get_property(GObject *object,
g_value_set_boxed(value, priv->handle);
break;
+ case PROP_PERSISTENT:
+ g_value_set_boolean(value, gvir_domain_get_persistent (conn));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
@@ -156,6 +161,17 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_BLURB));
+ g_object_class_install_property(object_class,
+ PROP_PERSISTENT,
+ g_param_spec_boolean("persistent",
+ "Persistent",
+ "If domain is
persistent",
+ TRUE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
+
signals[VIR_STARTED] = g_signal_new("started",
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
@@ -821,3 +837,16 @@ gboolean gvir_domain_save_finish (GVirDomain *dom,
return TRUE;
}
+
+/**
+ * gvir_domain_get_persistent:
+ * @dom: the domain
+ *
+ * Returns: TRUE if domain is persistent, FALSE otherwise.
+ */
+gboolean gvir_domain_get_persistent(GVirDomain *dom)
+{
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+
+ return virDomainIsPersistent(dom->priv->handle);
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h
b/libvirt-gobject/libvirt-gobject-domain.h
index a3649cd..20388f2 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -166,6 +166,7 @@ void gvir_domain_save_async (GVirDomain *dom,
gboolean gvir_domain_save_finish (GVirDomain *dom,
GAsyncResult *result,
GError **err);
+gboolean gvir_domain_get_persistent(GVirDomain *dom);
G_END_DECLS
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 0e0f34d..4c98c93 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -63,6 +63,7 @@ LIBVIRT_GOBJECT_0.0.3 {
gvir_domain_get_config;
gvir_domain_set_config;
gvir_domain_get_info;
+ gvir_domain_get_persistent;
gvir_domain_screenshot;
gvir_domain_snapshot_get_type;
--
1.7.7.5