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