comparison src/gtk/gtkui.c @ 380:05ee37a5558b

2003-1-28 Brian Masney <masneyb@gftp.org> * src/gtk/bookmarks.c src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h src/gtk/gtkui.c src/gtk/menu-items.c src/gtk/transfer.c - renamed disconnect() to gftpui_disconnect() * src/gtk/gtkui.c src/text/textui.c src/uicommon/gftpui.c - improved prompting for the username/password * src/gtk/gtkui.c src/text/textui.c src/uicommon/gftpui.c - call gftpui_disconnect() after a command is run and if we are no longer connected to the remote host * src/text/gftp-text.c - parse the command line arguments for the host to connect to * src/text/textui.c (gftpui_refresh) - clear the cache. (gftpui_ask_transfer) - check for carriage return or empty string * src/uicommon/gftp.h - define gftpui_common_cmd_m{get,put}_file() * lib/sshv2.c - removed temporary "fix"
author masneyb
date Wed, 28 Jan 2004 23:46:28 +0000
parents d207b8241e96
children 14ef37b62c20
comparison
equal deleted inserted replaced
379:c9aa122a1b92 380:05ee37a5558b
63 63
64 64
65 #define _GFTPUI_GTK_USER_PW_SIZE 256 65 #define _GFTPUI_GTK_USER_PW_SIZE 256
66 66
67 static void 67 static void
68 _gftpui_gtk_try_connect_again (char *tempstr, gftp_dialog_data * ddata) 68 _gftpui_gtk_set_username (gftp_request * request, gftp_dialog_data * ddata)
69 { 69 {
70 strncpy (tempstr, gtk_entry_get_text (GTK_ENTRY (ddata->edit)), 70 gftp_set_username (request, gtk_entry_get_text (GTK_ENTRY (ddata->edit)));
71 _GFTPUI_GTK_USER_PW_SIZE); 71 request->stopable = 0;
72 /* FIXME request->stopable = 0; */ 72 }
73
74
75 static void
76 _gftpui_gtk_set_password (gftp_request * request, gftp_dialog_data * ddata)
77 {
78 gftp_set_password (request, gtk_entry_get_text (GTK_ENTRY (ddata->edit)));
79 request->stopable = 0;
73 } 80 }
74 81
75 82
76 static void 83 static void
77 _gftpui_gtk_dont_connect_again (char *tempstr, gftp_dialog_data * ddata) 84 _gftpui_gtk_abort (gftp_request * request, gftp_dialog_data * ddata)
78 { 85 {
79 /* FIXME request->stopable = 0; */ 86 request->stopable = 0;
80 } 87 }
81 88
82 89
83 char * 90 void
84 gftpui_prompt_username (void *uidata, gftp_request * request) 91 gftpui_prompt_username (void *uidata, gftp_request * request)
85 { 92 {
86 char tempstr[_GFTPUI_GTK_USER_PW_SIZE];
87
88 MakeEditDialog (_("Enter Username"), 93 MakeEditDialog (_("Enter Username"),
89 _("Please enter your username for this site"), NULL, 94 _("Please enter your username for this site"), NULL,
90 0, NULL, gftp_dialog_button_connect, 95 0, NULL, gftp_dialog_button_connect,
91 _gftpui_gtk_try_connect_again, tempstr, 96 _gftpui_gtk_set_username, request,
92 _gftpui_gtk_dont_connect_again, tempstr); 97 _gftpui_gtk_abort, request);
93 98
94 *tempstr = '\0'; 99 request->stopable = 1;
95 while (*tempstr == '\0') /* FIXME */ 100 while (request->stopable)
96 { 101 {
97 GDK_THREADS_LEAVE (); 102 GDK_THREADS_LEAVE ();
98 #if GTK_MAJOR_VERSION == 1 103 #if GTK_MAJOR_VERSION == 1
99 g_main_iteration (TRUE); 104 g_main_iteration (TRUE);
100 #else 105 #else
101 g_main_context_iteration (NULL, TRUE); 106 g_main_context_iteration (NULL, TRUE);
102 #endif 107 #endif
103 } 108 }
104 109 }
105 if (*tempstr == '\0') 110
106 return (NULL); 111
107 else 112 void
108 return (g_strdup (tempstr));
109 }
110
111
112 char *
113 gftpui_prompt_password (void *uidata, gftp_request * request) 113 gftpui_prompt_password (void *uidata, gftp_request * request)
114 { 114 {
115 char tempstr[_GFTPUI_GTK_USER_PW_SIZE];
116
117 MakeEditDialog (_("Enter Password"), 115 MakeEditDialog (_("Enter Password"),
118 _("Please enter your password for this site"), NULL, 116 _("Please enter your password for this site"), NULL,
119 0, NULL, gftp_dialog_button_connect, 117 0, NULL, gftp_dialog_button_connect,
120 _gftpui_gtk_try_connect_again, tempstr, 118 _gftpui_gtk_set_password, request,
121 _gftpui_gtk_dont_connect_again, tempstr); 119 _gftpui_gtk_abort, request);
122 120
123 *tempstr = '\0'; 121 request->stopable = 1;
124 while (*tempstr == '\0') /* FIXME */ 122 while (request->stopable)
125 { 123 {
126 GDK_THREADS_LEAVE (); 124 GDK_THREADS_LEAVE ();
127 #if GTK_MAJOR_VERSION == 1 125 #if GTK_MAJOR_VERSION == 1
128 g_main_iteration (TRUE); 126 g_main_iteration (TRUE);
129 #else 127 #else
130 g_main_context_iteration (NULL, TRUE); 128 g_main_context_iteration (NULL, TRUE);
131 #endif 129 #endif
132 } 130 }
133
134 if (*tempstr == '\0')
135 return (NULL);
136 else
137 return (g_strdup (tempstr));
138 } 131 }
139 132
140 133
141 /* The wakeup main thread functions are so that after the thread terminates 134 /* The wakeup main thread functions are so that after the thread terminates
142 there won't be a delay in updating the GUI */ 135 there won't be a delay in updating the GUI */
241 234
242 pthread_join (wdata->tid, &ret); 235 pthread_join (wdata->tid, &ret);
243 gtk_widget_set_sensitive (stop_btn, 0); 236 gtk_widget_set_sensitive (stop_btn, 0);
244 237
245 if (!GFTP_IS_CONNECTED (wdata->request)) 238 if (!GFTP_IS_CONNECTED (wdata->request))
246 disconnect (wdata); 239 gftpui_disconnect (wdata);
247 240
248 return (ret); 241 return (ret);
249 } 242 }
250 243
251 244
426 tempstr = gftp_build_path (wdata->request->directory, curfle->file, NULL); 419 tempstr = gftp_build_path (wdata->request->directory, curfle->file, NULL);
427 gftpui_run_chdir (wdata, tempstr); 420 gftpui_run_chdir (wdata, tempstr);
428 g_free (tempstr); 421 g_free (tempstr);
429 } 422 }
430 423
424
425 void
426 gftpui_disconnect (void *uidata)
427 {
428 gftp_window_data * wdata;
429
430 wdata = uidata;
431 gftp_delete_cache_entry (wdata->request, NULL, 1);
432 gftp_disconnect (wdata->request);
433 remove_files_window (wdata);
434 update_window (wdata);
435 }
436