diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2014-09-22 17:14:39 +0200 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2014-09-23 15:06:27 +0200 |
commit | a5ce2ed3aea30486900e868dc2158fc591321ec1 (patch) | |
tree | b25225a056f826e6fa4523f3d8b549e208a83642 /src/virt-viewer.c | |
parent | e86e8853807f9026c62ef36f56e03d8eda7ce4e1 (diff) | |
download | virt-viewer-a5ce2ed3aea30486900e868dc2158fc591321ec1.tar.gz virt-viewer-a5ce2ed3aea30486900e868dc2158fc591321ec1.tar.xz virt-viewer-a5ce2ed3aea30486900e868dc2158fc591321ec1.zip |
Do not fail when the auth dialog is cancelled
https://bugzilla.redhat.com/show_bug.cgi?id=1145460
Diffstat (limited to 'src/virt-viewer.c')
-rw-r--r-- | src/virt-viewer.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/virt-viewer.c b/src/virt-viewer.c index f8a9ab5..3d7511a 100644 --- a/src/virt-viewer.c +++ b/src/virt-viewer.c @@ -57,6 +57,7 @@ struct _VirtViewerPrivate { gboolean withEvents; gboolean waitvm; gboolean reconnect; + gboolean auth_cancelled; }; G_DEFINE_TYPE (VirtViewer, virt_viewer, VIRT_VIEWER_TYPE_APP) @@ -615,6 +616,7 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred, { char **username = NULL, **password = NULL; VirtViewer *app = cbdata; + VirtViewerPrivate *priv = app->priv; int i; int ret = -1; @@ -638,11 +640,11 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred, if (username || password) { VirtViewerWindow *vwin = virt_viewer_app_get_main_window(VIRT_VIEWER_APP(app)); GtkWindow *win = virt_viewer_window_get_window(vwin); - ret = virt_viewer_auth_collect_credentials(win, - "libvirt", - app->priv->uri, - username, password); - if (ret < 0) + priv->auth_cancelled = !virt_viewer_auth_collect_credentials(win, + "libvirt", + app->priv->uri, + username, password); + if (priv->auth_cancelled) goto cleanup; } else { ret = 0; @@ -695,8 +697,11 @@ virt_viewer_connect(VirtViewerApp *app) &auth_libvirt, oflags); if (!priv->conn) { - virt_viewer_app_simple_message_dialog(app, _("Unable to connect to libvirt with URI %s"), - priv->uri ? priv->uri : _("[none]")); + if (!priv->auth_cancelled) { + virt_viewer_app_simple_message_dialog(app, _("Unable to connect to libvirt with URI %s"), + priv->uri ? priv->uri : _("[none]")); + } + return -1; } |