Mercurial > gftp.yaz
annotate src/gtk/gftp-gtk.h @ 19:3b2dcdefc7e9
2002-09-15 Brian Masney <masneyb@gftp.org>
* lib/gftp.h (struct gftp_transfer) - changed the type of numfiles and
numdirs from unsigned long to long. This must be a signed field. This
is a bug I introduced a few days ago.
* lib/local.c (local_put_file) - remove the + off of the ab mode to
fdopen. This is also a bug I introduced a few days ago.
* src/gtk/transfer.c (gftp_gtk_calc_kbs) - make sure that the variable
difftime isn't a negative number when computing the KB/s
* src/gtk/menu-items.c (save_directory_listing) - remove casts to
GTK_OBJECT for the str variable
* src/gtk/gftp-gtk.c - use GTK_STOCK_* icons in place of left.xpm,
right.xpm, up.xpm, down.xpm and stop.xpm in GTK+ 2.0 port
* src/gtk/bookmarks.c - show GTK_STOCK_* icons on the popup menu
* src/gtk/bookmarks.c, src/gtk/chmod_dialog.c, src/gtk/menu-items.c,
src/gtk/misc-gtk.c, src/gtk/options_dialog.c and
src/gtk/view_dialog.c - use gtk_dialog_new_with_buttons in GTK+ 2.0
port to create the dialog. Also, associate gFTP icon with this dialog
* src/gtk/misc-gtk.c - changed the interface of MakeEditDialog and
MakeYesNoDialog. In the GTK+ 2.0 port, I now use stock icons in the
dialog buttons.
author | masneyb |
---|---|
date | Mon, 16 Sep 2002 12:27:50 +0000 |
parents | 83090328581e |
children | c8ec7877432e |
rev | line source |
---|---|
1 | 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 | |
19 | 36 /* These 2 defines are for creating menu items with stock icons in GTK+ 2.0. |
37 If we are using version 1.2, it will disable the stock items since it's not | |
38 supported */ | |
39 | |
40 #if GTK_MAJOR_VERSION < 2 | |
41 #define MS_(a) NULL | |
42 #define MN_(a) a | |
43 #else | |
44 #define MS_(a) "<StockItem>",a | |
45 #define MN_(a) a,NULL | |
46 #endif | |
47 | |
48 /* These are used for the MakeEditDialog function. I have these types to make | |
49 it easier for creating dialogs with GTK+ 1.2 and GTK+ 2.0 */ | |
50 | |
51 typedef enum gftp_dialog_button_tag | |
52 { | |
53 gftp_dialog_button_create, | |
54 gftp_dialog_button_change, | |
55 gftp_dialog_button_connect, | |
56 gftp_dialog_button_rename, | |
57 gftp_dialog_button_ok | |
58 } gftp_dialog_button; | |
59 | |
1 | 60 typedef struct gftp_window_data_tag |
61 { | |
62 GtkWidget *combo, /* Entry widget/history for the user to enter | |
63 a directory */ | |
64 *hoststxt, /* Show which directory we're in */ | |
65 *listbox; /* Our listbox showing the files */ | |
66 unsigned int sortcol, /* Which column we are sorting by */ | |
67 sortasds : 1, /* Sorted ascending or descending */ | |
68 sorted : 1, /* Is the output sorted? */ | |
69 show_selected : 1, /* Show only selected files */ | |
70 *histlen; /* Pointer to length of history */ | |
71 char *filespec; /* Filespec for the listbox */ | |
72 gftp_request * request; /* The host that we are connected to */ | |
73 GList * files, /* Files in the listbox */ | |
74 ** history; /* History of the directories */ | |
75 GtkItemFactory *ifactory; /* This is for the menus that will | |
76 come up when you right click */ | |
77 pthread_t tid; /* Thread for the stop button */ | |
78 unsigned long gotbytes; | |
79 } gftp_window_data; | |
80 | |
81 | |
82 typedef struct gftp_graphic_tag | |
83 { | |
84 char * filename; | |
85 GdkPixmap * pixmap; | |
86 GdkBitmap * bitmap; | |
87 } gftp_graphic; | |
88 | |
89 | |
90 typedef struct gftp_dialog_data_tag | |
91 { | |
19 | 92 GtkWidget * dialog, |
93 * checkbox, | |
94 * edit; | |
95 | |
96 void (*yesfunc) (); | |
97 gpointer yespointer; | |
98 | |
99 void (*nofunc) (); | |
100 gpointer nopointer; | |
1 | 101 } gftp_dialog_data; |
102 | |
103 | |
104 typedef struct gftp_viewedit_data_tag | |
105 { | |
106 char *filename, /* File we are viewing/editing currently */ | |
107 *remote_filename; /* The filename on the remote computer */ | |
108 struct stat st; /* Vital file statistics */ | |
109 pid_t pid; /* Our process id */ | |
110 char **argv; /* Our arguments we passed to execvp. We will | |
111 free it when the process terminates. This | |
112 is the safest place to free this */ | |
113 unsigned int view : 1, /* View or edit this file */ | |
114 rm : 1, /* Delete this file after we're done with it */ | |
115 dontupload : 1; /* Don't upload this file after we're done | |
116 editing it */ | |
117 gftp_window_data * fromwdata, /* The window we are viewing this file in */ | |
118 * towdata; | |
119 } gftp_viewedit_data; | |
120 | |
121 | |
122 typedef struct gftp_curtrans_data_tag | |
123 { | |
124 gftp_transfer * transfer; | |
125 GList * curfle; | |
126 } gftp_curtrans_data; | |
127 | |
128 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
129 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
|
130 { |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
131 GtkWidget * filew; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
132 gftp_window_data * wdata; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
133 } gftp_save_dir_struct; |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
134 |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
135 |
1 | 136 extern gftp_window_data window1, window2, * other_wdata, * current_wdata; |
137 extern GtkWidget * stop_btn, * hostedit, * useredit, * passedit, | |
138 * portedit, * logwdw, * dlwdw, * protocol_menu, * optionmenu; | |
139 extern GtkAdjustment * logwdw_vadj; | |
140 #if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 0 | |
141 extern GtkTextMark * logwdw_textmark; | |
142 #endif | |
143 extern int local_start, remote_start, trans_start, log_start, tools_start; | |
144 extern GHashTable * graphic_hash_table; | |
145 extern GtkItemFactoryEntry * menus; | |
146 extern GtkItemFactory * factory; | |
147 extern pthread_mutex_t transfer_mutex, log_mutex; | |
19 | 148 extern gftp_graphic * gftp_icon; |
1 | 149 |
150 /* bookmarks.c */ | |
151 void run_bookmark ( gpointer data ); | |
152 | |
153 void add_bookmark ( gpointer data ); | |
154 | |
155 void edit_bookmarks ( gpointer data ); | |
156 | |
157 void build_bookmarks_menu ( void ); | |
158 | |
159 /* chmod_dialog.c */ | |
160 void chmod_dialog ( gpointer data ); | |
161 | |
162 /* delete_dialog.c */ | |
163 void delete_dialog ( gpointer data ); | |
164 | |
165 /* dnd.c */ | |
166 void openurl_get_drag_data ( GtkWidget * widget, | |
167 GdkDragContext * context, | |
168 gint x, | |
169 gint y, | |
170 GtkSelectionData * selection_data, | |
171 guint info, | |
172 guint32 clk_time, | |
173 gpointer data ); | |
174 | |
175 void listbox_drag ( GtkWidget * widget, | |
176 GdkDragContext * context, | |
177 GtkSelectionData * selection_data, | |
178 guint info, | |
179 guint32 clk_time, | |
180 gpointer data ); | |
181 | |
182 void listbox_get_drag_data ( GtkWidget * widget, | |
183 GdkDragContext * context, | |
184 gint x, | |
185 gint y, | |
186 GtkSelectionData * selection_data, | |
187 guint info, | |
188 guint32 clk_time, | |
189 gpointer data ); | |
190 | |
191 /* gftp-gtk.c */ | |
192 void toolbar_hostedit ( GtkWidget * widget, | |
193 gpointer data ); | |
194 | |
195 void sortrows ( GtkCList * clist, | |
196 gint column, | |
197 gpointer data ); | |
198 | |
199 void stop_button ( GtkWidget * widget, | |
200 gpointer data ); | |
201 | |
202 /* menu_items.c */ | |
203 void change_setting ( gftp_window_data *wdata, | |
204 int menuitem, | |
205 GtkWidget * checkmenu ); | |
206 | |
207 void tb_openurl_dialog ( gpointer data ); | |
208 | |
209 void openurl_dialog ( gpointer data ); | |
210 | |
211 void disconnect ( gpointer data ); | |
212 | |
213 void change_filespec ( gpointer data ); | |
214 | |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
215 void save_directory_listing ( gpointer data ); |
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
216 |
1 | 217 void show_selected ( gpointer data ); |
218 | |
219 void selectall ( gpointer data ); | |
220 | |
221 void selectallfiles ( gpointer data ); | |
222 | |
223 void deselectall ( gpointer data ); | |
224 | |
225 void site_dialog ( gpointer data ); | |
226 | |
227 int chdir_edit ( GtkWidget * widget, | |
228 gpointer data ); | |
229 | |
230 int chdir_dialog ( gpointer data ); | |
231 | |
232 void clearlog ( gpointer data ); | |
233 | |
234 void viewlog ( gpointer data ); | |
235 | |
236 void savelog ( gpointer data ); | |
237 | |
238 void clear_cache ( gpointer data ); | |
239 | |
240 void options_dialog (gpointer data); | |
241 void compare_windows (gpointer data); | |
242 void about_dialog (gpointer data); | |
243 | |
244 /* misc-gtk.c */ | |
245 void fix_display ( void ); | |
246 | |
247 void remove_files_window ( gftp_window_data * wdata ); | |
248 | |
249 void ftp_log ( gftp_logging_level level, | |
250 void *ptr, | |
251 const char *string, | |
252 ... ); | |
253 | |
254 void refresh ( gftp_window_data * wdata ); | |
255 | |
256 void update_window_info ( void ); | |
257 | |
258 void update_window ( gftp_window_data * wdata ); | |
259 | |
260 GtkWidget * toolbar_pixmap ( GtkWidget * widget, | |
261 char *filename ); | |
262 | |
263 gftp_graphic * open_xpm ( GtkWidget * widget, | |
264 char *filename ); | |
265 | |
266 void gftp_free_pixmap ( char *filename ); | |
267 | |
268 void gftp_get_pixmap ( GtkWidget * widget, | |
269 char *filename, | |
270 GdkPixmap ** pix, | |
271 GdkBitmap ** bitmap ); | |
272 | |
273 int check_status ( char *name, | |
274 gftp_window_data * wdata, | |
275 int check_other_stop, | |
276 int only_one, | |
277 int at_least_one, | |
278 int func ); | |
279 | |
7 | 280 GtkItemFactory *item_factory_new ( GtkType container_type, |
281 const char *path, | |
282 GtkAccelGroup *accel_group, | |
283 const char *strip_prefix ); | |
284 | |
1 | 285 void create_item_factory ( GtkItemFactory * ifactory, |
286 guint n_entries, | |
287 GtkItemFactoryEntry * entries, | |
288 gpointer callback_data ); | |
289 | |
290 GList * get_next_selection ( GList * selection, | |
291 GList ** list, | |
292 int *curnum ); | |
293 | |
294 void add_history ( GtkWidget * widget, | |
295 GList ** history, | |
296 unsigned int *histlen, | |
297 const char *str ); | |
298 | |
299 int check_reconnect ( gftp_window_data * wdata ); | |
300 | |
301 void add_file_listbox ( gftp_window_data * wdata, | |
302 gftp_file * fle ); | |
303 | |
304 void MakeEditDialog ( char *diagtxt, | |
305 char *infotxt, | |
306 char *deftext, | |
19 | 307 int passwd_item, |
308 char *checktext, | |
309 gftp_dialog_button okbutton, | |
1 | 310 void (*okfunc) (), |
311 void *okptr, | |
312 void (*cancelfunc) (), | |
313 void *cancelptr ); | |
314 | |
315 void MakeYesNoDialog ( char *diagtxt, | |
316 char *infotxt, | |
19 | 317 void (*yesfunc) (), |
318 gpointer yespointer, | |
319 void (*nofunc) (), | |
320 gpointer nopointer ); | |
1 | 321 |
322 void update_directory_download_progress ( gftp_transfer * transfer ); | |
323 | |
324 void *generic_thread ( void * (*func) | |
325 (void *), | |
326 gftp_window_data * wdata ); | |
327 | |
328 int progress_timeout ( gpointer data ); | |
329 | |
330 void display_cached_logs ( void ); | |
331 | |
332 /* mkdir_dialog.c */ | |
333 void mkdir_dialog ( gpointer data ); | |
334 | |
335 /* rename_dialog.c */ | |
336 void rename_dialog ( gpointer data ); | |
337 | |
338 /* transfer.c */ | |
339 int ftp_list_files ( gftp_window_data * wdata, | |
340 int usecache ); | |
341 | |
342 int ftp_connect ( gftp_window_data * wdata, | |
343 gftp_request * request, | |
344 int getdir ); | |
345 | |
346 gint update_downloads ( gpointer data ); | |
347 | |
348 void * gftp_gtk_transfer_files ( void *data ); | |
349 | |
350 void get_files ( gpointer data ); | |
351 | |
352 void put_files ( gpointer data ); | |
353 | |
354 void transfer_window_files ( gftp_window_data * fromwdata, | |
355 gftp_window_data * towdata ); | |
356 | |
357 void *do_getdir_thread ( void * data ); | |
358 | |
359 void add_file_transfer ( gftp_request * fromreq, | |
360 gftp_request * toreq, | |
361 gftp_window_data * fromwdata, | |
362 gftp_window_data * towdata, | |
363 GList * files, | |
364 int copy_req ); | |
365 | |
366 void start_transfer ( gpointer data ); | |
367 | |
368 void stop_transfer ( gpointer data ); | |
369 | |
370 void skip_transfer ( gpointer data ); | |
371 | |
372 void remove_file_transfer ( gpointer data ); | |
373 | |
374 void move_transfer_up ( gpointer data ); | |
375 | |
376 void move_transfer_down ( gpointer data ); | |
377 | |
378 void gftp_gtk_ask_transfer ( gftp_transfer * tdata ); | |
379 | |
380 /* view_dialog.c */ | |
381 void edit_dialog ( gpointer data ); | |
382 | |
383 void view_dialog ( gpointer data ); | |
384 | |
385 void view_file ( char *filename, | |
386 int fd, | |
387 int viewedit, | |
388 int del_file, | |
389 int start_pos, | |
390 int dontupload, | |
391 char *remote_filename, | |
392 gftp_window_data * wdata ); | |
393 | |
394 #endif | |
395 |