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

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



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

Attachment: pgpx4VwPDumhl.pgp
Description: PGP signature


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