[libgovirt] collection: Add OvirtCollection::resources property
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] collection: Add OvirtCollection::resources property
- Date: Thu, 6 Aug 2015 16:31:00 +0000 (UTC)
commit ed0df20b493e771fa0464483e8c7250190834509
Author: Christophe Fergeau <cfergeau redhat com>
Date: Fri Jul 24 16:12:50 2015 +0200
collection: Add OvirtCollection::resources property
This mirrors the ovirt_collection_{get,set}_resources() API, and will
make it possible to be notified when the resources list changes after a
ovirt_collection_fetch() call (for example).
govirt/ovirt-collection.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/govirt/ovirt-collection.c b/govirt/ovirt-collection.c
index 52829f1..36bdcf8 100644
--- a/govirt/ovirt-collection.c
+++ b/govirt/ovirt-collection.c
@@ -51,6 +51,7 @@ enum {
PROP_RESOURCE_TYPE,
PROP_COLLECTION_XML_NAME,
PROP_RESOURCE_XML_NAME,
+ PROP_RESOURCES,
};
@@ -68,6 +69,9 @@ static void ovirt_collection_get_property(GObject *object,
case PROP_RESOURCE_TYPE:
g_value_set_gtype(value, collection->priv->resource_type);
break;
+ case PROP_RESOURCES:
+ g_value_set_boxed(value, collection->priv->resources);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -95,6 +99,9 @@ static void ovirt_collection_set_property(GObject *object,
case PROP_RESOURCE_XML_NAME:
collection->priv->resource_xml_name = g_value_dup_string(value);
break;
+ case PROP_RESOURCES:
+ ovirt_collection_set_resources(collection, g_value_get_boxed(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -171,6 +178,16 @@ static void ovirt_collection_class_init(OvirtCollectionClass *klass)
g_object_class_install_property(object_class,
PROP_RESOURCE_XML_NAME,
param_spec);
+
+ param_spec = g_param_spec_boxed("resources",
+ "Resources",
+ "Hash table containing the resources contained in this collection",
+ G_TYPE_HASH_TABLE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property(object_class,
+ PROP_RESOURCES,
+ param_spec);
}
@@ -208,6 +225,8 @@ void ovirt_collection_set_resources(OvirtCollection *collection, GHashTable *res
} else {
collection->priv->resources = NULL;
}
+
+ g_object_notify(G_OBJECT(collection), "resources");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]