[virt-tools-list] [virt-viewer: PATCH 4/4] Auto fill the username field in the auth dialog

Fabiano Fidêncio fidencio at redhat.com
Wed Sep 24 11:49:29 UTC 2014


---
 src/virt-viewer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 9f51b2f..828b6e5 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -640,6 +640,12 @@ 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);
+
+        if (*username == NULL) {
+            /* username will be freed inside the virt_viewer_auth_collect_credentials() */
+            *username = g_strdup (g_get_user_name());
+        }
+
         priv->auth_cancelled = !virt_viewer_auth_collect_credentials(win,
                                                                      "libvirt",
                                                                      app->priv->uri,
-- 
1.9.3




More information about the virt-tools-list mailing list