[virt-tools-list] [PATCH] Do not fail when the auth dialog is cancelled
Fabiano Fidêncio
fidencio at redhat.com
Tue Sep 23 11:34:43 UTC 2014
https://bugzilla.redhat.com/show_bug.cgi?id=1145460
---
src/virt-viewer.c | 19 ++++++++++++-------
1 file 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;
}
--
1.9.3
More information about the virt-tools-list
mailing list