Commit ff35e951888c94bdd964c44e9fb1d1205576d6f2
1 parent
331a69dd
Exists in
master
and in
5 other branches
Dialogo de seleção de host não estava lendo a configuração corretamente
Showing
5 changed files
with
56 additions
and
17 deletions
Show diff stats
src/classlib/local.cc
src/include/lib3270.h
@@ -419,6 +419,25 @@ | @@ -419,6 +419,25 @@ | ||
419 | LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); | 419 | LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); |
420 | 420 | ||
421 | /** | 421 | /** |
422 | + * Get servic or port for the connect/reconnect operations. | ||
423 | + * | ||
424 | + * @param h Session handle. | ||
425 | + * | ||
426 | + * @return Pointer to service name (internal data, do not change it) | ||
427 | + * | ||
428 | + */ | ||
429 | + LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h); | ||
430 | + | ||
431 | + | ||
432 | + /** | ||
433 | + * Get connection options. | ||
434 | + * | ||
435 | + * @param h Session handle. | ||
436 | + * | ||
437 | + */ | ||
438 | + LIB3270_EXPORT LIB3270_CONNECT_OPTION lib3270_get_connect_options(H3270 *h); | ||
439 | + | ||
440 | + /** | ||
422 | * Get URL of the hostname for the connect/reconnect operations. | 441 | * Get URL of the hostname for the connect/reconnect operations. |
423 | * | 442 | * |
424 | * @param h Session handle. | 443 | * @param h Session handle. |
@@ -630,15 +649,6 @@ | @@ -630,15 +649,6 @@ | ||
630 | */ | 649 | */ |
631 | LIB3270_EXPORT int lib3270_toggle(H3270 *h, LIB3270_TOGGLE ix); | 650 | LIB3270_EXPORT int lib3270_toggle(H3270 *h, LIB3270_TOGGLE ix); |
632 | 651 | ||
633 | - /** | ||
634 | - * Check if the active connection is secure. | ||
635 | - * | ||
636 | - * @param h Session handle. | ||
637 | - * | ||
638 | - * @return Non 0 if the connection is SSL secured, 0 if not. | ||
639 | - */ | ||
640 | - LIB3270_EXPORT int lib3270_get_ssl_state(H3270 *h); | ||
641 | - | ||
642 | /** Callback table | 652 | /** Callback table |
643 | * | 653 | * |
644 | * Structure with GUI unblocking I/O calls, used to replace the lib3270´s internal ones. | 654 | * Structure with GUI unblocking I/O calls, used to replace the lib3270´s internal ones. |
src/lib3270/host.c
@@ -582,6 +582,18 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) | @@ -582,6 +582,18 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) | ||
582 | return h->host.current; | 582 | return h->host.current; |
583 | } | 583 | } |
584 | 584 | ||
585 | +LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h) | ||
586 | +{ | ||
587 | + CHECK_SESSION_HANDLE(h); | ||
588 | + return h->host.srvc; | ||
589 | +} | ||
590 | + | ||
591 | +LIB3270_EXPORT LIB3270_CONNECT_OPTION lib3270_get_connect_options(H3270 *h) | ||
592 | +{ | ||
593 | + CHECK_SESSION_HANDLE(h); | ||
594 | + return h->host.opt; | ||
595 | +} | ||
596 | + | ||
585 | LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) | 597 | LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) |
586 | { | 598 | { |
587 | CHECK_SESSION_HANDLE(h); | 599 | CHECK_SESSION_HANDLE(h); |
src/plugins/rx3270/pluginmain.cc
@@ -781,7 +781,7 @@ const char * plugin::asc2ebc(unsigned char *str, int sz) | @@ -781,7 +781,7 @@ const char * plugin::asc2ebc(unsigned char *str, int sz) | ||
781 | 781 | ||
782 | int plugin::set_host(const char *uri) | 782 | int plugin::set_host(const char *uri) |
783 | { | 783 | { |
784 | - return lib3270_set_host(hSession,uri) != NULL; | 784 | + return lib3270_set_host(hSession,uri) != NULL ? 1 : 0; |
785 | } | 785 | } |
786 | 786 | ||
787 | const char * plugin::ebc2asc(unsigned char *str, int sz) | 787 | const char * plugin::ebc2asc(unsigned char *str, int sz) |
src/pw3270/hostdialog.c
@@ -133,8 +133,8 @@ | @@ -133,8 +133,8 @@ | ||
133 | void hostname_action(GtkAction *action, GtkWidget *widget) | 133 | void hostname_action(GtkAction *action, GtkWidget *widget) |
134 | { | 134 | { |
135 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); | 135 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); |
136 | - gchar * cfghost = get_string_from_config("host","uri",""); | ||
137 | - gchar * hostname; | 136 | +// gchar * cfghost = get_string_from_config("host","uri",""); |
137 | +// gchar * hostname; | ||
138 | gchar * ptr; | 138 | gchar * ptr; |
139 | gboolean again = TRUE; | 139 | gboolean again = TRUE; |
140 | int iHostType = 0; | 140 | int iHostType = 0; |
@@ -353,6 +353,24 @@ | @@ -353,6 +353,24 @@ | ||
353 | gtk_widget_show_all(GTK_WIDGET(table)); | 353 | gtk_widget_show_all(GTK_WIDGET(table)); |
354 | #endif | 354 | #endif |
355 | 355 | ||
356 | + gchar *uri = get_string_from_config("host","uri",""); | ||
357 | + | ||
358 | + if(uri && *uri && lib3270_set_host(v3270_get_session(widget),uri)) | ||
359 | + { | ||
360 | + H3270 *hSession = v3270_get_session(widget); | ||
361 | + gtk_entry_set_text(host,lib3270_get_hostname(hSession)); | ||
362 | + gtk_entry_set_text(port,lib3270_get_srvcname(hSession)); | ||
363 | + gtk_toggle_button_set_active(sslcheck,(lib3270_get_connect_options(hSession) & LIB3270_CONNECT_OPTION_SSL) ? TRUE : FALSE); | ||
364 | + } | ||
365 | + else | ||
366 | + { | ||
367 | + gtk_entry_set_text(host,""); | ||
368 | + gtk_entry_set_text(port,"telnet"); | ||
369 | + } | ||
370 | + | ||
371 | + g_free(uri); | ||
372 | + | ||
373 | +/* | ||
356 | hostname = cfghost; | 374 | hostname = cfghost; |
357 | 375 | ||
358 | trace("hostname=[%s]",hostname); | 376 | trace("hostname=[%s]",hostname); |
@@ -382,8 +400,7 @@ | @@ -382,8 +400,7 @@ | ||
382 | { | 400 | { |
383 | gtk_entry_set_text(port,"23"); | 401 | gtk_entry_set_text(port,"23"); |
384 | } | 402 | } |
385 | - | ||
386 | - gtk_entry_set_text(host,hostname); | 403 | +*/ |
387 | 404 | ||
388 | while(again) | 405 | while(again) |
389 | { | 406 | { |
@@ -430,7 +447,7 @@ | @@ -430,7 +447,7 @@ | ||
430 | #endif | 447 | #endif |
431 | } | 448 | } |
432 | 449 | ||
433 | - g_free(hostname); | 450 | +// g_free(hostname); |
434 | break; | 451 | break; |
435 | 452 | ||
436 | case GTK_RESPONSE_REJECT: | 453 | case GTK_RESPONSE_REJECT: |
@@ -441,6 +458,6 @@ | @@ -441,6 +458,6 @@ | ||
441 | 458 | ||
442 | gtk_widget_destroy(dialog); | 459 | gtk_widget_destroy(dialog); |
443 | 460 | ||
444 | - g_free(cfghost); | 461 | +// g_free(cfghost); |
445 | } | 462 | } |
446 | 463 |