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

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

 



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

Attachment: pgp2wRrpU6kR2.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]