Mercurial > gftp.yaz
diff src/gtk/gtkui.c @ 484:632036c6e4a4
2004-6-15 Brian Masney <masneyb@gftp.org>
* lib/gftp.h lib/sshv2.c src/gtk/gtkui.c src/text/textui.c - added
support for RSA SecurID passwords
* lib/sshv2.c - cleaned up the SSH login sequence even more. Removed
ssh2_sftp_path and sshv2_use_sftp_subsys options. The sftp subsystem
is now always used.
author | masneyb |
---|---|
date | Wed, 16 Jun 2004 00:59:07 +0000 |
parents | a68273d9725a |
children | 937f2b75bbee |
line wrap: on
line diff
--- a/src/gtk/gtkui.c Sun Jun 13 14:25:18 2004 +0000 +++ b/src/gtk/gtkui.c Wed Jun 16 00:59:07 2004 +0000 @@ -486,7 +486,7 @@ if (gftp_protocols[request->protonum].use_threads) { - /* Otherwise let the main loop in the main thread run the events */ + /* Let the main loop in the main thread run the events */ GDK_THREADS_LEAVE (); while (answer == -1) @@ -510,3 +510,62 @@ return (answer); } + +static void +_protocol_ok_answer (char *buf, gftp_dialog_data * ddata) +{ + buf[1] = ' '; /* In case this is an empty string entered */ + strncpy (buf, gtk_entry_get_text (GTK_ENTRY (ddata->edit)), BUFSIZ); +} + + +static void +_protocol_cancel_answer (char *buf, gftp_dialog_data * ddata) +{ + buf[0] = '\0'; + buf[1] = '\0'; +} + + +char * +gftpui_protocol_ask_user_input (gftp_request * request, char *title, + char *question, int shown) +{ + char buf[BUFSIZ]; + + GDK_THREADS_ENTER (); + + *buf = '\0'; + *(buf + 1) = ' '; + MakeEditDialog (title, question, NULL, shown, NULL, gftp_dialog_button_ok, + _protocol_ok_answer, &buf, _protocol_cancel_answer, &buf); + + if (gftp_protocols[request->protonum].use_threads) + { + /* Let the main loop in the main thread run the events */ + GDK_THREADS_LEAVE (); + + while (*buf == '\0' && *(buf + 1) == ' ') + { + sleep (1); + } + } + else + { + while (*buf == '\0' && *(buf + 1) == ' ') + { + GDK_THREADS_LEAVE (); +#if GTK_MAJOR_VERSION == 1 + g_main_iteration (TRUE); +#else + g_main_context_iteration (NULL, TRUE); +#endif + } + } + + if (*buf != '\0') + return (g_strdup (buf)); + else + return (NULL); +} +