[libgovirt] proxy: Update OvirtVmDisplay::ca-cert when list of VM changes



commit 82b498a8be3cf8d34f9c6941b343207d2b2e1403
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Jul 24 16:14:17 2015 +0200

    proxy: Update OvirtVmDisplay::ca-cert when list of VM changes
    
    In order to achieve that, when OvirtProxy::api is set, we start watching
    for changes on the OvirtApi::vms collection through notify::resources, and
    update the new OvirtVmDisplay when this is triggered.

 govirt/ovirt-proxy.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index c964adf..fdd3955 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -984,15 +984,29 @@ OvirtProxy *ovirt_proxy_new(const char *hostname)
 }
 
 
+static void vm_collection_changed(GObject *gobject,
+                                  GParamSpec *pspec,
+                                  gpointer user_data)
+{
+    ovirt_proxy_update_vm_display_ca(OVIRT_PROXY(user_data));
+}
+
+
 static void ovirt_proxy_set_api_from_xml(OvirtProxy *proxy,
                                          RestXmlNode *node,
                                          GError **error)
 {
+    OvirtCollection *vms;
+
     if (proxy->priv->api != NULL) {
         g_object_unref(G_OBJECT(proxy->priv->api));
     }
     proxy->priv->api = ovirt_api_new_from_xml(node, error);
 
+    vms = ovirt_api_get_vms(proxy->priv->api);
+    g_return_if_fail(vms != NULL);
+    g_signal_connect(G_OBJECT(vms), "notify::resources",
+                     (GCallback)vm_collection_changed, proxy);
 }
 
 


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