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