Commit 3df8901e9df8cf318b1a82e5931caa3c5d28b963
1 parent
5089e43f
Exists in
master
and in
5 other branches
Ajustes para a nova caixa de diálogo
Showing
5 changed files
with
34 additions
and
17 deletions
Show diff stats
src/include/lib3270.h
@@ -1060,6 +1060,7 @@ | @@ -1060,6 +1060,7 @@ | ||
1060 | LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession); | 1060 | LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession); |
1061 | 1061 | ||
1062 | LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name); | 1062 | LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name); |
1063 | + LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name); | ||
1063 | 1064 | ||
1064 | LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void); | 1065 | LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void); |
1065 | 1066 |
src/include/pw3270/v3270.h
@@ -213,6 +213,7 @@ | @@ -213,6 +213,7 @@ | ||
213 | LIB3270_EXPORT void v3270_set_scaled_fonts(GtkWidget *widget, gboolean on); | 213 | LIB3270_EXPORT void v3270_set_scaled_fonts(GtkWidget *widget, gboolean on); |
214 | LIB3270_EXPORT void v3270_set_session_options(GtkWidget *widget, LIB3270_OPTION options); | 214 | LIB3270_EXPORT void v3270_set_session_options(GtkWidget *widget, LIB3270_OPTION options); |
215 | LIB3270_EXPORT int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype); | 215 | LIB3270_EXPORT int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype); |
216 | + LIB3270_EXPORT int v3270_set_host_type(GtkWidget *widget, const char *name); | ||
216 | LIB3270_EXPORT const gchar * v3270_set_host(GtkWidget *widget, const gchar *uri); | 217 | LIB3270_EXPORT const gchar * v3270_set_host(GtkWidget *widget, const gchar *uri); |
217 | LIB3270_EXPORT const gchar * v3270_get_hostname(GtkWidget *widget); | 218 | LIB3270_EXPORT const gchar * v3270_get_hostname(GtkWidget *widget); |
218 | LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void); | 219 | LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void); |
src/lib3270/options.c
@@ -33,6 +33,18 @@ | @@ -33,6 +33,18 @@ | ||
33 | 33 | ||
34 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ | 34 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
35 | 35 | ||
36 | + static const struct _host_type | ||
37 | + { | ||
38 | + const char * name; | ||
39 | + LIB3270_OPTION option; | ||
40 | + } host_type[] = | ||
41 | + { | ||
42 | + { "S390", LIB3270_OPTION_S390 }, | ||
43 | + { "AS400", LIB3270_OPTION_AS400 }, | ||
44 | + { "TSO", LIB3270_OPTION_TSO }, | ||
45 | + { "VM/CMS", 0 } | ||
46 | + }; | ||
47 | + | ||
36 | 48 | ||
37 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ | 49 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ |
38 | 50 | ||
@@ -80,13 +92,9 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) | @@ -80,13 +92,9 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) | ||
80 | LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession) | 92 | LIB3270_EXPORT unsigned short lib3270_get_color_type(H3270 *hSession) |
81 | { | 93 | { |
82 | CHECK_SESSION_HANDLE(hSession); | 94 | CHECK_SESSION_HANDLE(hSession); |
83 | - | ||
84 | - trace("******************* %d",hSession->colors); | ||
85 | - | ||
86 | return hSession->mono ? 2 : hSession->colors; | 95 | return hSession->mono ? 2 : hSession->colors; |
87 | } | 96 | } |
88 | 97 | ||
89 | - | ||
90 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) | 98 | LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) |
91 | { | 99 | { |
92 | CHECK_SESSION_HANDLE(hSession); | 100 | CHECK_SESSION_HANDLE(hSession); |
@@ -135,20 +143,21 @@ LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) | @@ -135,20 +143,21 @@ LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) | ||
135 | return (hSession->options & LIB3270_OPTION_TSO) != 0; | 143 | return (hSession->options & LIB3270_OPTION_TSO) != 0; |
136 | } | 144 | } |
137 | 145 | ||
138 | -LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name) | 146 | +LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name) |
139 | { | 147 | { |
140 | - static const struct _host_type | ||
141 | - { | ||
142 | - const char * name; | ||
143 | - LIB3270_OPTION option; | ||
144 | - } host_type[] = | 148 | + int f; |
149 | + | ||
150 | + for(f=0;f<(sizeof(host_type)/sizeof(host_type[0]));f++) | ||
145 | { | 151 | { |
146 | - { "S390", LIB3270_OPTION_S390 }, | ||
147 | - { "AS400", LIB3270_OPTION_AS400 }, | ||
148 | - { "TSO", LIB3270_OPTION_TSO }, | ||
149 | - { "VM/CMS", 0 } | ||
150 | - }; | 152 | + if(!strcasecmp(host_type[f].name,name)) |
153 | + return host_type[f].option; | ||
154 | + } | ||
151 | 155 | ||
156 | + return 0; | ||
157 | +} | ||
158 | + | ||
159 | +LIB3270_EXPORT int lib3270_set_host_type(H3270 *hSession, const char *name) | ||
160 | +{ | ||
152 | int f; | 161 | int f; |
153 | 162 | ||
154 | for(f=0;f<(sizeof(host_type)/sizeof(host_type[0]));f++) | 163 | for(f=0;f<(sizeof(host_type)/sizeof(host_type[0]));f++) |
src/pw3270/v3270/widget.c
@@ -1552,6 +1552,12 @@ int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype) | @@ -1552,6 +1552,12 @@ int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype) | ||
1552 | return lib3270_set_color_type(GTK_V3270(widget)->host,colortype); | 1552 | return lib3270_set_color_type(GTK_V3270(widget)->host,colortype); |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | +int v3270_set_host_type(GtkWidget *widget, const char *name) | ||
1556 | +{ | ||
1557 | + g_return_val_if_fail(GTK_IS_V3270(widget),EFAULT); | ||
1558 | + return lib3270_set_host_type(GTK_V3270(widget)->host,name); | ||
1559 | +} | ||
1560 | + | ||
1555 | unsigned short v3270_get_session_color_type(GtkWidget *widget) | 1561 | unsigned short v3270_get_session_color_type(GtkWidget *widget) |
1556 | { | 1562 | { |
1557 | g_return_val_if_fail(GTK_IS_V3270(widget),-1); | 1563 | g_return_val_if_fail(GTK_IS_V3270(widget),-1); |
src/pw3270/window.c
@@ -195,13 +195,13 @@ | @@ -195,13 +195,13 @@ | ||
195 | g_free(ptr); | 195 | g_free(ptr); |
196 | } | 196 | } |
197 | 197 | ||
198 | + */ | ||
199 | + | ||
198 | if(colors) | 200 | if(colors) |
199 | set_integer_to_config("host","colortype",colors); | 201 | set_integer_to_config("host","colortype",colors); |
200 | else | 202 | else |
201 | colors = get_integer_from_config("host","colortype",16); | 203 | colors = get_integer_from_config("host","colortype",16); |
202 | 204 | ||
203 | - */ | ||
204 | - | ||
205 | pw3270_set_session_color_type(widget,colors); | 205 | pw3270_set_session_color_type(widget,colors); |
206 | 206 | ||
207 | if(host) | 207 | if(host) |