diff options
author | Pavel Grunt <pgrunt@redhat.com> | 2015-03-16 11:20:02 +0100 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2015-04-14 15:03:48 +0200 |
commit | 0443bd113f8474ca707c7847e2806a6e374e8a21 (patch) | |
tree | 7b4980ccf851c5a16730c74d3f50aa8c3f22969b /src/remote-viewer.c | |
parent | 0c8f07ea64f462f66d21ab473b7f58b8a5c07e0d (diff) | |
download | virt-viewer-0443bd113f8474ca707c7847e2806a6e374e8a21.tar.gz virt-viewer-0443bd113f8474ca707c7847e2806a6e374e8a21.tar.xz virt-viewer-0443bd113f8474ca707c7847e2806a6e374e8a21.zip |
ovirt: Allow to cancel authentication without showing error dialog
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1201604
Diffstat (limited to 'src/remote-viewer.c')
-rw-r--r-- | src/remote-viewer.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/remote-viewer.c b/src/remote-viewer.c index b172056..937d06d 100644 --- a/src/remote-viewer.c +++ b/src/remote-viewer.c @@ -729,6 +729,10 @@ authenticate_cb(RestProxy *proxy, G_GNUC_UNUSED RestProxyAuth *auth, "username", username, "password", password, NULL); +#ifdef HAVE_OVIRT_CANCEL + } else { + rest_proxy_auth_cancel(auth); +#endif } g_free(username); @@ -863,6 +867,14 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err) api = ovirt_proxy_fetch_api(proxy, &error); if (error != NULL) { g_debug("failed to get oVirt 'api' collection: %s", error->message); +#ifdef HAVE_OVIRT_CANCEL + if (g_error_matches(error, OVIRT_REST_CALL_ERROR, OVIRT_REST_CALL_ERROR_CANCELLED)) { + g_clear_error(&error); + g_set_error_literal(&error, + VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_CANCELLED, + _("Authentication was cancelled")); + } +#endif goto error; } vms = ovirt_api_get_vms(api); |