comparison src/gtk/misc-gtk.c @ 341:eedc2c5727fa

2003-12-28 Brian Masney <masneyb@gftp.org> **** NOTE: this commit breaks a lot of functionality in gftp. I **** **** still have more work to do on this. Please don't email me **** **** saying that the CVS code is broken. **** * lib/bookmark.c lib/gftp.h lib/local.c lib/options.h lib/rfc2068.c lib/rfc959.c lib/sshv2.c - moved the use_threads option from the request structure over to the protocol declaration in options.h. * lib/options.h src/gtk/gftp-gtk.c - added cmd_in_gui option. When this option is enabled, a new toolbar will be shown in the GTK+ port that will allow you to control the GUI by entering manual commands. * src/Makefile.am - added uicommon directory * src/gtk/Makefile.am src/text/Makefile.am - link in the uicommon library. * src/uicommon/* src/text/gftp-text.c - moved most of the functionality of the text port over to the uicommon directory. Made this code a little more generic so that the GTK+ port can have a text interface associated with it. * src/gtk/gtkui.c src/gtk/gftp-gtk.c src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/menu-items.c src/gtk/misc-gtk.c - started to clean up the callback functions and make them more tightly integrated with the uicommon code. * src/gtk/bookmarks.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/gftp-gtk.c src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/transfer.c - s/refresh/gftpui_refresh/g s/jmp_environment/gftpui_common_jmp_environment/g s/request->use_threads/gftpui_common_use_threads (request)/g * src/gtk/options_dialog.c (apply_changes) - whenever the options are saved, check to see if the command entry needs to be shown or hidden.
author masneyb
date Sun, 28 Dec 2003 16:02:07 +0000
parents 5f9d5aee0c1c
children 2ea37b3c0158
comparison
equal deleted inserted replaced
340:c45fdcb87667 341:eedc2c5727fa
200 } 200 }
201 #endif 201 #endif
202 202
203 if (free_logstr) 203 if (free_logstr)
204 g_free (logstr); 204 g_free (logstr);
205 }
206
207
208 void
209 refresh (gftp_window_data * wdata)
210 {
211 if (!check_status (_("Refresh"), wdata, 0, 0, 0, 1))
212 return;
213
214 if (check_reconnect (wdata) < 0)
215 return;
216
217 gtk_clist_freeze (GTK_CLIST (wdata->listbox));
218 remove_files_window (wdata);
219 gftp_delete_cache_entry (wdata->request, NULL, 0);
220 ftp_list_files (wdata, 0);
221 gtk_clist_thaw (GTK_CLIST (wdata->listbox));
222 } 205 }
223 206
224 207
225 void 208 void
226 update_window_info (void) 209 update_window_info (void)
893 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15); 876 gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 15);
894 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE); 877 gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
895 #else 878 #else
896 switch (okbutton) 879 switch (okbutton)
897 { 880 {
881 case gftp_dialog_button_ok:
882 yes_text = GTK_STOCK_OK;
883 break;
898 case gftp_dialog_button_create: 884 case gftp_dialog_button_create:
899 yes_text = GTK_STOCK_ADD; 885 yes_text = GTK_STOCK_ADD;
900 break; 886 break;
901 case gftp_dialog_button_change: 887 case gftp_dialog_button_change:
902 yes_text = _("Change"); 888 yes_text = _("Change");
964 } 950 }
965 951
966 #if GTK_MAJOR_VERSION == 1 952 #if GTK_MAJOR_VERSION == 1
967 switch (okbutton) 953 switch (okbutton)
968 { 954 {
955 case gftp_dialog_button_ok:
956 yes_text = GTK_STOCK_OK;
957 break;
969 case gftp_dialog_button_create: 958 case gftp_dialog_button_create:
970 yes_text = _("Add"); 959 yes_text = _("Add");
971 break; 960 break;
972 case gftp_dialog_button_change: 961 case gftp_dialog_button_change:
973 yes_text = _("Change"); 962 yes_text = _("Change");
1166 transfer->numdirs, transfer->numfiles); 1155 transfer->numdirs, transfer->numfiles);
1167 gtk_label_set_text (GTK_LABEL (textwid), tempstr); 1156 gtk_label_set_text (GTK_LABEL (textwid), tempstr);
1168 } 1157 }
1169 1158
1170 1159
1171 void *
1172 generic_thread (void * (*func) (void *), gftp_window_data * wdata)
1173 {
1174 void * ret;
1175
1176 if (wdata->request->use_threads)
1177 {
1178 wdata->request->stopable = 1;
1179 gtk_widget_set_sensitive (stop_btn, 1);
1180 pthread_create (&wdata->tid, NULL, func, wdata);
1181
1182 while (wdata->request->stopable)
1183 {
1184 GDK_THREADS_LEAVE ();
1185 #if GTK_MAJOR_VERSION == 1
1186 g_main_iteration (TRUE);
1187 #else
1188 g_main_context_iteration (NULL, TRUE);
1189 #endif
1190 }
1191
1192 pthread_join (wdata->tid, &ret);
1193 gtk_widget_set_sensitive (stop_btn, 0);
1194 }
1195 else
1196 ret = func (wdata);
1197
1198 if (!GFTP_IS_CONNECTED (wdata->request))
1199 disconnect (wdata);
1200
1201 return (ret);
1202 }
1203
1204
1205 int 1160 int
1206 progress_timeout (gpointer data) 1161 progress_timeout (gpointer data)
1207 { 1162 {
1208 gftp_transfer * tdata; 1163 gftp_transfer * tdata;
1209 double val; 1164 double val;
1241 templist = templist->next; 1196 templist = templist->next;
1242 } 1197 }
1243 g_list_free (gftp_file_transfer_logs); 1198 g_list_free (gftp_file_transfer_logs);
1244 gftp_file_transfer_logs = NULL; 1199 gftp_file_transfer_logs = NULL;
1245 pthread_mutex_unlock (&log_mutex); 1200 pthread_mutex_unlock (&log_mutex);
1246 }
1247
1248
1249 RETSIGTYPE
1250 signal_handler (int signo)
1251 {
1252 signal (signo, signal_handler);
1253
1254 if (use_jmp_environment)
1255 siglongjmp (jmp_environment, signo == SIGINT ? 1 : 2);
1256 else if (signo == SIGINT)
1257 exit (1);
1258 } 1201 }
1259 1202
1260 1203
1261 char * 1204 char *
1262 get_xpm_path (char *filename, int quit_on_err) 1205 get_xpm_path (char *filename, int quit_on_err)