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