[vlc-commits] dialog: add a default username for dialog_Login

Thomas Guillem git at videolan.org
Thu Jan 14 17:15:21 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 14 17:14:05 2016 +0100| [06b23fcb28e267aa111ba975ef53fd67bd869f2c] | committer: Thomas Guillem

dialog: add a default username for dialog_Login

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06b23fcb28e267aa111ba975ef53fd67bd869f2c
---

 include/vlc_dialog.h   |    7 ++++---
 src/interface/dialog.c |    6 ++++--
 src/misc/keystore.c    |    3 ++-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index 345d36f..caf0a32 100644
--- a/include/vlc_dialog.h
+++ b/include/vlc_dialog.h
@@ -72,15 +72,16 @@ typedef struct dialog_login_t
 {
     const char *title;
     const char *message;
+    const char *default_username;
     char **username;
     char **password;
     /* if store is NULL, password can't be stored (there is no keystore) */
     bool *store;
 } dialog_login_t;
 
-VLC_API void dialog_Login(vlc_object_t *, char **, char **, bool *, const char *, const char *, ...) VLC_FORMAT (6, 7);
-#define dialog_Login(o, u, p, s, t, ...) \
-        dialog_Login(VLC_OBJECT(o), u, p, s, t, __VA_ARGS__)
+VLC_API void dialog_Login(vlc_object_t *, const char *, char **, char **, bool *, const char *, const char *, ...) VLC_FORMAT (7, 8);
+#define dialog_Login(o, u, p, s, t, v, ...) \
+        dialog_Login(VLC_OBJECT(o), u, p, s, t, v, __VA_ARGS__)
 
 /**
  * A question dialog.
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 993fc08..3a0a36e 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -141,7 +141,8 @@ void dialog_VFatal (vlc_object_t *obj, bool modal, const char *title,
  * into the username resp password pointer. Those must be freed with free().
  * Otherwise *username resp *password will be NULL.
  */
-void dialog_Login (vlc_object_t *obj, char **username, char **password,
+void dialog_Login (vlc_object_t *obj, const char *default_username,
+                   char **username, char **password,
                    bool *store, const char *title, const char *fmt, ...)
 {
     assert ((username != NULL) && (password != NULL));
@@ -160,7 +161,8 @@ void dialog_Login (vlc_object_t *obj, char **username, char **password,
     va_start (ap, fmt);
     if (vasprintf (&text, fmt, ap) != -1)
     {
-        dialog_login_t dialog = { title, text, username, password, store };
+        dialog_login_t dialog = { title, text, default_username, username,
+                                  password, store };
         var_SetAddress (provider, "dialog-login", &dialog);
         free (text);
     }
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index 911b9ea..d307631 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -399,7 +399,8 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
                 return false;
             }
             va_end(ap);
-            dialog_Login(p_parent, &p_credential->psz_dialog_username,
+            dialog_Login(p_parent, p_credential->psz_username,
+                         &p_credential->psz_dialog_username,
                          &p_credential->psz_dialog_password,
                          p_credential->p_keystore ? &p_credential->b_store : NULL,
                          psz_dialog_title, psz_dialog_text);



More information about the vlc-commits mailing list