[libvirt] [libvirt-glib] Add API to check if domain is persistent

Christophe Fergeau cfergeau at redhat.com
Thu Jan 12 16:08:33 UTC 2012


On Thu, Jan 12, 2012 at 05:29:31PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at 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));

NB: you can use G_PARAM_STATIC_STRINGS as a shortcut to the last 3 items
there.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120112/fd67806d/attachment-0001.sig>


More information about the libvir-list mailing list