comparison src/gtk/gftp-gtk.h @ 1:8b1883341c6f

Initial revision
author masneyb
date Mon, 05 Aug 2002 19:46:57 +0000
parents
children 5551ab2301fe
comparison
equal deleted inserted replaced
0:674ed97069fd 1:8b1883341c6f
1 /*****************************************************************************/
2 /* gftp-gtk.h - include file for the gftp gtk+ 1.2 port */
3 /* Copyright (C) 1998-2002 Brian Masney <masneyb@gftp.org> */
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
20 #ifndef __GFTP_GTK_H
21 #define __GFTP_GTK_H
22
23 #include "../../lib/gftp.h"
24 #include <gtk/gtk.h>
25 #include <gdk/gdkkeysyms.h>
26 #include <pthread.h>
27
28 #define IS_ONE_SELECTED(wdata) (GTK_CLIST ((wdata)->listbox)->selection && GTK_CLIST ((wdata)->listbox)->selection->next == NULL)
29 #define IS_NONE_SELECTED(wdata) (GTK_CLIST ((wdata)->listbox)->selection == NULL)
30
31 #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2
32 #define gtk_widget_set_size_request(widget, width, height) \
33 gtk_widget_set_usize (widget, width, height)
34 #endif
35
36 typedef struct gftp_window_data_tag
37 {
38 GtkWidget *combo, /* Entry widget/history for the user to enter
39 a directory */
40 *hoststxt, /* Show which directory we're in */
41 *listbox; /* Our listbox showing the files */
42 unsigned int sortcol, /* Which column we are sorting by */
43 sortasds : 1, /* Sorted ascending or descending */
44 sorted : 1, /* Is the output sorted? */
45 show_selected : 1, /* Show only selected files */
46 *histlen; /* Pointer to length of history */
47 char *filespec; /* Filespec for the listbox */
48 gftp_request * request; /* The host that we are connected to */
49 GList * files, /* Files in the listbox */
50 ** history; /* History of the directories */
51 GtkItemFactory *ifactory; /* This is for the menus that will
52 come up when you right click */
53 pthread_t tid; /* Thread for the stop button */
54 unsigned long gotbytes;
55 } gftp_window_data;
56
57
58 typedef struct gftp_graphic_tag
59 {
60 char * filename;
61 GdkPixmap * pixmap;
62 GdkBitmap * bitmap;
63 } gftp_graphic;
64
65
66 typedef struct gftp_dialog_data_tag
67 {
68 GtkWidget * dialog, /* Pointer to the dialog */
69 * checkbox, /* Pointer to the checkbox widget */
70 * edit; /* Pointer to the edit widget */
71 GList * all_buttons; /* All the buttons of this dialog */
72 gpointer data; /* Data pointer we'll pass to the function */
73 } gftp_dialog_data;
74
75
76 typedef struct gftp_viewedit_data_tag
77 {
78 char *filename, /* File we are viewing/editing currently */
79 *remote_filename; /* The filename on the remote computer */
80 struct stat st; /* Vital file statistics */
81 pid_t pid; /* Our process id */
82 char **argv; /* Our arguments we passed to execvp. We will
83 free it when the process terminates. This
84 is the safest place to free this */
85 unsigned int view : 1, /* View or edit this file */
86 rm : 1, /* Delete this file after we're done with it */
87 dontupload : 1; /* Don't upload this file after we're done
88 editing it */
89 gftp_window_data * fromwdata, /* The window we are viewing this file in */
90 * towdata;
91 } gftp_viewedit_data;
92
93
94 typedef struct gftp_curtrans_data_tag
95 {
96 gftp_transfer * transfer;
97 GList * curfle;
98 } gftp_curtrans_data;
99
100
101 extern gftp_window_data window1, window2, * other_wdata, * current_wdata;
102 extern GtkWidget * stop_btn, * hostedit, * useredit, * passedit,
103 * portedit, * logwdw, * dlwdw, * protocol_menu, * optionmenu;
104 extern GtkAdjustment * logwdw_vadj;
105 #if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0
106 extern GtkTextMark * logwdw_textmark;
107 #endif
108 extern int local_start, remote_start, trans_start, log_start, tools_start;
109 extern GHashTable * graphic_hash_table;
110 extern GtkItemFactoryEntry * menus;
111 extern GtkItemFactory * factory;
112 extern pthread_mutex_t transfer_mutex, log_mutex;
113
114 /* bookmarks.c */
115 void run_bookmark ( gpointer data );
116
117 void add_bookmark ( gpointer data );
118
119 void edit_bookmarks ( gpointer data );
120
121 void build_bookmarks_menu ( void );
122
123 /* chmod_dialog.c */
124 void chmod_dialog ( gpointer data );
125
126 /* delete_dialog.c */
127 void delete_dialog ( gpointer data );
128
129 /* dnd.c */
130 void openurl_get_drag_data ( GtkWidget * widget,
131 GdkDragContext * context,
132 gint x,
133 gint y,
134 GtkSelectionData * selection_data,
135 guint info,
136 guint32 clk_time,
137 gpointer data );
138
139 void listbox_drag ( GtkWidget * widget,
140 GdkDragContext * context,
141 GtkSelectionData * selection_data,
142 guint info,
143 guint32 clk_time,
144 gpointer data );
145
146 void listbox_get_drag_data ( GtkWidget * widget,
147 GdkDragContext * context,
148 gint x,
149 gint y,
150 GtkSelectionData * selection_data,
151 guint info,
152 guint32 clk_time,
153 gpointer data );
154
155 /* gftp-gtk.c */
156 void toolbar_hostedit ( GtkWidget * widget,
157 gpointer data );
158
159 void sortrows ( GtkCList * clist,
160 gint column,
161 gpointer data );
162
163 void stop_button ( GtkWidget * widget,
164 gpointer data );
165
166 /* menu_items.c */
167 void change_setting ( gftp_window_data *wdata,
168 int menuitem,
169 GtkWidget * checkmenu );
170
171 void tb_openurl_dialog ( gpointer data );
172
173 void openurl_dialog ( gpointer data );
174
175 void disconnect ( gpointer data );
176
177 void change_filespec ( gpointer data );
178
179 void show_selected ( gpointer data );
180
181 void selectall ( gpointer data );
182
183 void selectallfiles ( gpointer data );
184
185 void deselectall ( gpointer data );
186
187 void site_dialog ( gpointer data );
188
189 int chdir_edit ( GtkWidget * widget,
190 gpointer data );
191
192 int chdir_dialog ( gpointer data );
193
194 void clearlog ( gpointer data );
195
196 void viewlog ( gpointer data );
197
198 void savelog ( gpointer data );
199
200 void clear_cache ( gpointer data );
201
202 void options_dialog (gpointer data);
203 void compare_windows (gpointer data);
204 void about_dialog (gpointer data);
205
206 /* misc-gtk.c */
207 void fix_display ( void );
208
209 void remove_files_window ( gftp_window_data * wdata );
210
211 void ftp_log ( gftp_logging_level level,
212 void *ptr,
213 const char *string,
214 ... );
215
216 void refresh ( gftp_window_data * wdata );
217
218 void update_window_info ( void );
219
220 void update_window ( gftp_window_data * wdata );
221
222 GtkWidget * toolbar_pixmap ( GtkWidget * widget,
223 char *filename );
224
225 gftp_graphic * open_xpm ( GtkWidget * widget,
226 char *filename );
227
228 void gftp_free_pixmap ( char *filename );
229
230 void gftp_get_pixmap ( GtkWidget * widget,
231 char *filename,
232 GdkPixmap ** pix,
233 GdkBitmap ** bitmap );
234
235 int check_status ( char *name,
236 gftp_window_data * wdata,
237 int check_other_stop,
238 int only_one,
239 int at_least_one,
240 int func );
241
242 void create_item_factory ( GtkItemFactory * ifactory,
243 guint n_entries,
244 GtkItemFactoryEntry * entries,
245 gpointer callback_data );
246
247 GList * get_next_selection ( GList * selection,
248 GList ** list,
249 int *curnum );
250
251 void add_history ( GtkWidget * widget,
252 GList ** history,
253 unsigned int *histlen,
254 const char *str );
255
256 int check_reconnect ( gftp_window_data * wdata );
257
258 void add_file_listbox ( gftp_window_data * wdata,
259 gftp_file * fle );
260
261 void MakeEditDialog ( char *diagtxt,
262 char *infotxt,
263 char *deftext,
264 int edit_shown,
265 int erase,
266 char *checktext,
267 char *oktxt,
268 void (*okfunc) (),
269 void *okptr,
270 char *canceltxt,
271 void (*cancelfunc) (),
272 void *cancelptr );
273
274 void MakeYesNoDialog ( char *diagtxt,
275 char *infotxt,
276 int erase,
277 int num,
278 ... );
279
280 void update_directory_download_progress ( gftp_transfer * transfer );
281
282 void *generic_thread ( void * (*func)
283 (void *),
284 gftp_window_data * wdata );
285
286 int progress_timeout ( gpointer data );
287
288 void display_cached_logs ( void );
289
290 /* mkdir_dialog.c */
291 void mkdir_dialog ( gpointer data );
292
293 /* rename_dialog.c */
294 void rename_dialog ( gpointer data );
295
296 /* transfer.c */
297 int ftp_list_files ( gftp_window_data * wdata,
298 int usecache );
299
300 int ftp_connect ( gftp_window_data * wdata,
301 gftp_request * request,
302 int getdir );
303
304 gint update_downloads ( gpointer data );
305
306 void * gftp_gtk_transfer_files ( void *data );
307
308 void get_files ( gpointer data );
309
310 void put_files ( gpointer data );
311
312 void transfer_window_files ( gftp_window_data * fromwdata,
313 gftp_window_data * towdata );
314
315 void *do_getdir_thread ( void * data );
316
317 void add_file_transfer ( gftp_request * fromreq,
318 gftp_request * toreq,
319 gftp_window_data * fromwdata,
320 gftp_window_data * towdata,
321 GList * files,
322 int copy_req );
323
324 void start_transfer ( gpointer data );
325
326 void stop_transfer ( gpointer data );
327
328 void skip_transfer ( gpointer data );
329
330 void remove_file_transfer ( gpointer data );
331
332 void move_transfer_up ( gpointer data );
333
334 void move_transfer_down ( gpointer data );
335
336 void gftp_gtk_ask_transfer ( gftp_transfer * tdata );
337
338 /* view_dialog.c */
339 void edit_dialog ( gpointer data );
340
341 void view_dialog ( gpointer data );
342
343 void view_file ( char *filename,
344 int fd,
345 int viewedit,
346 int del_file,
347 int start_pos,
348 int dontupload,
349 char *remote_filename,
350 gftp_window_data * wdata );
351
352 #endif
353