Commit 1af9776fe56b2b5552b04b896e8bf111f95806f8

Authored by perry.werneck@gmail.com
1 parent 124a9f05

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 54 LIB3270_EXPORT GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors);
55 55 LIB3270_EXPORT void pw3270_set_host(GtkWidget *widget, const gchar *uri);
56 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 59 LIB3270_EXPORT gboolean pw3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix);
59 60 LIB3270_EXPORT gboolean pw3270_set_toggle_by_name(GtkWidget *widget, const gchar *name, gboolean flag);
... ... @@ -81,7 +82,7 @@
81 82  
82 83 LIB3270_EXPORT gboolean pw3270_get_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gboolean def);
83 84 LIB3270_EXPORT void pw3270_set_boolean(GtkWidget *widget, const gchar *group, const gchar *key, gint val);
84   -
  85 +
85 86 typedef enum pw3270_src
86 87 {
87 88 PW3270_SRC_ALL, /**< Screen contents */
... ...
src/pw3270/window.c
... ... @@ -202,24 +202,37 @@
202 202 if(host)
203 203 {
204 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 211 else
208 212 {
209 213 gchar *ptr = get_string_from_config("host","uri","");
  214 +
210 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 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 225 v3270_set_scaled_fonts(GTK_PW3270(widget)->terminal,get_boolean_from_config("terminal","sfonts",FALSE));
219 226  
220 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 236 void pw3270_set_host(GtkWidget *widget, const gchar *uri)
224 237 {
225 238 g_return_if_fail(GTK_IS_PW3270(widget));
... ...