Commit 8dc00672fa382423e3643df3184a7ca5d7e496dd
1 parent
fa8e805e
Exists in
master
and in
5 other branches
Corrigindo incoerências nos diálogos e APIs
Showing
16 changed files
with
78 additions
and
101 deletions
Show diff stats
android/jni/main.cpp
... | ... | @@ -337,7 +337,7 @@ JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setHost(JNIEnv *env, jobjec |
337 | 337 | { |
338 | 338 | PW3270_JNI_BEGIN |
339 | 339 | |
340 | - lib3270_set_host(PW3270_SESSION,env->GetStringUTFChars(hostname, 0)); | |
340 | + lib3270_set_url(PW3270_SESSION,env->GetStringUTFChars(hostname, 0)); | |
341 | 341 | |
342 | 342 | PW3270_JNI_END |
343 | 343 | } | ... | ... |
src/classlib/local.cc
... | ... | @@ -280,7 +280,7 @@ |
280 | 280 | LIB3270_CSTATE (*_get_connection_state)(H3270 *h); |
281 | 281 | int (*_disconnect)(H3270 *h); |
282 | 282 | int (*_connect)(H3270 *h,int wait); |
283 | - const char (*_set_host)(H3270 *h, const char *n); | |
283 | + const char (*_set_url)(H3270 *h, const char *n); | |
284 | 284 | int (*_is_connected)(H3270 *h); |
285 | 285 | void (*_main_iterate)(H3270 *h, int wait); |
286 | 286 | int (*_wait)(H3270 *hSession, int seconds); |
... | ... | @@ -335,7 +335,7 @@ |
335 | 335 | { (void **) & _get_version, "lib3270_get_version" }, |
336 | 336 | { (void **) & _disconnect, "lib3270_disconnect" }, |
337 | 337 | { (void **) & _connect, "lib3270_connect" }, |
338 | - { (void **) & _set_host, "lib3270_set_host" }, | |
338 | + { (void **) & _set_url, "lib3270_set_url" }, | |
339 | 339 | { (void **) & _main_iterate, "lib3270_main_iterate" }, |
340 | 340 | { (void **) & _wait, "lib3270_wait" }, |
341 | 341 | { (void **) & _enter, "lib3270_enter" }, |
... | ... | @@ -423,9 +423,9 @@ |
423 | 423 | return _connect(hSession,(int) wait); |
424 | 424 | } |
425 | 425 | |
426 | - int set_host(const char *uri) | |
426 | + int set_url(const char *uri) | |
427 | 427 | { |
428 | - return (_set_host(hSession,uri) == NULL) ? 0 : 1; | |
428 | + return (_set_url(hSession,uri) == NULL) ? 0 : 1; | |
429 | 429 | } |
430 | 430 | |
431 | 431 | int disconnect(void) | ... | ... |
src/classlib/remote.cc
src/classlib/session.cc
... | ... | @@ -469,12 +469,17 @@ |
469 | 469 | return EINVAL; |
470 | 470 | } |
471 | 471 | |
472 | + int session::set_host(const char *host) | |
473 | + { | |
474 | + return set_url(host); | |
475 | + } | |
476 | + | |
472 | 477 | int session::connect(const char *host, bool wait) |
473 | 478 | { |
474 | 479 | int rc = 0; |
475 | 480 | |
476 | 481 | if(host && *host) |
477 | - rc = set_host(host); | |
482 | + rc = set_url(host); | |
478 | 483 | |
479 | 484 | if(!rc) |
480 | 485 | rc = connect(wait); | ... | ... |
src/include/lib3270.h
... | ... | @@ -398,7 +398,7 @@ |
398 | 398 | * @return Processed host url |
399 | 399 | * |
400 | 400 | */ |
401 | - LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *url); | |
401 | + LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *url); | |
402 | 402 | |
403 | 403 | /** |
404 | 404 | * Get hostname for the connect/reconnect operations. | ... | ... |
src/include/pw3270.h
... | ... | @@ -52,9 +52,9 @@ |
52 | 52 | |
53 | 53 | |
54 | 54 | LIB3270_EXPORT GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors); |
55 | - LIB3270_EXPORT const gchar * pw3270_set_host(GtkWidget *widget, const gchar *uri); | |
55 | + LIB3270_EXPORT const gchar * pw3270_set_url(GtkWidget *widget, const gchar *uri); | |
56 | 56 | LIB3270_EXPORT const gchar * pw3270_get_hostname(GtkWidget *widget); |
57 | - LIB3270_EXPORT void pw3270_connect(GtkWidget *widget, const gchar *uri); | |
57 | + LIB3270_EXPORT void pw3270_connect(GtkWidget *widget); | |
58 | 58 | |
59 | 59 | LIB3270_EXPORT gboolean pw3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); |
60 | 60 | LIB3270_EXPORT gboolean pw3270_set_toggle_by_name(GtkWidget *widget, const gchar *name, gboolean flag); |
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 | |
70 | 70 | LIB3270_EXPORT const gchar * pw3270_get_session_name(GtkWidget *widget); |
71 | 71 | LIB3270_EXPORT void pw3270_set_session_name(GtkWidget *widget, const gchar *name); |
72 | - LIB3270_EXPORT void pw3270_set_session_options(GtkWidget *widget, LIB3270_OPTION options); | |
72 | + LIB3270_EXPORT void pw3270_set_host_type(GtkWidget *widget, const gchar *name); | |
73 | 73 | LIB3270_EXPORT int pw3270_set_session_color_type(GtkWidget *widget, unsigned short color_type); |
74 | 74 | |
75 | 75 | LIB3270_EXPORT gchar * pw3270_get_filename(GtkWidget *widget, const gchar *group, const gchar *key, GtkFileFilter **filter, const gchar *title); | ... | ... |
src/include/pw3270/class.h
... | ... | @@ -129,8 +129,9 @@ |
129 | 129 | |
130 | 130 | // Connection & Network |
131 | 131 | int connect(const char *host, bool wait = true); |
132 | + int set_host(const char *host); | |
132 | 133 | virtual int connect(bool wait = true) = 0; |
133 | - virtual int set_host(const char *hostname) = 0; | |
134 | + virtual int set_url(const char *hostname) = 0; | |
134 | 135 | virtual int disconnect(void) = 0; |
135 | 136 | virtual int wait_for_ready(int seconds) = 0; |
136 | 137 | virtual int wait(int seconds) = 0; | ... | ... |
src/include/pw3270/v3270.h
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | LIB3270_EXPORT H3270 * v3270_get_session(GtkWidget *widget); |
159 | 159 | LIB3270_EXPORT gboolean v3270_is_connected(GtkWidget *widget); |
160 | 160 | |
161 | - LIB3270_EXPORT int v3270_connect(GtkWidget *widget, const gchar *host); | |
161 | + LIB3270_EXPORT int v3270_connect(GtkWidget *widget); | |
162 | 162 | LIB3270_EXPORT void v3270_disconnect(GtkWidget *widget); |
163 | 163 | |
164 | 164 | LIB3270_EXPORT int v3270_set_host_charset(GtkWidget *widget, const gchar *name); |
... | ... | @@ -214,7 +214,7 @@ |
214 | 214 | LIB3270_EXPORT void v3270_set_session_options(GtkWidget *widget, LIB3270_OPTION options); |
215 | 215 | LIB3270_EXPORT int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype); |
216 | 216 | LIB3270_EXPORT int v3270_set_host_type(GtkWidget *widget, const char *name); |
217 | - LIB3270_EXPORT const gchar * v3270_set_host(GtkWidget *widget, const gchar *uri); | |
217 | + LIB3270_EXPORT const gchar * v3270_set_url(GtkWidget *widget, const gchar *uri); | |
218 | 218 | LIB3270_EXPORT const gchar * v3270_get_hostname(GtkWidget *widget); |
219 | 219 | LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void); |
220 | 220 | ... | ... |
src/lib3270/host.c
src/lib3270/macros.c
... | ... | @@ -258,12 +258,12 @@ |
258 | 258 | break; |
259 | 259 | |
260 | 260 | case 2: |
261 | - lib3270_set_host(hSession,argv[1]); | |
261 | + lib3270_set_url(hSession,argv[1]); | |
262 | 262 | rc = lib3270_connect(hSession,0); |
263 | 263 | break; |
264 | 264 | |
265 | 265 | case 3: |
266 | - lib3270_set_host(hSession,argv[1]); | |
266 | + lib3270_set_url(hSession,argv[1]); | |
267 | 267 | rc = lib3270_connect(hSession,atoi(argv[2])); |
268 | 268 | break; |
269 | 269 | ... | ... |
src/lib3270/testprogram.c
... | ... | @@ -40,7 +40,7 @@ int main(int numpar, char *param[]) |
40 | 40 | // rc = lib3270_connect_host(h, "127.0.0.1", "9090", LIB3270_CONNECT_OPTION_WAIT); |
41 | 41 | |
42 | 42 | // lib3270_set_host_url(h,"tn3270://fandezhi.efglobe.com:9090?lu=default"); |
43 | - lib3270_set_host(h,"tn3270://fandezhi.efglobe.com"); | |
43 | + lib3270_set_url(h,"tn3270://fandezhi.efglobe.com"); | |
44 | 44 | |
45 | 45 | printf("\nConnect exits with rc=%d\n",rc); |
46 | 46 | ... | ... |
src/plugins/rx3270/pluginmain.cc
... | ... | @@ -89,7 +89,7 @@ |
89 | 89 | const string get_version(void); |
90 | 90 | LIB3270_CSTATE get_cstate(void); |
91 | 91 | int disconnect(void); |
92 | - int set_host(const char *uri); | |
92 | + int set_url(const char *uri); | |
93 | 93 | int connect(bool wait = true); |
94 | 94 | bool is_connected(void); |
95 | 95 | bool is_ready(void); |
... | ... | @@ -779,9 +779,9 @@ const char * plugin::asc2ebc(unsigned char *str, int sz) |
779 | 779 | return lib3270_asc2ebc(hSession,str,sz); |
780 | 780 | } |
781 | 781 | |
782 | -int plugin::set_host(const char *uri) | |
782 | +int plugin::set_url(const char *uri) | |
783 | 783 | { |
784 | - return lib3270_set_host(hSession,uri) != NULL ? 1 : 0; | |
784 | + return lib3270_set_url(hSession,uri) != NULL ? 1 : 0; | |
785 | 785 | } |
786 | 786 | |
787 | 787 | const char * plugin::ebc2asc(unsigned char *str, int sz) | ... | ... |
src/pw3270/actions.c
... | ... | @@ -75,39 +75,21 @@ static void connect_action(GtkAction *action, GtkWidget *widget) |
75 | 75 | |
76 | 76 | trace_action(action,widget); |
77 | 77 | |
78 | - #warning Reimplementar | |
78 | + if(host) | |
79 | + v3270_set_url(widget,host); | |
79 | 80 | |
80 | - /* | |
81 | - if(!systype) | |
82 | - systype = get_string_from_config("host","systype","S390"); | |
81 | + if(systype) | |
82 | + v3270_set_host_type(widget,systype); | |
83 | 83 | |
84 | 84 | if(colortype) |
85 | - colors = atoi(colortype); | |
86 | - else | |
87 | - colors = (unsigned short) get_integer_from_config("host","colortype",16); | |
88 | - | |
89 | - trace("System type=%s System colors=%d",systype,(int) colors); | |
85 | + v3270_set_session_color_type(widget,atoi(colortype)); | |
90 | 86 | |
91 | - v3270_set_session_color_type(widget,colors); | |
92 | - v3270_set_session_options(widget,pw3270_options_by_hosttype(systype)); | |
93 | - */ | |
94 | - | |
95 | - if(host) | |
87 | + host = v3270_get_hostname(widget); | |
88 | + if(host && *host) | |
96 | 89 | { |
97 | - v3270_connect(widget,host); | |
90 | + v3270_connect(widget); | |
98 | 91 | return; |
99 | 92 | } |
100 | - else | |
101 | - { | |
102 | - gchar *ptr = get_string_from_config("host","uri",""); | |
103 | - if(*ptr) | |
104 | - { | |
105 | - v3270_connect(widget,ptr); | |
106 | - g_free(ptr); | |
107 | - return; | |
108 | - } | |
109 | - g_free(ptr); | |
110 | - } | |
111 | 93 | |
112 | 94 | hostname_action(action,widget); |
113 | 95 | } | ... | ... |
src/pw3270/ft/ftdialog.c
... | ... | @@ -395,13 +395,19 @@ GtkWidget * v3270_ft_dialog_new(GtkWidget *parent, LIB3270_FT_OPTION options) |
395 | 395 | gtk_widget_set_tooltip_text(GTK_WIDGET(browse),_("Select file")); |
396 | 396 | g_signal_connect(G_OBJECT(browse),"clicked",G_CALLBACK(browse_file),dialog); |
397 | 397 | |
398 | - gtk_dialog_add_button(GTK_DIALOG(dialog),_( "_Cancel" ), GTK_RESPONSE_CANCEL); | |
399 | - | |
400 | 398 | dialog->ready = gtk_dialog_add_button(GTK_DIALOG(dialog), |
401 | 399 | (dialog->options & LIB3270_FT_OPTION_RECEIVE) != 0 ? _( "_Receive") : _( "_Send" ), |
402 | 400 | GTK_RESPONSE_ACCEPT); |
403 | - | |
404 | 401 | gtk_widget_set_sensitive(dialog->ready,FALSE); |
402 | + | |
403 | + gtk_widget_set_tooltip_text(GTK_WIDGET(dialog->ready), | |
404 | + (dialog->options & LIB3270_FT_OPTION_RECEIVE) != 0 ? _("Start download.") : _("Start upload.")); | |
405 | + | |
406 | + | |
407 | + gtk_widget_set_tooltip_text(gtk_dialog_add_button(GTK_DIALOG(dialog),_( "_Cancel" ), GTK_RESPONSE_CANCEL), | |
408 | + (dialog->options & LIB3270_FT_OPTION_RECEIVE) != 0 ? _("Cancel download.") : _("Cancel upload.")); | |
409 | + | |
410 | + | |
405 | 411 | g_signal_connect(G_OBJECT(dialog->filename[FILENAME_HOST]),"changed",G_CALLBACK(test_remote_file),dialog); |
406 | 412 | |
407 | 413 | if(options & LIB3270_FT_OPTION_RECEIVE) | ... | ... |
src/pw3270/v3270/widget.c
... | ... | @@ -1389,25 +1389,11 @@ H3270 * v3270_get_session(GtkWidget *widget) |
1389 | 1389 | return GTK_V3270(widget)->host; |
1390 | 1390 | } |
1391 | 1391 | |
1392 | -int v3270_connect(GtkWidget *widget, const gchar *uri) | |
1392 | +int v3270_connect(GtkWidget *widget) | |
1393 | 1393 | { |
1394 | - v3270 * terminal; | |
1395 | - int rc = -1; | |
1396 | - | |
1397 | - trace("%s widget=%p host=%p",__FUNCTION__,widget,uri); | |
1398 | - | |
1399 | 1394 | g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); |
1400 | 1395 | |
1401 | - terminal = GTK_V3270(widget); | |
1402 | - | |
1403 | - if(uri) | |
1404 | - { | |
1405 | - trace("%s(%s)",__FUNCTION__,uri); | |
1406 | - lib3270_set_host(terminal->host,uri); | |
1407 | - } | |
1408 | - | |
1409 | - return lib3270_connect(terminal->host,0); | |
1410 | - | |
1396 | + return lib3270_connect(GTK_V3270(widget)->host,0); | |
1411 | 1397 | } |
1412 | 1398 | |
1413 | 1399 | static gboolean notify_focus(GtkWidget *widget, GdkEventFocus *event) |
... | ... | @@ -1446,7 +1432,7 @@ static void v3270_activate(GtkWidget *widget) |
1446 | 1432 | if(lib3270_connected(terminal->host)) |
1447 | 1433 | lib3270_enter(terminal->host); |
1448 | 1434 | else if(lib3270_get_hostname(terminal->host)) |
1449 | - v3270_connect(widget,NULL); | |
1435 | + v3270_connect(widget); | |
1450 | 1436 | else |
1451 | 1437 | g_warning("Terminal widget %p activated without connection or valid hostname",terminal); |
1452 | 1438 | } |
... | ... | @@ -1500,11 +1486,11 @@ gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix) |
1500 | 1486 | * |
1501 | 1487 | * Since: 5.0 |
1502 | 1488 | **/ |
1503 | -const gchar * v3270_set_host(GtkWidget *widget, const gchar *uri) | |
1489 | +const gchar * v3270_set_url(GtkWidget *widget, const gchar *uri) | |
1504 | 1490 | { |
1505 | 1491 | g_return_if_fail(GTK_IS_V3270(widget)); |
1506 | 1492 | g_return_if_fail(uri != NULL); |
1507 | - return lib3270_set_host(GTK_V3270(widget)->host,uri); | |
1493 | + return lib3270_set_url(GTK_V3270(widget)->host,uri); | |
1508 | 1494 | } |
1509 | 1495 | |
1510 | 1496 | const gchar * v3270_get_hostname(GtkWidget *widget) | ... | ... |
src/pw3270/window.c
... | ... | @@ -178,25 +178,38 @@ |
178 | 178 | |
179 | 179 | GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors) |
180 | 180 | { |
181 | - GtkWidget * widget = g_object_new(GTK_TYPE_PW3270, NULL); | |
181 | + GtkWidget * widget = g_object_new(GTK_TYPE_PW3270, NULL); | |
182 | + gboolean connct = FALSE; | |
182 | 183 | |
183 | - #warning Reimplementar | |
184 | + if(host) | |
185 | + { | |
186 | + set_string_to_config("host","uri","%s",host); | |
187 | + pw3270_set_url(widget,host); | |
188 | + connct = TRUE; | |
189 | + } | |
190 | + else | |
191 | + { | |
192 | + gchar *ptr = get_string_from_config("host","uri",""); | |
193 | + if(*ptr) | |
194 | + { | |
195 | + pw3270_set_url(widget,ptr); | |
196 | + connct = pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP) ? TRUE : FALSE; | |
197 | + } | |
198 | + g_free(ptr); | |
199 | + } | |
184 | 200 | |
185 | - /* | |
186 | 201 | if(systype) |
187 | 202 | { |
188 | 203 | set_string_to_config("host","uri","%s",systype); |
189 | - pw3270_set_session_options(widget,pw3270_options_by_hosttype(systype)); | |
204 | + pw3270_set_host_type(widget,systype); | |
190 | 205 | } |
191 | 206 | else |
192 | 207 | { |
193 | 208 | gchar *ptr = get_string_from_config("host","systype","S390"); |
194 | - pw3270_set_session_options(widget,pw3270_options_by_hosttype(ptr)); | |
209 | + pw3270_set_host_type(widget,ptr); | |
195 | 210 | g_free(ptr); |
196 | 211 | } |
197 | 212 | |
198 | - */ | |
199 | - | |
200 | 213 | if(colors) |
201 | 214 | set_integer_to_config("host","colortype",colors); |
202 | 215 | else |
... | ... | @@ -204,40 +217,24 @@ |
204 | 217 | |
205 | 218 | pw3270_set_session_color_type(widget,colors); |
206 | 219 | |
207 | - if(host) | |
208 | - { | |
209 | - set_string_to_config("host","uri","%s",host); | |
210 | - pw3270_connect(widget,host); | |
211 | - } | |
212 | - else | |
213 | - { | |
214 | - gchar *ptr = get_string_from_config("host","uri",""); | |
215 | - | |
216 | - if(*ptr) | |
217 | - { | |
218 | - if(pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) | |
219 | - pw3270_connect(widget,ptr); | |
220 | - else | |
221 | - pw3270_set_host(widget,ptr); | |
222 | - } | |
223 | - g_free(ptr); | |
224 | - } | |
225 | - | |
226 | 220 | v3270_set_scaled_fonts(GTK_PW3270(widget)->terminal,get_boolean_from_config("terminal","sfonts",FALSE)); |
227 | 221 | |
222 | + if(connct) | |
223 | + pw3270_connect(widget); | |
224 | + | |
228 | 225 | return widget; |
229 | 226 | } |
230 | 227 | |
231 | - void pw3270_connect(GtkWidget *widget, const gchar *uri) | |
228 | + void pw3270_connect(GtkWidget *widget) | |
232 | 229 | { |
233 | 230 | g_return_if_fail(GTK_IS_PW3270(widget)); |
234 | - v3270_connect(GTK_PW3270(widget)->terminal,uri); | |
231 | + v3270_connect(GTK_PW3270(widget)->terminal); | |
235 | 232 | } |
236 | 233 | |
237 | - const gchar * pw3270_set_host(GtkWidget *widget, const gchar *uri) | |
234 | + const gchar * pw3270_set_url(GtkWidget *widget, const gchar *uri) | |
238 | 235 | { |
239 | 236 | g_return_if_fail(GTK_IS_PW3270(widget)); |
240 | - return v3270_set_host(GTK_PW3270(widget)->terminal,uri); | |
237 | + return v3270_set_url(GTK_PW3270(widget)->terminal,uri); | |
241 | 238 | } |
242 | 239 | |
243 | 240 | const gchar * pw3270_get_hostname(GtkWidget *widget) |
... | ... | @@ -295,10 +292,10 @@ |
295 | 292 | update_window_title(widget); |
296 | 293 | } |
297 | 294 | |
298 | - LIB3270_EXPORT void pw3270_set_session_options(GtkWidget *widget, LIB3270_OPTION options) | |
295 | + LIB3270_EXPORT void pw3270_set_host_type(GtkWidget *widget, const gchar *name) | |
299 | 296 | { |
300 | 297 | g_return_if_fail(GTK_IS_PW3270(widget)); |
301 | - v3270_set_session_options(GTK_PW3270(widget)->terminal,options); | |
298 | + v3270_set_host_type(GTK_PW3270(widget)->terminal,name); | |
302 | 299 | } |
303 | 300 | |
304 | 301 | LIB3270_EXPORT int pw3270_set_session_color_type(GtkWidget *widget, unsigned short colortype) | ... | ... |