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

Re: [libvirt] [libvirt-glib 4/6] Add 'config' property to GVirDomainDevice



ACK

On Thu, Mar 01, 2012 at 12:15:40AM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> GVirDomainDevice should have an associated GVirConfigDomainDevice.
> ---
>  libvirt-gobject/libvirt-gobject-domain-device.c |   33 +++++++++++++++++++++++
>  libvirt-gobject/libvirt-gobject-domain-device.h |    1 +
>  libvirt-gobject/libvirt-gobject.sym             |    1 +
>  3 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain-device.c b/libvirt-gobject/libvirt-gobject-domain-device.c
> index 750c8d9..35d4855 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-device.c
> +++ b/libvirt-gobject/libvirt-gobject-domain-device.c
> @@ -37,6 +37,7 @@
>  struct _GVirDomainDevicePrivate
>  {
>      GVirDomain *domain;
> +    GVirConfigDomainDevice *config;
>  };
>  
>  G_DEFINE_ABSTRACT_TYPE(GVirDomainDevice, gvir_domain_device, G_TYPE_OBJECT);
> @@ -44,6 +45,7 @@ G_DEFINE_ABSTRACT_TYPE(GVirDomainDevice, gvir_domain_device, G_TYPE_OBJECT);
>  enum {
>      PROP_0,
>      PROP_DOMAIN,
> +    PROP_CONFIG,
>  };
>  
>  static void gvir_domain_device_get_property(GObject *object,
> @@ -59,6 +61,10 @@ static void gvir_domain_device_get_property(GObject *object,
>          g_value_set_object(value, priv->domain);
>          break;
>  
> +    case PROP_CONFIG:
> +        g_value_set_object(value, priv->config);
> +        break;
> +
>      default:
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
>      }
> @@ -79,6 +85,11 @@ static void gvir_domain_device_set_property(GObject *object,
>          priv->domain = g_value_dup_object(value);
>          break;
>  
> +    case PROP_CONFIG:
> +        g_clear_object(&priv->config);
> +        priv->config = g_value_dup_object(value);
> +        break;
> +
>      default:
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
>      }
> @@ -93,6 +104,7 @@ static void gvir_domain_device_finalize(GObject *object)
>      g_debug("Finalize GVirDomainDevice=%p", self);
>  
>      g_clear_object(&priv->domain);
> +    g_clear_object(&priv->config);
>  
>      G_OBJECT_CLASS(gvir_domain_device_parent_class)->finalize(object);
>  }
> @@ -115,6 +127,16 @@ static void gvir_domain_device_class_init(GVirDomainDeviceClass *klass)
>                                                          G_PARAM_CONSTRUCT_ONLY |
>                                                          G_PARAM_STATIC_STRINGS));
>  
> +    g_object_class_install_property(object_class,
> +                                    PROP_CONFIG,
> +                                    g_param_spec_object("config",
> +                                                        "Config",
> +                                                        "The configuration",
> +                                                        GVIR_CONFIG_TYPE_DOMAIN_DEVICE,
> +                                                        G_PARAM_READWRITE |
> +                                                        G_PARAM_CONSTRUCT_ONLY |
> +                                                        G_PARAM_STATIC_STRINGS));
> +
>      g_type_class_add_private(klass, sizeof(GVirDomainDevicePrivate));
>  }
>  
> @@ -145,3 +167,14 @@ GVirDomain *gvir_domain_device_get_domain(GVirDomainDevice *device)
>  {
>      return g_object_ref (device->priv->domain);
>  }
> +
> +/**
> + * gvir_domain_device_get_config:
> + * @device: the domain device
> + *
> + * Returns: (transfer full): the config
> + */
> +GVirConfigDomainDevice *gvir_domain_device_get_config(GVirDomainDevice *device)
> +{
> +    return g_object_ref (device->priv->config);
> +}
> diff --git a/libvirt-gobject/libvirt-gobject-domain-device.h b/libvirt-gobject/libvirt-gobject-domain-device.h
> index 98acc2d..b308477 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-device.h
> +++ b/libvirt-gobject/libvirt-gobject-domain-device.h
> @@ -61,6 +61,7 @@ struct _GVirDomainDeviceClass
>  
>  GType gvir_domain_device_get_type(void);
>  GVirDomain *gvir_domain_device_get_domain(GVirDomainDevice *device);
> +GVirConfigDomainDevice *gvir_domain_device_get_config(GVirDomainDevice *device);
>  
>  G_END_DECLS
>  
> diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
> index 0097692..d6999dc 100644
> --- a/libvirt-gobject/libvirt-gobject.sym
> +++ b/libvirt-gobject/libvirt-gobject.sym
> @@ -34,6 +34,7 @@ LIBVIRT_GOBJECT_0.0.4 {
>  
>  	gvir_domain_device_get_type;
>  	gvir_domain_device_get_domain;
> +	gvir_domain_device_get_config;
>  
>  	gvir_domain_disk_get_type;
>  	gvir_domain_disk_stats_get_type;
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpAYgiBnwnxD.pgp
Description: PGP signature


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