diff src/gtk/gtkui.c @ 460:075f89b4395c

2004-4-14 Brian Masney <masneyb@gftp.org> * lib/sshv2.c lib/gftp.h src/text/textui.c src/gtk/gtkui.c - when connecting with the SSH protocol, if the user is asked a question, relay that question back to the user and allow them to answer it. * doc/gftp-faq.sgml - moved the SSH troubleshooting section to the issues for older releases section. All of the issues that this talks about have been fixed in CVS. * src/gtk/gftp-gtk.c (main) - call gdk_threads_init() on startup * lib/cache.c lib/config_file.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c - removed some uses of strlen() so that they only occur once on a string instead of multiple times in some cases * lib/sslcommon.c - fixed typo * configure.in lib/gftp.h - added configure check for inttypes.h * docs/gftp.lsm - updated with 2.0.17 information
author masneyb
date Thu, 15 Apr 2004 00:59:23 +0000
parents 14ef37b62c20
children a68273d9725a
line wrap: on
line diff
--- a/src/gtk/gtkui.c	Sat Apr 10 20:39:06 2004 +0000
+++ b/src/gtk/gtkui.c	Thu Apr 15 00:59:23 2004 +0000
@@ -453,3 +453,55 @@
   return (pos);
 }
 
+
+static void
+_protocol_yes_answer (gpointer answer, gftp_dialog_data * ddata)
+{
+  *(int *) answer = 1;
+}
+
+
+static void
+_protocol_no_answer (gpointer answer, gftp_dialog_data * ddata)
+{
+  *(int *) answer = 0;
+}
+
+
+int
+gftpui_protocol_ask_yes_no (gftp_request * request, char *title,
+                            char *question)
+{
+  int answer = -1;
+
+  GDK_THREADS_ENTER ();
+
+  MakeYesNoDialog (title, question, _protocol_yes_answer, &answer,
+                   _protocol_no_answer, &answer);
+
+  if (gftp_protocols[request->protonum].use_threads)
+    {
+      /* Otherwise let the main loop in the main thread run the events */
+      GDK_THREADS_LEAVE ();
+
+      while (answer == -1)
+        {
+          sleep (1);
+        }
+    }
+  else
+    {
+      while (answer == -1)
+        {
+          GDK_THREADS_LEAVE ();
+#if GTK_MAJOR_VERSION == 1
+          g_main_iteration (TRUE);
+#else
+          g_main_context_iteration (NULL, TRUE);
+#endif
+        }
+    }
+
+  return (answer);
+}
+