Mercurial > gftp.yaz
annotate src/gtk/gftp-gtk.h @ 470:a68273d9725a
2004-5-16 Brian Masney <masneyb@gftp.org>
* src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h src/gtk/transfer.c - fixed
detection of SIGCHLD when viewing/editing a file (from
Aurelien Jarno <aurelien@aurel32.net>)
* src/gtk/gtkui.c - expand the path on the client side when changing
the remote directory (i.e. CHDIR /home/.. becomes /home)
(from Aurelien Jarno <aurelien@aurel32.net>)
author | masneyb |
---|---|
date | Sun, 16 May 2004 13:34:02 +0000 |
parents | 8fc4efa3f72d |
children | 937f2b75bbee |
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 | |
1 | 190 |
191 /* bookmarks.c */ | |
192 void run_bookmark ( gpointer data ); | |
193 | |
194 void add_bookmark ( gpointer data ); | |
195 | |
196 void edit_bookmarks ( gpointer data ); | |
197 | |
198 void build_bookmarks_menu ( void ); | |
199 | |
200 /* chmod_dialog.c */ | |
201 void chmod_dialog ( gpointer data ); | |
202 | |
203 /* delete_dialog.c */ | |
204 void delete_dialog ( gpointer data ); | |
205 | |
206 /* dnd.c */ | |
207 void openurl_get_drag_data ( GtkWidget * widget, | |
208 GdkDragContext * context, | |
209 gint x, | |
210 gint y, | |
211 GtkSelectionData * selection_data, | |
212 guint info, | |
213 guint32 clk_time, | |
214 gpointer data ); | |
215 | |
216 void listbox_drag ( GtkWidget * widget, | |
217 GdkDragContext * context, | |
218 GtkSelectionData * selection_data, | |
219 guint info, | |
220 guint32 clk_time, | |
221 gpointer data ); | |
222 | |
223 void listbox_get_drag_data ( GtkWidget * widget, | |
224 GdkDragContext * context, | |
225 gint x, | |
226 gint y, | |
227 GtkSelectionData * selection_data, | |
228 guint info, | |
229 guint32 clk_time, | |
230 gpointer data ); | |
231 | |
232 /* gftp-gtk.c */ | |
233 void toolbar_hostedit ( GtkWidget * widget, | |
234 gpointer data ); | |
235 | |
236 void sortrows ( GtkCList * clist, | |
237 gint column, | |
238 gpointer data ); | |
239 | |
240 void stop_button ( GtkWidget * widget, | |
241 gpointer data ); | |
242 | |
341 | 243 void gftpui_show_or_hide_command ( void ); |
244 | |
245 /* gtkui.c */ | |
246 void gftpui_run_command ( GtkWidget * widget, | |
247 gpointer data ); | |
248 | |
249 void gftpui_run_function_callback ( gftp_window_data * wdata, | |
250 gftp_dialog_data * ddata ); | |
251 | |
252 void gftpui_run_function_cancel_callback ( gftp_window_data * wdata, | |
253 gftp_dialog_data * ddata ); | |
254 | |
255 void gftpui_mkdir_dialog ( gpointer data ); | |
256 | |
257 void gftpui_rename_dialog ( gpointer data ); | |
258 | |
259 void gftpui_site_dialog ( gpointer data ); | |
260 | |
261 int gftpui_run_chdir ( gpointer uidata, | |
262 char *directory ); | |
263 | |
264 void gftpui_chdir_dialog ( gpointer data ); | |
265 | |
397 | 266 char * gftpui_gtk_get_utf8_file_pos ( gftp_file * fle ); |
267 | |
1 | 268 /* menu_items.c */ |
269 void change_filespec ( gpointer data ); | |
270 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
271 void save_directory_listing ( gpointer data ); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
272 |
1 | 273 void show_selected ( gpointer data ); |
274 | |
275 void selectall ( gpointer data ); | |
276 | |
277 void selectallfiles ( gpointer data ); | |
278 | |
279 void deselectall ( gpointer data ); | |
280 | |
281 int chdir_edit ( GtkWidget * widget, | |
282 gpointer data ); | |
283 | |
284 void clearlog ( gpointer data ); | |
285 | |
286 void viewlog ( gpointer data ); | |
287 | |
288 void savelog ( gpointer data ); | |
289 | |
290 void clear_cache ( gpointer data ); | |
291 | |
227 | 292 void compare_windows ( gpointer data ); |
293 | |
294 void about_dialog ( gpointer data ); | |
1 | 295 |
296 /* misc-gtk.c */ | |
297 void fix_display ( void ); | |
298 | |
299 void remove_files_window ( gftp_window_data * wdata ); | |
300 | |
301 void ftp_log ( gftp_logging_level level, | |
186 | 302 gftp_request * request, |
1 | 303 const char *string, |
338 | 304 ... ) GFTP_LOG_FUNCTION_ATTRIBUTES; |
1 | 305 |
306 void update_window_info ( void ); | |
307 | |
308 void update_window ( gftp_window_data * wdata ); | |
309 | |
310 GtkWidget * toolbar_pixmap ( GtkWidget * widget, | |
311 char *filename ); | |
312 | |
313 gftp_graphic * open_xpm ( GtkWidget * widget, | |
314 char *filename ); | |
315 | |
316 void gftp_free_pixmap ( char *filename ); | |
317 | |
318 void gftp_get_pixmap ( GtkWidget * widget, | |
319 char *filename, | |
320 GdkPixmap ** pix, | |
321 GdkBitmap ** bitmap ); | |
322 | |
323 int check_status ( char *name, | |
324 gftp_window_data * wdata, | |
325 int check_other_stop, | |
326 int only_one, | |
327 int at_least_one, | |
328 int func ); | |
329 | |
7 | 330 GtkItemFactory *item_factory_new ( GtkType container_type, |
331 const char *path, | |
332 GtkAccelGroup *accel_group, | |
333 const char *strip_prefix ); | |
334 | |
1 | 335 void create_item_factory ( GtkItemFactory * ifactory, |
336 guint n_entries, | |
337 GtkItemFactoryEntry * entries, | |
338 gpointer callback_data ); | |
339 | |
340 void add_history ( GtkWidget * widget, | |
341 GList ** history, | |
342 unsigned int *histlen, | |
343 const char *str ); | |
344 | |
345 int check_reconnect ( gftp_window_data * wdata ); | |
346 | |
347 void add_file_listbox ( gftp_window_data * wdata, | |
348 gftp_file * fle ); | |
349 | |
425 | 350 void destroy_dialog ( gftp_dialog_data * ddata ); |
351 | |
1 | 352 void MakeEditDialog ( char *diagtxt, |
353 char *infotxt, | |
354 char *deftext, | |
19 | 355 int passwd_item, |
356 char *checktext, | |
357 gftp_dialog_button okbutton, | |
1 | 358 void (*okfunc) (), |
359 void *okptr, | |
360 void (*cancelfunc) (), | |
361 void *cancelptr ); | |
362 | |
363 void MakeYesNoDialog ( char *diagtxt, | |
364 char *infotxt, | |
19 | 365 void (*yesfunc) (), |
366 gpointer yespointer, | |
367 void (*nofunc) (), | |
368 gpointer nopointer ); | |
1 | 369 |
370 void update_directory_download_progress ( gftp_transfer * transfer ); | |
371 | |
372 int progress_timeout ( gpointer data ); | |
373 | |
374 void display_cached_logs ( void ); | |
375 | |
201 | 376 char * get_xpm_path ( char *filename, |
377 int quit_on_err ); | |
378 | |
227 | 379 /* options_dialog.c */ |
380 void options_dialog ( gpointer data ); | |
381 | |
229 | 382 void gftp_gtk_setup_bookmark_options ( GtkWidget * notebook, |
383 gftp_bookmarks_var * bm ); | |
227 | 384 |
229 | 385 void gftp_gtk_save_bookmark_options ( gftp_bookmarks_var * bm ); |
227 | 386 |
1 | 387 /* transfer.c */ |
388 int ftp_list_files ( gftp_window_data * wdata, | |
389 int usecache ); | |
390 | |
391 int ftp_connect ( gftp_window_data * wdata, | |
392 gftp_request * request, | |
393 int getdir ); | |
394 | |
395 gint update_downloads ( gpointer data ); | |
396 | |
397 void get_files ( gpointer data ); | |
398 | |
399 void put_files ( gpointer data ); | |
400 | |
401 void transfer_window_files ( gftp_window_data * fromwdata, | |
402 gftp_window_data * towdata ); | |
403 | |
404 void *do_getdir_thread ( void * data ); | |
405 | |
406 void start_transfer ( gpointer data ); | |
407 | |
408 void stop_transfer ( gpointer data ); | |
409 | |
410 void skip_transfer ( gpointer data ); | |
411 | |
412 void remove_file_transfer ( gpointer data ); | |
413 | |
414 void move_transfer_up ( gpointer data ); | |
415 | |
416 void move_transfer_down ( gpointer data ); | |
417 | |
418 /* view_dialog.c */ | |
419 void edit_dialog ( gpointer data ); | |
420 | |
421 void view_dialog ( gpointer data ); | |
422 | |
423 void view_file ( char *filename, | |
424 int fd, | |
425 int viewedit, | |
426 int del_file, | |
427 int start_pos, | |
428 int dontupload, | |
429 char *remote_filename, | |
430 gftp_window_data * wdata ); | |
431 | |
432 #endif | |
433 |