Blame SOURCES/0017-Use-ovirt_resource_new-functions-instead-of-g_initab.patch

1bd27f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
3e596a
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
3e596a
Date: Thu, 13 Jul 2017 16:58:28 -0300
3e596a
Subject: [PATCH] Use ovirt_resource_new* functions instead of g_initable_new
3e596a
3e596a
This patch also fix some functions that were supposed to be tagged as
3e596a
G_GNUC_INTERNAL.
3e596a
3e596a
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
3e596a
---
3e596a
 govirt/ovirt-api.c            |  8 +++++---
3e596a
 govirt/ovirt-collection.c     |  4 +---
3e596a
 govirt/ovirt-storage-domain.c | 11 ++---------
3e596a
 govirt/ovirt-utils.c          |  3 ++-
3e596a
 govirt/ovirt-vm-pool.c        |  3 ++-
3e596a
 govirt/ovirt-vm.c             |  8 +++++---
3e596a
 6 files changed, 17 insertions(+), 20 deletions(-)
3e596a
3e596a
diff --git a/govirt/ovirt-api.c b/govirt/ovirt-api.c
1bd27f
index ca3fdcf..93dc3d5 100644
3e596a
--- a/govirt/ovirt-api.c
3e596a
+++ b/govirt/ovirt-api.c
3e596a
@@ -98,16 +98,18 @@ static void ovirt_api_init(G_GNUC_UNUSED OvirtApi *api)
3e596a
     api->priv = OVIRT_API_GET_PRIVATE(api);
3e596a
 }
3e596a
 
3e596a
+G_GNUC_INTERNAL
3e596a
 OvirtApi *ovirt_api_new_from_xml(RestXmlNode *node, GError **error)
3e596a
 {
3e596a
-    return OVIRT_API(g_initable_new(OVIRT_TYPE_API, NULL, error,
3e596a
-                                   "xml-node", node, NULL));
3e596a
+    OvirtResource *api = ovirt_resource_new_from_xml(OVIRT_TYPE_API, node, error);
3e596a
+    return OVIRT_API(api);
3e596a
 }
3e596a
 
3e596a
 
3e596a
 OvirtApi *ovirt_api_new(void)
3e596a
 {
3e596a
-    return OVIRT_API(g_initable_new(OVIRT_TYPE_API, NULL, NULL, NULL));
3e596a
+    OvirtResource *api = ovirt_resource_new(OVIRT_TYPE_API);
3e596a
+    return OVIRT_API(api);
3e596a
 }
3e596a
 
3e596a
 
3e596a
diff --git a/govirt/ovirt-collection.c b/govirt/ovirt-collection.c
1bd27f
index d36d750..8008903 100644
3e596a
--- a/govirt/ovirt-collection.c
3e596a
+++ b/govirt/ovirt-collection.c
1bd27f
@@ -235,9 +235,7 @@ ovirt_collection_new_resource_from_xml(OvirtCollection *collection,
3e596a
                                        RestXmlNode *node,
3e596a
                                        GError **error)
3e596a
 {
3e596a
-    return OVIRT_RESOURCE(g_initable_new(collection->priv->resource_type,
3e596a
-                                         NULL, error,
3e596a
-                                         "xml-node", node , NULL));
3e596a
+    return ovirt_resource_new_from_xml(collection->priv->resource_type, node, error);
3e596a
 }
3e596a
 
3e596a
 
3e596a
diff --git a/govirt/ovirt-storage-domain.c b/govirt/ovirt-storage-domain.c
3e596a
index 38c4a62..e255565 100644
3e596a
--- a/govirt/ovirt-storage-domain.c
3e596a
+++ b/govirt/ovirt-storage-domain.c
3e596a
@@ -285,20 +285,13 @@ G_GNUC_INTERNAL
3e596a
 OvirtStorageDomain *ovirt_storage_domain_new_from_xml(RestXmlNode *node,
3e596a
                                                       GError **error)
3e596a
 {
3e596a
-    GObject *domain;
3e596a
-
3e596a
-    domain = g_initable_new(OVIRT_TYPE_STORAGE_DOMAIN, NULL, error,
3e596a
-                            "xml-node", node, NULL);
3e596a
-
3e596a
+    OvirtResource *domain = ovirt_resource_new_from_xml(OVIRT_TYPE_STORAGE_DOMAIN, node, error);
3e596a
     return OVIRT_STORAGE_DOMAIN(domain);
3e596a
 }
3e596a
 
3e596a
 OvirtStorageDomain *ovirt_storage_domain_new(void)
3e596a
 {
3e596a
-    GObject *domain;
3e596a
-
3e596a
-    domain = g_initable_new(OVIRT_TYPE_STORAGE_DOMAIN, NULL, NULL, NULL);
3e596a
-
3e596a
+    OvirtResource *domain = ovirt_resource_new(OVIRT_TYPE_STORAGE_DOMAIN);
3e596a
     return OVIRT_STORAGE_DOMAIN(domain);
3e596a
 }
3e596a
 
3e596a
diff --git a/govirt/ovirt-utils.c b/govirt/ovirt-utils.c
3e596a
index a200e48..1898862 100644
3e596a
--- a/govirt/ovirt-utils.c
3e596a
+++ b/govirt/ovirt-utils.c
3e596a
@@ -32,6 +32,7 @@
3e596a
 
3e596a
 #include "ovirt-error.h"
3e596a
 #include "ovirt-resource.h"
3e596a
+#include "ovirt-resource-private.h"
3e596a
 
3e596a
 RestXmlNode *
3e596a
 ovirt_rest_xml_node_from_call(RestProxyCall *call)
3e596a
@@ -142,7 +143,7 @@ _set_property_value_from_type(GValue *value,
3e596a
     const char *value_str;
3e596a
 
3e596a
     if (g_type_is_a(type, OVIRT_TYPE_RESOURCE)) {
3e596a
-        GObject *resource_value = g_initable_new(type, NULL, NULL, "xml-node", node, NULL);
3e596a
+        OvirtResource *resource_value = ovirt_resource_new_from_xml(type, node, NULL);
3e596a
         g_value_set_object(value, resource_value);
3e596a
         goto end;
3e596a
     } else if (g_type_is_a(type, G_TYPE_STRV)) {
3e596a
diff --git a/govirt/ovirt-vm-pool.c b/govirt/ovirt-vm-pool.c
3e596a
index 3187a8c..9d0d742 100644
3e596a
--- a/govirt/ovirt-vm-pool.c
3e596a
+++ b/govirt/ovirt-vm-pool.c
3e596a
@@ -168,7 +168,8 @@ static void ovirt_vm_pool_init(G_GNUC_UNUSED OvirtVmPool *vm_pool)
3e596a
 
3e596a
 OvirtVmPool *ovirt_vm_pool_new(void)
3e596a
 {
3e596a
-    return OVIRT_VM_POOL(g_initable_new(OVIRT_TYPE_VM_POOL, NULL, NULL, NULL));
3e596a
+    OvirtResource *vm_pool = ovirt_resource_new(OVIRT_TYPE_VM_POOL);
3e596a
+    return OVIRT_VM_POOL(vm_pool);
3e596a
 }
3e596a
 
3e596a
 
3e596a
diff --git a/govirt/ovirt-vm.c b/govirt/ovirt-vm.c
1bd27f
index 3d64649..806b5f3 100644
3e596a
--- a/govirt/ovirt-vm.c
3e596a
+++ b/govirt/ovirt-vm.c
3e596a
@@ -163,15 +163,17 @@ static void ovirt_vm_init(G_GNUC_UNUSED OvirtVm *vm)
3e596a
     vm->priv = OVIRT_VM_GET_PRIVATE(vm);
3e596a
 }
3e596a
 
3e596a
+G_GNUC_INTERNAL
3e596a
 OvirtVm *ovirt_vm_new_from_xml(RestXmlNode *node, GError **error)
3e596a
 {
3e596a
-    return OVIRT_VM(g_initable_new(OVIRT_TYPE_VM, NULL, error,
3e596a
-                                   "xml-node", node, NULL));
3e596a
+    OvirtResource *vm = ovirt_resource_new_from_xml(OVIRT_TYPE_VM, node, error);
3e596a
+    return OVIRT_VM(vm);
3e596a
 }
3e596a
 
3e596a
 OvirtVm *ovirt_vm_new(void)
3e596a
 {
3e596a
-    return OVIRT_VM(g_initable_new(OVIRT_TYPE_VM, NULL, NULL, NULL));
3e596a
+    OvirtResource *vm = ovirt_resource_new(OVIRT_TYPE_VM);
3e596a
+    return OVIRT_VM(vm);
3e596a
 }
3e596a
 
3e596a