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

[virt-tools-list] [virt-viewer v3 3/4] Reshow connection dialog on errors



remote-viewer behaviour is currently inconsistent in the connection dialog:
if the user enters a valid URI, but then remote-viewer fails to connect
to it, then we'll show again the connection dialog through a call
to virt_viewer_app_start() in remote_viewer_deactivated(). If instead we
enter an invalid URI in the connection dialog, then remote-viewer will
report an error and quit.

This commit makes sure in the latter case, we report the error and show
again the connection dialog. The user can press 'Cancel' in the
connection dialog to get out of remote-viewer as in this case, we
return directly FALSE rather than going through the cleanup: label
and looping.
---
 src/remote-viewer.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 6283b4f..3b7b804 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -978,6 +978,7 @@ remote_viewer_start(VirtViewerApp *app)
         virt_viewer_app_show_status(VIRT_VIEWER_APP(self), _("Setting up Spice session..."));
     } else {
 #endif
+retry_dialog:
         if (priv->open_recent_dialog) {
             if (connect_dialog(&guri) != 0)
                 return FALSE;
@@ -1046,6 +1047,10 @@ cleanup:
     g_free(guri);
     g_free(type);
 
+    if (!ret && priv->open_recent_dialog) {
+        goto retry_dialog;
+    }
+
     return ret;
 }
 
-- 
1.8.3.1


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