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