Commit 1af9776fe56b2b5552b04b896e8bf111f95806f8
1 parent
124a9f05
Exists in
master
and in
5 other branches
Corrigindo bug no auto-connect
Showing
2 changed files
with
20 additions
and
6 deletions
Show diff stats
src/include/pw3270.h
@@ -54,6 +54,7 @@ | @@ -54,6 +54,7 @@ | ||
54 | LIB3270_EXPORT GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors); | 54 | LIB3270_EXPORT GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors); |
55 | LIB3270_EXPORT void pw3270_set_host(GtkWidget *widget, const gchar *uri); | 55 | LIB3270_EXPORT void pw3270_set_host(GtkWidget *widget, const gchar *uri); |
56 | LIB3270_EXPORT const gchar * pw3270_get_host(GtkWidget *widget); | 56 | LIB3270_EXPORT const gchar * pw3270_get_host(GtkWidget *widget); |
57 | + LIB3270_EXPORT void pw3270_connect_host(GtkWidget *widget, const gchar *uri); | ||
57 | 58 | ||
58 | LIB3270_EXPORT gboolean pw3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); | 59 | LIB3270_EXPORT gboolean pw3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); |
59 | LIB3270_EXPORT gboolean pw3270_set_toggle_by_name(GtkWidget *widget, const gchar *name, gboolean flag); | 60 | LIB3270_EXPORT gboolean pw3270_set_toggle_by_name(GtkWidget *widget, const gchar *name, gboolean flag); |
@@ -81,7 +82,7 @@ | @@ -81,7 +82,7 @@ | ||
81 | 82 | ||
82 | LIB3270_EXPORT gboolean pw3270_get_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gboolean def); | 83 | LIB3270_EXPORT gboolean pw3270_get_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gboolean def); |
83 | LIB3270_EXPORT void pw3270_set_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gint val); | 84 | LIB3270_EXPORT void pw3270_set_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gint val); |
84 | - | 85 | + |
85 | typedef enum pw3270_src | 86 | typedef enum pw3270_src |
86 | { | 87 | { |
87 | PW3270_SRC_ALL, /**< Screen contents */ | 88 | PW3270_SRC_ALL, /**< Screen contents */ |
src/pw3270/window.c
@@ -202,24 +202,37 @@ | @@ -202,24 +202,37 @@ | ||
202 | if(host) | 202 | if(host) |
203 | { | 203 | { |
204 | set_string_to_config("host","uri","%s",host); | 204 | set_string_to_config("host","uri","%s",host); |
205 | - pw3270_set_host(widget,host); | 205 | + |
206 | + if(pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) | ||
207 | + pw3270_connect_host(widget,host); | ||
208 | + else | ||
209 | + pw3270_set_host(widget,host); | ||
206 | } | 210 | } |
207 | else | 211 | else |
208 | { | 212 | { |
209 | gchar *ptr = get_string_from_config("host","uri",""); | 213 | gchar *ptr = get_string_from_config("host","uri",""); |
214 | + | ||
210 | if(*ptr) | 215 | if(*ptr) |
211 | - pw3270_set_host(widget,ptr); | 216 | + { |
217 | + if(pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) | ||
218 | + pw3270_connect_host(widget,ptr); | ||
219 | + else | ||
220 | + pw3270_set_host(widget,ptr); | ||
221 | + } | ||
212 | g_free(ptr); | 222 | g_free(ptr); |
213 | } | 223 | } |
214 | 224 | ||
215 | - if(pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) | ||
216 | - v3270_connect(GTK_PW3270(widget)->terminal,NULL); | ||
217 | - | ||
218 | v3270_set_scaled_fonts(GTK_PW3270(widget)->terminal,get_boolean_from_config("terminal","sfonts",FALSE)); | 225 | v3270_set_scaled_fonts(GTK_PW3270(widget)->terminal,get_boolean_from_config("terminal","sfonts",FALSE)); |
219 | 226 | ||
220 | return widget; | 227 | return widget; |
221 | } | 228 | } |
222 | 229 | ||
230 | + void pw3270_connect_host(GtkWidget *widget, const gchar *uri) | ||
231 | + { | ||
232 | + g_return_if_fail(GTK_IS_PW3270(widget)); | ||
233 | + v3270_connect(GTK_PW3270(widget)->terminal,uri); | ||
234 | + } | ||
235 | + | ||
223 | void pw3270_set_host(GtkWidget *widget, const gchar *uri) | 236 | void pw3270_set_host(GtkWidget *widget, const gchar *uri) |
224 | { | 237 | { |
225 | g_return_if_fail(GTK_IS_PW3270(widget)); | 238 | g_return_if_fail(GTK_IS_PW3270(widget)); |