341
|
1 /*****************************************************************************/
|
|
2 /* gftpui.h - UI related functions for gFTP */
|
|
3 /* Copyright (C) 1998-2003 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., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
|
|
18 /*****************************************************************************/
|
|
19
|
|
20 /* $Id$ */
|
|
21
|
|
22 #ifndef __GFTPUI_H
|
|
23 #define __GFTPUI_H
|
|
24
|
|
25 #include "../../lib/gftp.h"
|
|
26
|
|
27 typedef struct _gftpui_callback_data gftpui_callback_data;
|
|
28
|
|
29 struct _gftpui_callback_data
|
|
30 {
|
|
31 gftp_request * request;
|
|
32 void *uidata;
|
|
33 char *input_string,
|
|
34 *source_string;
|
355
|
35 GList * files;
|
508
|
36 void *user_data;
|
367
|
37 int retries;
|
341
|
38 int (*run_function) (gftpui_callback_data * cdata);
|
510
|
39 int (*connect_function) (gftpui_callback_data * cdata);
|
|
40 void (*disconnect_function) (gftpui_callback_data * cdata);
|
511
|
41 unsigned int dont_check_connection : 1,
|
514
|
42 dont_refresh : 1,
|
633
|
43 dont_clear_cache : 1,
|
|
44 toggled : 1;
|
341
|
45 };
|
|
46
|
|
47
|
|
48 typedef enum _gftpui_common_request_type
|
|
49 {
|
|
50 gftpui_common_request_none,
|
|
51 gftpui_common_request_local,
|
|
52 gftpui_common_request_remote
|
|
53 } gftpui_common_request_type;
|
|
54
|
|
55
|
|
56 typedef struct _gftpui_common_methods
|
|
57 {
|
|
58 char *command;
|
526
|
59 size_t minlen;
|
377
|
60 int (*func)(void *uidata, gftp_request * request,
|
|
61 void *other_uidata, gftp_request * other_request,
|
|
62 const char *command);
|
341
|
63 gftpui_common_request_type reqtype;
|
|
64 char *cmd_description;
|
374
|
65 int (*subhelp_func) (const char *topic);
|
341
|
66 } gftpui_common_methods;
|
|
67
|
367
|
68 typedef struct _gftpui_common_curtrans_data
|
|
69 {
|
|
70 gftp_transfer * transfer;
|
|
71 GList * curfle;
|
|
72 } gftpui_common_curtrans_data;
|
|
73
|
341
|
74 #define gftpui_common_use_threads(request) (gftp_protocols[(request)->protonum].use_threads)
|
|
75
|
|
76 #define GFTPUI_COMMON_COLOR_BLACK "\033[30m"
|
|
77 #define GFTPUI_COMMON_COLOR_RED "\033[31m"
|
|
78 #define GFTPUI_COMMON_COLOR_GREEN "\033[32m"
|
|
79 #define GFTPUI_COMMON_COLOR_YELLOW "\033[33m"
|
|
80 #define GFTPUI_COMMON_COLOR_BLUE "\033[34m"
|
|
81 #define GFTPUI_COMMON_COLOR_MAGENTA "\033[35m"
|
|
82 #define GFTPUI_COMMON_COLOR_CYAN "\033[36m"
|
|
83 #define GFTPUI_COMMON_COLOR_WHITE "\033[37m"
|
|
84 #define GFTPUI_COMMON_COLOR_GREY "\033[38m"
|
|
85 #define GFTPUI_COMMON_COLOR_DEFAULT "\033[39m"
|
|
86 #define GFTPUI_COMMON_COLOR_NONE ""
|
|
87
|
|
88 extern sigjmp_buf gftpui_common_jmp_environment;
|
|
89 extern volatile int gftpui_common_use_jmp_environment;
|
|
90 extern gftpui_common_methods gftpui_common_commands[];
|
367
|
91 extern GStaticMutex gftpui_common_transfer_mutex;
|
374
|
92 extern volatile sig_atomic_t gftpui_common_child_process_done;
|
341
|
93
|
|
94 /* gftpui.c */
|
|
95 int gftpui_run_callback_function ( gftpui_callback_data * cdata );
|
|
96
|
|
97 int gftpui_common_run_callback_function ( gftpui_callback_data * cdata );
|
|
98
|
374
|
99 void gftpui_common_init ( int *argc,
|
|
100 char ***argv,
|
|
101 gftp_logging_func logfunc );
|
341
|
102
|
|
103 void gftpui_common_about ( gftp_logging_func logging_function,
|
|
104 gpointer logdata );
|
|
105
|
374
|
106 int gftpui_common_process_command ( void *locui,
|
341
|
107 gftp_request * locreq,
|
|
108 void *remui,
|
374
|
109 gftp_request * remreq,
|
|
110 const char *command );
|
341
|
111
|
367
|
112 int gftpui_common_cmd_open ( void *uidata,
|
|
113 gftp_request * request,
|
377
|
114 void *other_uidata,
|
|
115 gftp_request * other_request,
|
374
|
116 const char *command );
|
367
|
117
|
380
|
118 int gftpui_common_cmd_mget_file ( void *uidata,
|
|
119 gftp_request * request,
|
|
120 void *other_uidata,
|
|
121 gftp_request * other_request,
|
|
122 const char *command );
|
|
123
|
|
124 int gftpui_common_cmd_mput_file ( void *uidata,
|
|
125 gftp_request * request,
|
|
126 void *other_uidata,
|
|
127 gftp_request * other_request,
|
|
128 const char *command );
|
|
129
|
367
|
130 gftp_transfer * gftpui_common_add_file_transfer ( gftp_request * fromreq,
|
|
131 gftp_request * toreq,
|
|
132 void *fromuidata,
|
|
133 void *touidata,
|
|
134 GList * files );
|
|
135
|
|
136 int gftpui_common_transfer_files ( gftp_transfer * tdata );
|
|
137
|
341
|
138 /* gftpuicallback.c */
|
|
139 int gftpui_common_run_mkdir ( gftpui_callback_data * cdata );
|
|
140
|
|
141 int gftpui_common_run_rename ( gftpui_callback_data * cdata );
|
|
142
|
|
143 int gftpui_common_run_site ( gftpui_callback_data * cdata );
|
|
144
|
|
145 int gftpui_common_run_chdir ( gftpui_callback_data * cdata );
|
|
146
|
350
|
147 int gftpui_common_run_chmod ( gftpui_callback_data * cdata );
|
|
148
|
355
|
149 int gftpui_common_run_ls ( gftpui_callback_data * cdata );
|
|
150
|
350
|
151 int gftpui_common_run_delete ( gftpui_callback_data * cdata );
|
|
152
|
|
153 int gftpui_common_run_rmdir ( gftpui_callback_data * cdata );
|
|
154
|
367
|
155 int gftpui_common_run_connect ( gftpui_callback_data * cdata );
|
|
156
|
341
|
157 /* UI Functions that must be implemented by each distinct UI */
|
|
158 void gftpui_lookup_file_colors ( gftp_file * fle,
|
|
159 char **start_color,
|
|
160 char ** end_color );
|
|
161
|
|
162 int gftpui_check_reconnect ( gftpui_callback_data * cdata );
|
|
163
|
514
|
164 void gftpui_refresh ( void *uidata,
|
521
|
165 int clear_cache_entry );
|
341
|
166
|
|
167 void *gftpui_generic_thread ( void *(*run_function)(void *data),
|
|
168 void *data);
|
|
169
|
380
|
170 void gftpui_prompt_username ( void *uidata,
|
356
|
171 gftp_request * request );
|
|
172
|
380
|
173 void gftpui_prompt_password ( void *uidata,
|
356
|
174 gftp_request * request );
|
|
175
|
367
|
176 void gftpui_add_file_to_transfer ( gftp_transfer * tdata,
|
397
|
177 GList * curfle );
|
367
|
178
|
|
179 void gftpui_ask_transfer ( gftp_transfer * tdata );
|
|
180
|
377
|
181 void gftpui_start_current_file_in_transfer ( gftp_transfer * tdata );
|
|
182
|
|
183 void gftpui_update_current_file_in_transfer ( gftp_transfer * tdata );
|
|
184
|
|
185 void gftpui_finish_current_file_in_transfer ( gftp_transfer * tdata );
|
|
186
|
|
187 void gftpui_start_transfer ( gftp_transfer * tdata );
|
|
188
|
380
|
189 void gftpui_disconnect ( void *uidata );
|
|
190
|
|
191
|
341
|
192 #endif
|