Blob Blame History Raw
From 71241ea3d9643a1d735d68b2a9670ccd060a1df8 Mon Sep 17 00:00:00 2001
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Fri, 18 Jul 2014 16:45:58 -0500
Subject: [PATCH] remote-viewer: oVirt username review fixes

Minor fixes from patch review

Resolves: rhbz#1061826
(cherry picked from commit ad8966ccf93d10ee21d43328b3970e8857570584)
---
 src/remote-viewer.c    | 5 +++--
 src/virt-viewer-auth.c | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 2782ad3..d9d7baf 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -631,7 +631,7 @@ remote_viewer_window_added(VirtViewerApp *app G_GNUC_UNUSED,
 
 #ifdef HAVE_OVIRT
 static gboolean
-parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name, char** username)
+parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name, char **username)
 {
     char *vm_name = NULL;
     char *rel_path;
@@ -730,7 +730,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri)
     GError *error = NULL;
     char *rest_uri = NULL;
     char *vm_name = NULL;
-    char* username = NULL;
+    char *username = NULL;
     gboolean success = FALSE;
     guint port;
     guint secure_port;
@@ -836,6 +836,7 @@ create_ovirt_session(VirtViewerApp *app, const char *uri)
     success = TRUE;
 
 error:
+    g_free(username);
     g_free(rest_uri);
     g_free(vm_name);
     g_free(ticket);
diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
index c4ea693..bb03516 100644
--- a/src/virt-viewer-auth.c
+++ b/src/virt-viewer-auth.c
@@ -64,8 +64,11 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
     promptPassword = GTK_WIDGET(gtk_builder_get_object(creds, "prompt-password"));
 
     gtk_widget_set_sensitive(credUsername, username != NULL);
-    if (username && *username)
+    if (username && *username) {
         gtk_entry_set_text(GTK_ENTRY(credUsername), *username);
+        /* if username is pre-filled, move focus to password field */
+        gtk_widget_grab_focus(credPassword);
+    }
     gtk_widget_set_sensitive(promptUsername, username != NULL);
     gtk_widget_set_sensitive(credPassword, password != NULL);
     gtk_widget_set_sensitive(promptPassword, password != NULL);