Commit d79767780cadc8d05de4104540a34cc7e1dca541
1 parent
c322c258
Exists in
master
and in
5 other branches
Delaying auto-connect to prevent hangs on windows.
Showing
1 changed file
with
9 additions
and
8 deletions
Show diff stats
src/pw3270/window.c
... | ... | @@ -237,6 +237,12 @@ static GtkWidget * trace_window = NULL; |
237 | 237 | |
238 | 238 | } |
239 | 239 | |
240 | + static gboolean bg_auto_connect(GtkWidget *widget) | |
241 | + { | |
242 | + pw3270_connect(widget); | |
243 | + return FALSE; | |
244 | + } | |
245 | + | |
240 | 246 | GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors) |
241 | 247 | { |
242 | 248 | GtkWidget * widget = g_object_new(GTK_TYPE_PW3270, NULL); |
... | ... | @@ -255,16 +261,11 @@ static GtkWidget * trace_window = NULL; |
255 | 261 | { |
256 | 262 | set_string_to_config("host","uri","%s",host); |
257 | 263 | pw3270_set_url(widget,host); |
258 | - connct = TRUE; | |
259 | 264 | } |
260 | 265 | else |
261 | 266 | { |
262 | 267 | gchar *ptr = get_string_from_config("host","uri",""); |
263 | - if(*ptr) | |
264 | - { | |
265 | - pw3270_set_url(widget,ptr); | |
266 | - connct = pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP) ? TRUE : FALSE; | |
267 | - } | |
268 | + pw3270_set_url(widget,ptr); | |
268 | 269 | g_free(ptr); |
269 | 270 | } |
270 | 271 | |
... | ... | @@ -289,8 +290,8 @@ static GtkWidget * trace_window = NULL; |
289 | 290 | |
290 | 291 | v3270_set_scaled_fonts(GTK_PW3270(widget)->terminal,get_boolean_from_config("terminal","sfonts",FALSE)); |
291 | 292 | |
292 | - if(connct) | |
293 | - pw3270_connect(widget); | |
293 | + if(pw3270_get_toggle(widget,LIB3270_TOGGLE_CONNECT_ON_STARTUP)) | |
294 | + g_idle_add((GSourceFunc) bg_auto_connect, widget); | |
294 | 295 | |
295 | 296 | return widget; |
296 | 297 | } | ... | ... |