Mercurial > gftp.yaz
annotate src/gtk/gftp-gtk.h @ 447:35e70b328c96
2004-3-21 Brian Masney <masneyb@gftp.org>
* src/gtk/gftp-gtk.c - initialize the read/write color functions before
gftp is initialized
author | masneyb |
---|---|
date | Sun, 21 Mar 2004 23:56:18 +0000 |
parents | 8fc4efa3f72d |
children | a68273d9725a |
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 | |
397 | 267 char * gftpui_gtk_get_utf8_file_pos ( gftp_file * fle ); |
268 | |
1 | 269 /* menu_items.c */ |
270 void change_filespec ( gpointer data ); | |
271 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
272 void save_directory_listing ( gpointer data ); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
273 |
1 | 274 void show_selected ( gpointer data ); |
275 | |
276 void selectall ( gpointer data ); | |
277 | |
278 void selectallfiles ( gpointer data ); | |
279 | |
280 void deselectall ( gpointer data ); | |
281 | |
282 int chdir_edit ( GtkWidget * widget, | |
283 gpointer data ); | |
284 | |
285 void clearlog ( gpointer data ); | |
286 | |
287 void viewlog ( gpointer data ); | |
288 | |
289 void savelog ( gpointer data ); | |
290 | |
291 void clear_cache ( gpointer data ); | |
292 | |
227 | 293 void compare_windows ( gpointer data ); |
294 | |
295 void about_dialog ( gpointer data ); | |
1 | 296 |
297 /* misc-gtk.c */ | |
298 void fix_display ( void ); | |
299 | |
300 void remove_files_window ( gftp_window_data * wdata ); | |
301 | |
302 void ftp_log ( gftp_logging_level level, | |
186 | 303 gftp_request * request, |
1 | 304 const char *string, |
338 | 305 ... ) GFTP_LOG_FUNCTION_ATTRIBUTES; |
1 | 306 |
307 void update_window_info ( void ); | |
308 | |
309 void update_window ( gftp_window_data * wdata ); | |
310 | |
311 GtkWidget * toolbar_pixmap ( GtkWidget * widget, | |
312 char *filename ); | |
313 | |
314 gftp_graphic * open_xpm ( GtkWidget * widget, | |
315 char *filename ); | |
316 | |
317 void gftp_free_pixmap ( char *filename ); | |
318 | |
319 void gftp_get_pixmap ( GtkWidget * widget, | |
320 char *filename, | |
321 GdkPixmap ** pix, | |
322 GdkBitmap ** bitmap ); | |
323 | |
324 int check_status ( char *name, | |
325 gftp_window_data * wdata, | |
326 int check_other_stop, | |
327 int only_one, | |
328 int at_least_one, | |
329 int func ); | |
330 | |
7 | 331 GtkItemFactory *item_factory_new ( GtkType container_type, |
332 const char *path, | |
333 GtkAccelGroup *accel_group, | |
334 const char *strip_prefix ); | |
335 | |
1 | 336 void create_item_factory ( GtkItemFactory * ifactory, |
337 guint n_entries, | |
338 GtkItemFactoryEntry * entries, | |
339 gpointer callback_data ); | |
340 | |
341 void add_history ( GtkWidget * widget, | |
342 GList ** history, | |
343 unsigned int *histlen, | |
344 const char *str ); | |
345 | |
346 int check_reconnect ( gftp_window_data * wdata ); | |
347 | |
348 void add_file_listbox ( gftp_window_data * wdata, | |
349 gftp_file * fle ); | |
350 | |
425 | 351 void destroy_dialog ( gftp_dialog_data * ddata ); |
352 | |
1 | 353 void MakeEditDialog ( char *diagtxt, |
354 char *infotxt, | |
355 char *deftext, | |
19 | 356 int passwd_item, |
357 char *checktext, | |
358 gftp_dialog_button okbutton, | |
1 | 359 void (*okfunc) (), |
360 void *okptr, | |
361 void (*cancelfunc) (), | |
362 void *cancelptr ); | |
363 | |
364 void MakeYesNoDialog ( char *diagtxt, | |
365 char *infotxt, | |
19 | 366 void (*yesfunc) (), |
367 gpointer yespointer, | |
368 void (*nofunc) (), | |
369 gpointer nopointer ); | |
1 | 370 |
371 void update_directory_download_progress ( gftp_transfer * transfer ); | |
372 | |
373 int progress_timeout ( gpointer data ); | |
374 | |
375 void display_cached_logs ( void ); | |
376 | |
201 | 377 char * get_xpm_path ( char *filename, |
378 int quit_on_err ); | |
379 | |
227 | 380 /* options_dialog.c */ |
381 void options_dialog ( gpointer data ); | |
382 | |
229 | 383 void gftp_gtk_setup_bookmark_options ( GtkWidget * notebook, |
384 gftp_bookmarks_var * bm ); | |
227 | 385 |
229 | 386 void gftp_gtk_save_bookmark_options ( gftp_bookmarks_var * bm ); |
227 | 387 |
1 | 388 /* transfer.c */ |
389 int ftp_list_files ( gftp_window_data * wdata, | |
390 int usecache ); | |
391 | |
392 int ftp_connect ( gftp_window_data * wdata, | |
393 gftp_request * request, | |
394 int getdir ); | |
395 | |
396 gint update_downloads ( gpointer data ); | |
397 | |
398 void get_files ( gpointer data ); | |
399 | |
400 void put_files ( gpointer data ); | |
401 | |
402 void transfer_window_files ( gftp_window_data * fromwdata, | |
403 gftp_window_data * towdata ); | |
404 | |
405 void *do_getdir_thread ( void * data ); | |
406 | |
407 void start_transfer ( gpointer data ); | |
408 | |
409 void stop_transfer ( gpointer data ); | |
410 | |
411 void skip_transfer ( gpointer data ); | |
412 | |
413 void remove_file_transfer ( gpointer data ); | |
414 | |
415 void move_transfer_up ( gpointer data ); | |
416 | |
417 void move_transfer_down ( gpointer data ); | |
418 | |
419 /* view_dialog.c */ | |
420 void edit_dialog ( gpointer data ); | |
421 | |
422 void view_dialog ( gpointer data ); | |
423 | |
424 void view_file ( char *filename, | |
425 int fd, | |
426 int viewedit, | |
427 int del_file, | |
428 int start_pos, | |
429 int dontupload, | |
430 char *remote_filename, | |
431 gftp_window_data * wdata ); | |
432 | |
433 #endif | |
434 |