Mercurial > gftp.yaz
annotate src/gtk/gftp-gtk.h @ 367:d5409bf03ff1
2003-1-18 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_parse_url) - if the URL is the local filesystem, skip over the whitespace at the beginning.
* lib/rfc959.c (rfc959_syst) - allow the string MVS and OS/MVS for the
MVS directory listings.
* src/gtk/gtkui_transfer.c src/gtk/transfer.c src/gtk/gftpui.c -
started to move the transfer functionality into the uicommon directory.
Added the text and GTK+ UI specific transfer functions.
* src/gtk/Makefile.am po/POTFILES.in - added gtkui_transfer.c
* src/gtk/dnd.c src/gtk/gtkui_transfer.c src/gtk/view_dialog.c -
s/add_file_transfer/gtkui_common_add_file_transfer/
* src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h - removed transfer_mutex
* src/gtk/gtkui.c src/text/textui.c - added
gftpui_add_file_to_transfer()
* src/uicommon/gftpui_callbacks.c src/uicommon/gftpui.c - in all of the
thread callback functions, don't alter the return value in the function. Return it as is.
author | masneyb |
---|---|
date | Sun, 18 Jan 2004 20:09:28 +0000 |
parents | 60d3da6ab336 |
children | d207b8241e96 |
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 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
144 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
|
145 { |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
146 GtkWidget * filew; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
147 gftp_window_data * wdata; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
148 } gftp_save_dir_struct; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
149 |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
150 |
136 | 151 typedef struct gftp_textcomboedt_widget_data_tag |
152 { | |
153 GtkWidget * combo, | |
154 * text; | |
155 gftp_config_vars * cv; | |
139 | 156 char * custom_edit_value; |
136 | 157 } gftp_textcomboedt_widget_data; |
158 | |
159 | |
160 typedef struct gftp_options_dialog_data_tag | |
161 { | |
162 GtkWidget * dialog, | |
163 * notebook, | |
164 * box, | |
165 * table; | |
166 int tbl_col_num, | |
167 tbl_row_num; | |
168 gftp_option_type_enum last_option; | |
229 | 169 gftp_bookmarks_var * bm; |
136 | 170 } gftp_options_dialog_data; |
171 | |
172 | |
1 | 173 extern gftp_window_data window1, window2, * other_wdata, * current_wdata; |
174 extern GtkWidget * stop_btn, * hostedit, * useredit, * passedit, | |
341 | 175 * portedit, * logwdw, * dlwdw, * protocol_menu, * optionmenu, |
176 * gftpui_command_widget; | |
1 | 177 extern GtkAdjustment * logwdw_vadj; |
45 | 178 #if GTK_MAJOR_VERSION > 1 |
1 | 179 extern GtkTextMark * logwdw_textmark; |
180 #endif | |
181 extern int local_start, remote_start, trans_start, log_start, tools_start; | |
182 extern GHashTable * graphic_hash_table; | |
183 extern GtkItemFactoryEntry * menus; | |
184 extern GtkItemFactory * factory; | |
367 | 185 extern pthread_mutex_t log_mutex; |
19 | 186 extern gftp_graphic * gftp_icon; |
56 | 187 extern pthread_t main_thread_id; |
129 | 188 extern GList * viewedit_processes; |
189 extern volatile sig_atomic_t viewedit_process_done; | |
190 | |
1 | 191 |
192 /* bookmarks.c */ | |
193 void run_bookmark ( gpointer data ); | |
194 | |
195 void add_bookmark ( gpointer data ); | |
196 | |
197 void edit_bookmarks ( gpointer data ); | |
198 | |
199 void build_bookmarks_menu ( void ); | |
200 | |
201 /* chmod_dialog.c */ | |
202 void chmod_dialog ( gpointer data ); | |
203 | |
204 /* delete_dialog.c */ | |
205 void delete_dialog ( gpointer data ); | |
206 | |
207 /* dnd.c */ | |
208 void openurl_get_drag_data ( GtkWidget * widget, | |
209 GdkDragContext * context, | |
210 gint x, | |
211 gint y, | |
212 GtkSelectionData * selection_data, | |
213 guint info, | |
214 guint32 clk_time, | |
215 gpointer data ); | |
216 | |
217 void listbox_drag ( GtkWidget * widget, | |
218 GdkDragContext * context, | |
219 GtkSelectionData * selection_data, | |
220 guint info, | |
221 guint32 clk_time, | |
222 gpointer data ); | |
223 | |
224 void listbox_get_drag_data ( GtkWidget * widget, | |
225 GdkDragContext * context, | |
226 gint x, | |
227 gint y, | |
228 GtkSelectionData * selection_data, | |
229 guint info, | |
230 guint32 clk_time, | |
231 gpointer data ); | |
232 | |
233 /* gftp-gtk.c */ | |
234 void toolbar_hostedit ( GtkWidget * widget, | |
235 gpointer data ); | |
236 | |
237 void sortrows ( GtkCList * clist, | |
238 gint column, | |
239 gpointer data ); | |
240 | |
241 void stop_button ( GtkWidget * widget, | |
242 gpointer data ); | |
243 | |
341 | 244 void gftpui_show_or_hide_command ( void ); |
245 | |
246 /* gtkui.c */ | |
247 void gftpui_run_command ( GtkWidget * widget, | |
248 gpointer data ); | |
249 | |
250 void gftpui_run_function_callback ( gftp_window_data * wdata, | |
251 gftp_dialog_data * ddata ); | |
252 | |
253 void gftpui_run_function_cancel_callback ( gftp_window_data * wdata, | |
254 gftp_dialog_data * ddata ); | |
255 | |
256 void gftpui_mkdir_dialog ( gpointer data ); | |
257 | |
258 void gftpui_rename_dialog ( gpointer data ); | |
259 | |
260 void gftpui_site_dialog ( gpointer data ); | |
261 | |
262 int gftpui_run_chdir ( gpointer uidata, | |
263 char *directory ); | |
264 | |
265 void gftpui_chdir_dialog ( gpointer data ); | |
266 | |
1 | 267 /* menu_items.c */ |
268 void change_setting ( gftp_window_data *wdata, | |
269 int menuitem, | |
270 GtkWidget * checkmenu ); | |
271 | |
272 void tb_openurl_dialog ( gpointer data ); | |
273 | |
274 void openurl_dialog ( gpointer data ); | |
275 | |
276 void disconnect ( gpointer data ); | |
277 | |
278 void change_filespec ( gpointer data ); | |
279 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
280 void save_directory_listing ( gpointer data ); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
281 |
1 | 282 void show_selected ( gpointer data ); |
283 | |
284 void selectall ( gpointer data ); | |
285 | |
286 void selectallfiles ( gpointer data ); | |
287 | |
288 void deselectall ( gpointer data ); | |
289 | |
290 int chdir_edit ( GtkWidget * widget, | |
291 gpointer data ); | |
292 | |
293 void clearlog ( gpointer data ); | |
294 | |
295 void viewlog ( gpointer data ); | |
296 | |
297 void savelog ( gpointer data ); | |
298 | |
299 void clear_cache ( gpointer data ); | |
300 | |
227 | 301 void compare_windows ( gpointer data ); |
302 | |
303 void about_dialog ( gpointer data ); | |
1 | 304 |
305 /* misc-gtk.c */ | |
306 void fix_display ( void ); | |
307 | |
308 void remove_files_window ( gftp_window_data * wdata ); | |
309 | |
310 void ftp_log ( gftp_logging_level level, | |
186 | 311 gftp_request * request, |
1 | 312 const char *string, |
338 | 313 ... ) GFTP_LOG_FUNCTION_ATTRIBUTES; |
1 | 314 |
315 void update_window_info ( void ); | |
316 | |
317 void update_window ( gftp_window_data * wdata ); | |
318 | |
319 GtkWidget * toolbar_pixmap ( GtkWidget * widget, | |
320 char *filename ); | |
321 | |
322 gftp_graphic * open_xpm ( GtkWidget * widget, | |
323 char *filename ); | |
324 | |
325 void gftp_free_pixmap ( char *filename ); | |
326 | |
327 void gftp_get_pixmap ( GtkWidget * widget, | |
328 char *filename, | |
329 GdkPixmap ** pix, | |
330 GdkBitmap ** bitmap ); | |
331 | |
332 int check_status ( char *name, | |
333 gftp_window_data * wdata, | |
334 int check_other_stop, | |
335 int only_one, | |
336 int at_least_one, | |
337 int func ); | |
338 | |
7 | 339 GtkItemFactory *item_factory_new ( GtkType container_type, |
340 const char *path, | |
341 GtkAccelGroup *accel_group, | |
342 const char *strip_prefix ); | |
343 | |
1 | 344 void create_item_factory ( GtkItemFactory * ifactory, |
345 guint n_entries, | |
346 GtkItemFactoryEntry * entries, | |
347 gpointer callback_data ); | |
348 | |
349 void add_history ( GtkWidget * widget, | |
350 GList ** history, | |
351 unsigned int *histlen, | |
352 const char *str ); | |
353 | |
354 int check_reconnect ( gftp_window_data * wdata ); | |
355 | |
356 void add_file_listbox ( gftp_window_data * wdata, | |
357 gftp_file * fle ); | |
358 | |
359 void MakeEditDialog ( char *diagtxt, | |
360 char *infotxt, | |
361 char *deftext, | |
19 | 362 int passwd_item, |
363 char *checktext, | |
364 gftp_dialog_button okbutton, | |
1 | 365 void (*okfunc) (), |
366 void *okptr, | |
367 void (*cancelfunc) (), | |
368 void *cancelptr ); | |
369 | |
370 void MakeYesNoDialog ( char *diagtxt, | |
371 char *infotxt, | |
19 | 372 void (*yesfunc) (), |
373 gpointer yespointer, | |
374 void (*nofunc) (), | |
375 gpointer nopointer ); | |
1 | 376 |
377 void update_directory_download_progress ( gftp_transfer * transfer ); | |
378 | |
379 int progress_timeout ( gpointer data ); | |
380 | |
381 void display_cached_logs ( void ); | |
382 | |
201 | 383 char * get_xpm_path ( char *filename, |
384 int quit_on_err ); | |
385 | |
227 | 386 /* options_dialog.c */ |
387 void options_dialog ( gpointer data ); | |
388 | |
229 | 389 void gftp_gtk_setup_bookmark_options ( GtkWidget * notebook, |
390 gftp_bookmarks_var * bm ); | |
227 | 391 |
229 | 392 void gftp_gtk_save_bookmark_options ( gftp_bookmarks_var * bm ); |
227 | 393 |
1 | 394 /* transfer.c */ |
395 int ftp_list_files ( gftp_window_data * wdata, | |
396 int usecache ); | |
397 | |
398 int ftp_connect ( gftp_window_data * wdata, | |
399 gftp_request * request, | |
400 int getdir ); | |
401 | |
402 gint update_downloads ( gpointer data ); | |
403 | |
404 void get_files ( gpointer data ); | |
405 | |
406 void put_files ( gpointer data ); | |
407 | |
408 void transfer_window_files ( gftp_window_data * fromwdata, | |
409 gftp_window_data * towdata ); | |
410 | |
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 |