[virt-tools-list] [virt-viewer][PATCH 2/7 v3] virt-viewer: Add a GError arg to update_display()

Fabiano Fidêncio fidencio at redhat.com
Thu Mar 26 22:26:55 UTC 2015


This is part of a small re-factoring that will have all connection
errors, when we won't be able to connect regardless of what changes on
the remote host, being treated by virt_viewer_app_initial_connect(),
avoiding weird behaviors as we have nowadays (like more than one error
dialog being shown or having the virt-viewer waiting forever for a guest
that will never show up).

Related: rhbz#1085216
---
 src/virt-viewer.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 1c9f59d..b84eaa7 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -520,7 +520,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
 }
 
 static gboolean
-virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
+virt_viewer_update_display(VirtViewer *self, virDomainPtr dom, GError **error)
 {
     VirtViewerPrivate *priv = self->priv;
     VirtViewerApp *app = VIRT_VIEWER_APP(self);
@@ -536,7 +536,7 @@ virt_viewer_update_display(VirtViewer *self, virDomainPtr dom)
     g_object_set(app, "guest-name", virDomainGetName(dom), NULL);
 
     if (!virt_viewer_app_has_session(app)) {
-        if (!virt_viewer_extract_connect_info(self, dom, NULL))
+        if (!virt_viewer_extract_connect_info(self, dom, error))
             return FALSE;
     }
 
@@ -611,7 +611,10 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
         break;
 
     case VIR_DOMAIN_EVENT_STARTED:
-        virt_viewer_update_display(self, dom);
+        virt_viewer_update_display(self, dom, &error);
+        if (error)
+            g_clear_error(&error);
+
         virt_viewer_app_activate(app, &error);
         if (error) {
             /* we may want to consolidate error reporting in
@@ -778,7 +781,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
         goto wait;
     }
 
-    if (!virt_viewer_update_display(self, dom))
+    if (!virt_viewer_update_display(self, dom, &err))
         goto wait;
 
     ret = VIRT_VIEWER_APP_CLASS(virt_viewer_parent_class)->initial_connect(app, &err);
-- 
2.3.3




More information about the virt-tools-list mailing list