Mercurial > gftp.yaz
annotate src/gtk/gftp-gtk.h @ 355:60d3da6ab336
2003-1-5 Brian Masney <masneyb@gftp.org>
* src/gtk/gftp-gtk.h src/gtk/gtkui.c - when spawning a thread,
make sure that the GUI will be updated properly as soon as the thread
is finished.
* src/uicommon/gftpuicallbacks.c src/uicommon/gftpui.h - added
gftpui_common_run_ls()
* src/uicommon/gftpui.c (gftpui_common_cmd_ls)
src/gtk/transfer.c (ftp_list_files) - converted these functions
over to use gftpui_common_run_ls()
author | masneyb |
---|---|
date | Tue, 06 Jan 2004 01:44:09 +0000 |
parents | eedc2c5727fa |
children | d5409bf03ff1 |
rev | line source |
---|---|
1 | 1 /*****************************************************************************/ |
2 /* gftp-gtk.h - include file for the gftp gtk+ 1.2 port */ | |
255 | 3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */ |
1 | 4 /* */ |
5 /* This program is free software; you can redistribute it and/or modify */ | |
6 /* it under the terms of the GNU General Public License as published by */ | |
7 /* the Free Software Foundation; either version 2 of the License, or */ | |
8 /* (at your option) any later version. */ | |
9 /* */ | |
10 /* This program is distributed in the hope that it will be useful, */ | |
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
13 /* GNU General Public License for more details. */ | |
14 /* */ | |
15 /* You should have received a copy of the GNU General Public License */ | |
16 /* along with this program; if not, write to the Free Software */ | |
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 /*****************************************************************************/ | |
19 | |
33 | 20 /* $Id$ */ |
21 | |
1 | 22 #ifndef __GFTP_GTK_H |
23 #define __GFTP_GTK_H | |
24 | |
25 #include "../../lib/gftp.h" | |
341 | 26 #include "../uicommon/gftpui.h" |
1 | 27 #include <gtk/gtk.h> |
28 #include <gdk/gdkkeysyms.h> | |
29 #include <pthread.h> | |
30 | |
31 #define IS_ONE_SELECTED(wdata) (GTK_CLIST ((wdata)->listbox)->selection && GTK_CLIST ((wdata)->listbox)->selection->next == NULL) | |
32 #define IS_NONE_SELECTED(wdata) (GTK_CLIST ((wdata)->listbox)->selection == NULL) | |
33 | |
297 | 34 #define GFTP_IS_SAME_HOST_START_TRANS(wdata,trequest) \ |
35 ((wdata) != NULL && (wdata)->request != NULL && \ | |
36 (wdata)->request->datafd > 0 && !(wdata)->request->always_connected && \ | |
37 !(wdata)->request->stopable && \ | |
38 compare_request (trequest, (wdata)->request, 0)) | |
39 | |
40 #define GFTP_IS_SAME_HOST_STOP_TRANS(wdata,trequest) \ | |
41 ((wdata) != NULL && (wdata)->request != NULL && \ | |
42 (wdata)->request->datafd < 0 && !(wdata)->request->always_connected && \ | |
43 (wdata)->request->cached && !(wdata)->request->stopable && \ | |
44 trequest->datafd > 0 && !trequest->always_connected && \ | |
45 compare_request (trequest, (wdata)->request, 0)) | |
46 | |
45 | 47 #if GTK_MAJOR_VERSION == 1 |
1 | 48 #define gtk_widget_set_size_request(widget, width, height) \ |
49 gtk_widget_set_usize (widget, width, height) | |
50 #endif | |
51 | |
19 | 52 /* These 2 defines are for creating menu items with stock icons in GTK+ 2.0. |
53 If we are using version 1.2, it will disable the stock items since it's not | |
54 supported */ | |
55 | |
56 #if GTK_MAJOR_VERSION < 2 | |
57 #define MS_(a) NULL | |
58 #define MN_(a) a | |
59 #else | |
60 #define MS_(a) "<StockItem>",a | |
61 #define MN_(a) a,NULL | |
62 #endif | |
63 | |
64 /* These are used for the MakeEditDialog function. I have these types to make | |
65 it easier for creating dialogs with GTK+ 1.2 and GTK+ 2.0 */ | |
66 | |
67 typedef enum gftp_dialog_button_tag | |
68 { | |
69 gftp_dialog_button_create, | |
70 gftp_dialog_button_change, | |
71 gftp_dialog_button_connect, | |
72 gftp_dialog_button_rename, | |
73 gftp_dialog_button_ok | |
74 } gftp_dialog_button; | |
75 | |
1 | 76 typedef struct gftp_window_data_tag |
77 { | |
78 GtkWidget *combo, /* Entry widget/history for the user to enter | |
79 a directory */ | |
80 *hoststxt, /* Show which directory we're in */ | |
81 *listbox; /* Our listbox showing the files */ | |
37 | 82 unsigned int sorted : 1, /* Is the output sorted? */ |
1 | 83 show_selected : 1, /* Show only selected files */ |
84 *histlen; /* Pointer to length of history */ | |
85 char *filespec; /* Filespec for the listbox */ | |
86 gftp_request * request; /* The host that we are connected to */ | |
87 GList * files, /* Files in the listbox */ | |
88 ** history; /* History of the directories */ | |
89 GtkItemFactory *ifactory; /* This is for the menus that will | |
90 come up when you right click */ | |
91 pthread_t tid; /* Thread for the stop button */ | |
129 | 92 char *prefix_col_str; |
1 | 93 } gftp_window_data; |
94 | |
95 | |
355 | 96 typedef struct _gftpui_gtk_thread_data |
97 { | |
98 void * (*func) (void *); | |
99 gftpui_callback_data * cdata; | |
100 } gftpui_gtk_thread_data; | |
101 | |
102 | |
1 | 103 typedef struct gftp_graphic_tag |
104 { | |
105 char * filename; | |
106 GdkPixmap * pixmap; | |
107 GdkBitmap * bitmap; | |
108 } gftp_graphic; | |
109 | |
110 | |
111 typedef struct gftp_dialog_data_tag | |
112 { | |
19 | 113 GtkWidget * dialog, |
114 * checkbox, | |
115 * edit; | |
116 | |
117 void (*yesfunc) (); | |
118 gpointer yespointer; | |
119 | |
120 void (*nofunc) (); | |
121 gpointer nopointer; | |
1 | 122 } gftp_dialog_data; |
123 | |
124 | |
125 typedef struct gftp_viewedit_data_tag | |
126 { | |
127 char *filename, /* File we are viewing/editing currently */ | |
128 *remote_filename; /* The filename on the remote computer */ | |
129 struct stat st; /* Vital file statistics */ | |
130 pid_t pid; /* Our process id */ | |
131 char **argv; /* Our arguments we passed to execvp. We will | |
132 free it when the process terminates. This | |
133 is the safest place to free this */ | |
134 unsigned int view : 1, /* View or edit this file */ | |
135 rm : 1, /* Delete this file after we're done with it */ | |
136 dontupload : 1; /* Don't upload this file after we're done | |
137 editing it */ | |
138 gftp_window_data * fromwdata, /* The window we are viewing this file in */ | |
139 * towdata; | |
294 | 140 gftp_request * torequest; |
1 | 141 } gftp_viewedit_data; |
142 | |
143 | |
144 typedef struct gftp_curtrans_data_tag | |
145 { | |
146 gftp_transfer * transfer; | |
147 GList * curfle; | |
148 } gftp_curtrans_data; | |
149 | |
150 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
151 typedef struct gftp_save_dir_struct_tag |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
152 { |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
153 GtkWidget * filew; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
154 gftp_window_data * wdata; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
155 } gftp_save_dir_struct; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
156 |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
157 |
136 | 158 typedef struct gftp_textcomboedt_widget_data_tag |
159 { | |
160 GtkWidget * combo, | |
161 * text; | |
162 gftp_config_vars * cv; | |
139 | 163 char * custom_edit_value; |
136 | 164 } gftp_textcomboedt_widget_data; |
165 | |
166 | |
167 typedef struct gftp_options_dialog_data_tag | |
168 { | |
169 GtkWidget * dialog, | |
170 * notebook, | |
171 * box, | |
172 * table; | |
173 int tbl_col_num, | |
174 tbl_row_num; | |
175 gftp_option_type_enum last_option; | |
229 | 176 gftp_bookmarks_var * bm; |
136 | 177 } gftp_options_dialog_data; |
178 | |
179 | |
1 | 180 extern gftp_window_data window1, window2, * other_wdata, * current_wdata; |
181 extern GtkWidget * stop_btn, * hostedit, * useredit, * passedit, | |
341 | 182 * portedit, * logwdw, * dlwdw, * protocol_menu, * optionmenu, |
183 * gftpui_command_widget; | |
1 | 184 extern GtkAdjustment * logwdw_vadj; |
45 | 185 #if GTK_MAJOR_VERSION > 1 |
1 | 186 extern GtkTextMark * logwdw_textmark; |
187 #endif | |
188 extern int local_start, remote_start, trans_start, log_start, tools_start; | |
189 extern GHashTable * graphic_hash_table; | |
190 extern GtkItemFactoryEntry * menus; | |
191 extern GtkItemFactory * factory; | |
192 extern pthread_mutex_t transfer_mutex, log_mutex; | |
19 | 193 extern gftp_graphic * gftp_icon; |
56 | 194 extern pthread_t main_thread_id; |
129 | 195 extern GList * viewedit_processes; |
196 extern volatile sig_atomic_t viewedit_process_done; | |
197 | |
1 | 198 |
199 /* bookmarks.c */ | |
200 void run_bookmark ( gpointer data ); | |
201 | |
202 void add_bookmark ( gpointer data ); | |
203 | |
204 void edit_bookmarks ( gpointer data ); | |
205 | |
206 void build_bookmarks_menu ( void ); | |
207 | |
208 /* chmod_dialog.c */ | |
209 void chmod_dialog ( gpointer data ); | |
210 | |
211 /* delete_dialog.c */ | |
212 void delete_dialog ( gpointer data ); | |
213 | |
214 /* dnd.c */ | |
215 void openurl_get_drag_data ( GtkWidget * widget, | |
216 GdkDragContext * context, | |
217 gint x, | |
218 gint y, | |
219 GtkSelectionData * selection_data, | |
220 guint info, | |
221 guint32 clk_time, | |
222 gpointer data ); | |
223 | |
224 void listbox_drag ( GtkWidget * widget, | |
225 GdkDragContext * context, | |
226 GtkSelectionData * selection_data, | |
227 guint info, | |
228 guint32 clk_time, | |
229 gpointer data ); | |
230 | |
231 void listbox_get_drag_data ( GtkWidget * widget, | |
232 GdkDragContext * context, | |
233 gint x, | |
234 gint y, | |
235 GtkSelectionData * selection_data, | |
236 guint info, | |
237 guint32 clk_time, | |
238 gpointer data ); | |
239 | |
240 /* gftp-gtk.c */ | |
241 void toolbar_hostedit ( GtkWidget * widget, | |
242 gpointer data ); | |
243 | |
244 void sortrows ( GtkCList * clist, | |
245 gint column, | |
246 gpointer data ); | |
247 | |
248 void stop_button ( GtkWidget * widget, | |
249 gpointer data ); | |
250 | |
341 | 251 void gftpui_show_or_hide_command ( void ); |
252 | |
253 /* gtkui.c */ | |
254 void gftpui_run_command ( GtkWidget * widget, | |
255 gpointer data ); | |
256 | |
257 void gftpui_run_function_callback ( gftp_window_data * wdata, | |
258 gftp_dialog_data * ddata ); | |
259 | |
260 void gftpui_run_function_cancel_callback ( gftp_window_data * wdata, | |
261 gftp_dialog_data * ddata ); | |
262 | |
263 void gftpui_mkdir_dialog ( gpointer data ); | |
264 | |
265 void gftpui_rename_dialog ( gpointer data ); | |
266 | |
267 void gftpui_site_dialog ( gpointer data ); | |
268 | |
269 int gftpui_run_chdir ( gpointer uidata, | |
270 char *directory ); | |
271 | |
272 void gftpui_chdir_dialog ( gpointer data ); | |
273 | |
1 | 274 /* menu_items.c */ |
275 void change_setting ( gftp_window_data *wdata, | |
276 int menuitem, | |
277 GtkWidget * checkmenu ); | |
278 | |
279 void tb_openurl_dialog ( gpointer data ); | |
280 | |
281 void openurl_dialog ( gpointer data ); | |
282 | |
283 void disconnect ( gpointer data ); | |
284 | |
285 void change_filespec ( gpointer data ); | |
286 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
287 void save_directory_listing ( gpointer data ); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
288 |
1 | 289 void show_selected ( gpointer data ); |
290 | |
291 void selectall ( gpointer data ); | |
292 | |
293 void selectallfiles ( gpointer data ); | |
294 | |
295 void deselectall ( gpointer data ); | |
296 | |
297 int chdir_edit ( GtkWidget * widget, | |
298 gpointer data ); | |
299 | |
300 void clearlog ( gpointer data ); | |
301 | |
302 void viewlog ( gpointer data ); | |
303 | |
304 void savelog ( gpointer data ); | |
305 | |
306 void clear_cache ( gpointer data ); | |
307 | |
227 | 308 void compare_windows ( gpointer data ); |
309 | |
310 void about_dialog ( gpointer data ); | |
1 | 311 |
312 /* misc-gtk.c */ | |
313 void fix_display ( void ); | |
314 | |
315 void remove_files_window ( gftp_window_data * wdata ); | |
316 | |
317 void ftp_log ( gftp_logging_level level, | |
186 | 318 gftp_request * request, |
1 | 319 const char *string, |
338 | 320 ... ) GFTP_LOG_FUNCTION_ATTRIBUTES; |
1 | 321 |
322 void update_window_info ( void ); | |
323 | |
324 void update_window ( gftp_window_data * wdata ); | |
325 | |
326 GtkWidget * toolbar_pixmap ( GtkWidget * widget, | |
327 char *filename ); | |
328 | |
329 gftp_graphic * open_xpm ( GtkWidget * widget, | |
330 char *filename ); | |
331 | |
332 void gftp_free_pixmap ( char *filename ); | |
333 | |
334 void gftp_get_pixmap ( GtkWidget * widget, | |
335 char *filename, | |
336 GdkPixmap ** pix, | |
337 GdkBitmap ** bitmap ); | |
338 | |
339 int check_status ( char *name, | |
340 gftp_window_data * wdata, | |
341 int check_other_stop, | |
342 int only_one, | |
343 int at_least_one, | |
344 int func ); | |
345 | |
7 | 346 GtkItemFactory *item_factory_new ( GtkType container_type, |
347 const char *path, | |
348 GtkAccelGroup *accel_group, | |
349 const char *strip_prefix ); | |
350 | |
1 | 351 void create_item_factory ( GtkItemFactory * ifactory, |
352 guint n_entries, | |
353 GtkItemFactoryEntry * entries, | |
354 gpointer callback_data ); | |
355 | |
356 void add_history ( GtkWidget * widget, | |
357 GList ** history, | |
358 unsigned int *histlen, | |
359 const char *str ); | |
360 | |
361 int check_reconnect ( gftp_window_data * wdata ); | |
362 | |
363 void add_file_listbox ( gftp_window_data * wdata, | |
364 gftp_file * fle ); | |
365 | |
366 void MakeEditDialog ( char *diagtxt, | |
367 char *infotxt, | |
368 char *deftext, | |
19 | 369 int passwd_item, |
370 char *checktext, | |
371 gftp_dialog_button okbutton, | |
1 | 372 void (*okfunc) (), |
373 void *okptr, | |
374 void (*cancelfunc) (), | |
375 void *cancelptr ); | |
376 | |
377 void MakeYesNoDialog ( char *diagtxt, | |
378 char *infotxt, | |
19 | 379 void (*yesfunc) (), |
380 gpointer yespointer, | |
381 void (*nofunc) (), | |
382 gpointer nopointer ); | |
1 | 383 |
384 void update_directory_download_progress ( gftp_transfer * transfer ); | |
385 | |
386 int progress_timeout ( gpointer data ); | |
387 | |
388 void display_cached_logs ( void ); | |
389 | |
201 | 390 char * get_xpm_path ( char *filename, |
391 int quit_on_err ); | |
392 | |
227 | 393 /* options_dialog.c */ |
394 void options_dialog ( gpointer data ); | |
395 | |
229 | 396 void gftp_gtk_setup_bookmark_options ( GtkWidget * notebook, |
397 gftp_bookmarks_var * bm ); | |
227 | 398 |
229 | 399 void gftp_gtk_save_bookmark_options ( gftp_bookmarks_var * bm ); |
227 | 400 |
1 | 401 /* transfer.c */ |
402 int ftp_list_files ( gftp_window_data * wdata, | |
403 int usecache ); | |
404 | |
405 int ftp_connect ( gftp_window_data * wdata, | |
406 gftp_request * request, | |
407 int getdir ); | |
408 | |
409 gint update_downloads ( gpointer data ); | |
410 | |
411 void * gftp_gtk_transfer_files ( void *data ); | |
412 | |
413 void get_files ( gpointer data ); | |
414 | |
415 void put_files ( gpointer data ); | |
416 | |
417 void transfer_window_files ( gftp_window_data * fromwdata, | |
418 gftp_window_data * towdata ); | |
419 | |
420 void *do_getdir_thread ( void * data ); | |
421 | |
303 | 422 gftp_transfer * add_file_transfer ( gftp_request * fromreq, |
1 | 423 gftp_request * toreq, |
424 gftp_window_data * fromwdata, | |
425 gftp_window_data * towdata, | |
426 GList * files, | |
427 int copy_req ); | |
428 | |
429 void start_transfer ( gpointer data ); | |
430 | |
431 void stop_transfer ( gpointer data ); | |
432 | |
433 void skip_transfer ( gpointer data ); | |
434 | |
435 void remove_file_transfer ( gpointer data ); | |
436 | |
437 void move_transfer_up ( gpointer data ); | |
438 | |
439 void move_transfer_down ( gpointer data ); | |
440 | |
441 void gftp_gtk_ask_transfer ( gftp_transfer * tdata ); | |
442 | |
443 /* view_dialog.c */ | |
444 void edit_dialog ( gpointer data ); | |
445 | |
446 void view_dialog ( gpointer data ); | |
447 | |
448 void view_file ( char *filename, | |
449 int fd, | |
450 int viewedit, | |
451 int del_file, | |
452 int start_pos, | |
453 int dontupload, | |
454 char *remote_filename, | |
455 gftp_window_data * wdata ); | |
456 | |
457 #endif | |
458 |