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