Mercurial > gftp.yaz
annotate src/gtk/gftp-gtk.h @ 326:cdabbe5c9a95
2003-12-4 Brian Masney <masneyb@gftp.org>
* src/gftp.in - check for the bin_dir for the binary location
* lib/cache.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c
lib/sshv2.c lib/sslcommon.c src/text/gftp-text.c src/gtk/chmod_dialog.c
src/gtk/gftp-gtk.c src/gtk/menu-items.c src/gtk/misc-gtk.c
src/gtk/mkdir_dialog.c src/gtk/rename_dialog.c src/gtk/transfer.c -
when calling gftp_lookup_global_option() or
gftp_lookup_request_option(), if the value is an integer, declare
the variable type to be intptr_t. This fixes a bug on 64bit platforms
(from Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>)
* lib/config_file.c (gftp_config_file_read_float) - 64bit fixup
* configure.in - increment version to 2.0.17pre0. Undefine _GNU_SOURCE.
Check for stdint.h.
* lib/gftp.h - include stdint.h if it is found on the system.
* src/gtk/gftp-gtk.c (CreateToolbar) - on startup, have the host edit
box grab the keyboard focus
author | masneyb |
---|---|
date | Fri, 05 Dec 2003 00:21:15 +0000 |
parents | 3b9d5797050f |
children | 0f34108f27b7 |
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" | |
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 | |
297 | 33 #define GFTP_IS_SAME_HOST_START_TRANS(wdata,trequest) \ |
34 ((wdata) != NULL && (wdata)->request != NULL && \ | |
35 (wdata)->request->datafd > 0 && !(wdata)->request->always_connected && \ | |
36 !(wdata)->request->stopable && \ | |
37 compare_request (trequest, (wdata)->request, 0)) | |
38 | |
39 #define GFTP_IS_SAME_HOST_STOP_TRANS(wdata,trequest) \ | |
40 ((wdata) != NULL && (wdata)->request != NULL && \ | |
41 (wdata)->request->datafd < 0 && !(wdata)->request->always_connected && \ | |
42 (wdata)->request->cached && !(wdata)->request->stopable && \ | |
43 trequest->datafd > 0 && !trequest->always_connected && \ | |
44 compare_request (trequest, (wdata)->request, 0)) | |
45 | |
45 | 46 #if GTK_MAJOR_VERSION == 1 |
1 | 47 #define gtk_widget_set_size_request(widget, width, height) \ |
48 gtk_widget_set_usize (widget, width, height) | |
49 #endif | |
50 | |
19 | 51 /* These 2 defines are for creating menu items with stock icons in GTK+ 2.0. |
52 If we are using version 1.2, it will disable the stock items since it's not | |
53 supported */ | |
54 | |
55 #if GTK_MAJOR_VERSION < 2 | |
56 #define MS_(a) NULL | |
57 #define MN_(a) a | |
58 #else | |
59 #define MS_(a) "<StockItem>",a | |
60 #define MN_(a) a,NULL | |
61 #endif | |
62 | |
63 /* These are used for the MakeEditDialog function. I have these types to make | |
64 it easier for creating dialogs with GTK+ 1.2 and GTK+ 2.0 */ | |
65 | |
66 typedef enum gftp_dialog_button_tag | |
67 { | |
68 gftp_dialog_button_create, | |
69 gftp_dialog_button_change, | |
70 gftp_dialog_button_connect, | |
71 gftp_dialog_button_rename, | |
72 gftp_dialog_button_ok | |
73 } gftp_dialog_button; | |
74 | |
1 | 75 typedef struct gftp_window_data_tag |
76 { | |
77 GtkWidget *combo, /* Entry widget/history for the user to enter | |
78 a directory */ | |
79 *hoststxt, /* Show which directory we're in */ | |
80 *listbox; /* Our listbox showing the files */ | |
37 | 81 unsigned int sorted : 1, /* Is the output sorted? */ |
1 | 82 show_selected : 1, /* Show only selected files */ |
83 *histlen; /* Pointer to length of history */ | |
84 char *filespec; /* Filespec for the listbox */ | |
85 gftp_request * request; /* The host that we are connected to */ | |
86 GList * files, /* Files in the listbox */ | |
87 ** history; /* History of the directories */ | |
88 GtkItemFactory *ifactory; /* This is for the menus that will | |
89 come up when you right click */ | |
90 pthread_t tid; /* Thread for the stop button */ | |
129 | 91 char *prefix_col_str; |
1 | 92 } gftp_window_data; |
93 | |
94 | |
95 typedef struct gftp_graphic_tag | |
96 { | |
97 char * filename; | |
98 GdkPixmap * pixmap; | |
99 GdkBitmap * bitmap; | |
100 } gftp_graphic; | |
101 | |
102 | |
103 typedef struct gftp_dialog_data_tag | |
104 { | |
19 | 105 GtkWidget * dialog, |
106 * checkbox, | |
107 * edit; | |
108 | |
109 void (*yesfunc) (); | |
110 gpointer yespointer; | |
111 | |
112 void (*nofunc) (); | |
113 gpointer nopointer; | |
1 | 114 } gftp_dialog_data; |
115 | |
116 | |
117 typedef struct gftp_viewedit_data_tag | |
118 { | |
119 char *filename, /* File we are viewing/editing currently */ | |
120 *remote_filename; /* The filename on the remote computer */ | |
121 struct stat st; /* Vital file statistics */ | |
122 pid_t pid; /* Our process id */ | |
123 char **argv; /* Our arguments we passed to execvp. We will | |
124 free it when the process terminates. This | |
125 is the safest place to free this */ | |
126 unsigned int view : 1, /* View or edit this file */ | |
127 rm : 1, /* Delete this file after we're done with it */ | |
128 dontupload : 1; /* Don't upload this file after we're done | |
129 editing it */ | |
130 gftp_window_data * fromwdata, /* The window we are viewing this file in */ | |
131 * towdata; | |
294 | 132 gftp_request * torequest; |
1 | 133 } gftp_viewedit_data; |
134 | |
135 | |
136 typedef struct gftp_curtrans_data_tag | |
137 { | |
138 gftp_transfer * transfer; | |
139 GList * curfle; | |
140 } gftp_curtrans_data; | |
141 | |
142 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
143 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
|
144 { |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
145 GtkWidget * filew; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
146 gftp_window_data * wdata; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
147 } gftp_save_dir_struct; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
148 |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
149 |
136 | 150 typedef struct gftp_textcomboedt_widget_data_tag |
151 { | |
152 GtkWidget * combo, | |
153 * text; | |
154 gftp_config_vars * cv; | |
139 | 155 char * custom_edit_value; |
136 | 156 } gftp_textcomboedt_widget_data; |
157 | |
158 | |
159 typedef struct gftp_options_dialog_data_tag | |
160 { | |
161 GtkWidget * dialog, | |
162 * notebook, | |
163 * box, | |
164 * table; | |
165 int tbl_col_num, | |
166 tbl_row_num; | |
167 gftp_option_type_enum last_option; | |
229 | 168 gftp_bookmarks_var * bm; |
136 | 169 } gftp_options_dialog_data; |
170 | |
171 | |
1 | 172 extern gftp_window_data window1, window2, * other_wdata, * current_wdata; |
173 extern GtkWidget * stop_btn, * hostedit, * useredit, * passedit, | |
174 * portedit, * logwdw, * dlwdw, * protocol_menu, * optionmenu; | |
175 extern GtkAdjustment * logwdw_vadj; | |
45 | 176 #if GTK_MAJOR_VERSION > 1 |
1 | 177 extern GtkTextMark * logwdw_textmark; |
178 #endif | |
179 extern int local_start, remote_start, trans_start, log_start, tools_start; | |
180 extern GHashTable * graphic_hash_table; | |
181 extern GtkItemFactoryEntry * menus; | |
182 extern GtkItemFactory * factory; | |
183 extern pthread_mutex_t transfer_mutex, log_mutex; | |
19 | 184 extern gftp_graphic * gftp_icon; |
42 | 185 extern sigjmp_buf jmp_environment; |
186 extern volatile int use_jmp_environment; | |
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 | |
244 /* menu_items.c */ | |
245 void change_setting ( gftp_window_data *wdata, | |
246 int menuitem, | |
247 GtkWidget * checkmenu ); | |
248 | |
249 void tb_openurl_dialog ( gpointer data ); | |
250 | |
251 void openurl_dialog ( gpointer data ); | |
252 | |
253 void disconnect ( gpointer data ); | |
254 | |
255 void change_filespec ( gpointer data ); | |
256 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
257 void save_directory_listing ( gpointer data ); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
258 |
1 | 259 void show_selected ( gpointer data ); |
260 | |
261 void selectall ( gpointer data ); | |
262 | |
263 void selectallfiles ( gpointer data ); | |
264 | |
265 void deselectall ( gpointer data ); | |
266 | |
267 void site_dialog ( gpointer data ); | |
268 | |
269 int chdir_edit ( GtkWidget * widget, | |
270 gpointer data ); | |
271 | |
272 int chdir_dialog ( gpointer data ); | |
273 | |
274 void clearlog ( gpointer data ); | |
275 | |
276 void viewlog ( gpointer data ); | |
277 | |
278 void savelog ( gpointer data ); | |
279 | |
280 void clear_cache ( gpointer data ); | |
281 | |
227 | 282 void compare_windows ( gpointer data ); |
283 | |
284 void about_dialog ( gpointer data ); | |
1 | 285 |
286 /* misc-gtk.c */ | |
287 void fix_display ( void ); | |
288 | |
289 void remove_files_window ( gftp_window_data * wdata ); | |
290 | |
291 void ftp_log ( gftp_logging_level level, | |
186 | 292 gftp_request * request, |
1 | 293 const char *string, |
233 | 294 ... ) __attribute__((format(printf, 3, 4))); |
1 | 295 |
296 void refresh ( gftp_window_data * wdata ); | |
297 | |
298 void update_window_info ( void ); | |
299 | |
300 void update_window ( gftp_window_data * wdata ); | |
301 | |
302 GtkWidget * toolbar_pixmap ( GtkWidget * widget, | |
303 char *filename ); | |
304 | |
305 gftp_graphic * open_xpm ( GtkWidget * widget, | |
306 char *filename ); | |
307 | |
308 void gftp_free_pixmap ( char *filename ); | |
309 | |
310 void gftp_get_pixmap ( GtkWidget * widget, | |
311 char *filename, | |
312 GdkPixmap ** pix, | |
313 GdkBitmap ** bitmap ); | |
314 | |
315 int check_status ( char *name, | |
316 gftp_window_data * wdata, | |
317 int check_other_stop, | |
318 int only_one, | |
319 int at_least_one, | |
320 int func ); | |
321 | |
7 | 322 GtkItemFactory *item_factory_new ( GtkType container_type, |
323 const char *path, | |
324 GtkAccelGroup *accel_group, | |
325 const char *strip_prefix ); | |
326 | |
1 | 327 void create_item_factory ( GtkItemFactory * ifactory, |
328 guint n_entries, | |
329 GtkItemFactoryEntry * entries, | |
330 gpointer callback_data ); | |
331 | |
332 void add_history ( GtkWidget * widget, | |
333 GList ** history, | |
334 unsigned int *histlen, | |
335 const char *str ); | |
336 | |
337 int check_reconnect ( gftp_window_data * wdata ); | |
338 | |
339 void add_file_listbox ( gftp_window_data * wdata, | |
340 gftp_file * fle ); | |
341 | |
342 void MakeEditDialog ( char *diagtxt, | |
343 char *infotxt, | |
344 char *deftext, | |
19 | 345 int passwd_item, |
346 char *checktext, | |
347 gftp_dialog_button okbutton, | |
1 | 348 void (*okfunc) (), |
349 void *okptr, | |
350 void (*cancelfunc) (), | |
351 void *cancelptr ); | |
352 | |
353 void MakeYesNoDialog ( char *diagtxt, | |
354 char *infotxt, | |
19 | 355 void (*yesfunc) (), |
356 gpointer yespointer, | |
357 void (*nofunc) (), | |
358 gpointer nopointer ); | |
1 | 359 |
360 void update_directory_download_progress ( gftp_transfer * transfer ); | |
361 | |
362 void *generic_thread ( void * (*func) | |
363 (void *), | |
364 gftp_window_data * wdata ); | |
365 | |
366 int progress_timeout ( gpointer data ); | |
367 | |
368 void display_cached_logs ( void ); | |
369 | |
42 | 370 RETSIGTYPE signal_handler (int signo); |
371 | |
201 | 372 char * get_xpm_path ( char *filename, |
373 int quit_on_err ); | |
374 | |
1 | 375 /* mkdir_dialog.c */ |
376 void mkdir_dialog ( gpointer data ); | |
377 | |
227 | 378 /* options_dialog.c */ |
379 void options_dialog ( gpointer data ); | |
380 | |
229 | 381 void gftp_gtk_setup_bookmark_options ( GtkWidget * notebook, |
382 gftp_bookmarks_var * bm ); | |
227 | 383 |
229 | 384 void gftp_gtk_save_bookmark_options ( gftp_bookmarks_var * bm ); |
227 | 385 |
1 | 386 /* rename_dialog.c */ |
387 void rename_dialog ( gpointer data ); | |
388 | |
389 /* transfer.c */ | |
390 int ftp_list_files ( gftp_window_data * wdata, | |
391 int usecache ); | |
392 | |
393 int ftp_connect ( gftp_window_data * wdata, | |
394 gftp_request * request, | |
395 int getdir ); | |
396 | |
397 gint update_downloads ( gpointer data ); | |
398 | |
399 void * gftp_gtk_transfer_files ( void *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 | |
408 void *do_getdir_thread ( void * data ); | |
409 | |
303 | 410 gftp_transfer * add_file_transfer ( gftp_request * fromreq, |
1 | 411 gftp_request * toreq, |
412 gftp_window_data * fromwdata, | |
413 gftp_window_data * towdata, | |
414 GList * files, | |
415 int copy_req ); | |
416 | |
417 void start_transfer ( gpointer data ); | |
418 | |
419 void stop_transfer ( gpointer data ); | |
420 | |
421 void skip_transfer ( gpointer data ); | |
422 | |
423 void remove_file_transfer ( gpointer data ); | |
424 | |
425 void move_transfer_up ( gpointer data ); | |
426 | |
427 void move_transfer_down ( gpointer data ); | |
428 | |
429 void gftp_gtk_ask_transfer ( gftp_transfer * tdata ); | |
430 | |
431 /* view_dialog.c */ | |
432 void edit_dialog ( gpointer data ); | |
433 | |
434 void view_dialog ( gpointer data ); | |
435 | |
436 void view_file ( char *filename, | |
437 int fd, | |
438 int viewedit, | |
439 int del_file, | |
440 int start_pos, | |
441 int dontupload, | |
442 char *remote_filename, | |
443 gftp_window_data * wdata ); | |
444 | |
445 #endif | |
446 |