Commit fa8e805ec8d6e844ca7e7a082754bbaa56b62046
1 parent
1e41280f
Exists in
master
and in
5 other branches
Evitando redundancias no dialogo de configuracao de hostname
Showing
3 changed files
with
28 additions
and
46 deletions
Show diff stats
src/include/lib3270.h
@@ -259,16 +259,11 @@ | @@ -259,16 +259,11 @@ | ||
259 | #define LIB3270_OPTION_HOST_TYPE 0x0007 | 259 | #define LIB3270_OPTION_HOST_TYPE 0x0007 |
260 | #define LIB3270_OPTION_DEFAULTS LIB3270_OPTION_S390 | 260 | #define LIB3270_OPTION_DEFAULTS LIB3270_OPTION_S390 |
261 | 261 | ||
262 | -// LIB3270_OPTION_COLOR8 = 0x0001, /**< If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors. */ | ||
263 | - | ||
264 | -// #define LIB3270_OPTION_DEFAULT 0 | ||
265 | - #define LIB3270_OPTION_COUNT 3 | ||
266 | - | ||
267 | typedef struct _lib3270_option_entry | 262 | typedef struct _lib3270_option_entry |
268 | { | 263 | { |
269 | - LIB3270_OPTION value; | ||
270 | - const char * key; | ||
271 | - const char * text; | 264 | + LIB3270_OPTION option; |
265 | + const char * name; | ||
266 | + const char * description; | ||
272 | const char * tooltip; | 267 | const char * tooltip; |
273 | } LIB3270_OPTION_ENTRY; | 268 | } LIB3270_OPTION_ENTRY; |
274 | 269 | ||
@@ -398,7 +393,7 @@ | @@ -398,7 +393,7 @@ | ||
398 | * Set host id for the connect/reconnect operations. | 393 | * Set host id for the connect/reconnect operations. |
399 | * | 394 | * |
400 | * @param h Session handle. | 395 | * @param h Session handle. |
401 | - * @param url URL of host to set in the format tn3270://hostname:service ou tn3270s://hostname:service . | 396 | + * @param url URL of host to set in the format tn3270://hostname:service or tn3270s://hostname:service . |
402 | * | 397 | * |
403 | * @return Processed host url | 398 | * @return Processed host url |
404 | * | 399 | * |
@@ -415,7 +410,7 @@ | @@ -415,7 +410,7 @@ | ||
415 | */ | 410 | */ |
416 | LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); | 411 | LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h); |
417 | 412 | ||
418 | - LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname); | 413 | + LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname); |
419 | 414 | ||
420 | 415 | ||
421 | /** | 416 | /** |
src/lib3270/options.c
@@ -33,34 +33,32 @@ | @@ -33,34 +33,32 @@ | ||
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 | - | ||
48 | - | ||
49 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ | 36 | /*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ |
50 | 37 | ||
51 | - static const const LIB3270_OPTION_ENTRY options[LIB3270_OPTION_COUNT+1] = | 38 | + static const const LIB3270_OPTION_ENTRY host_type[] = |
52 | { | 39 | { |
53 | { | 40 | { |
41 | + LIB3270_OPTION_S390, | ||
42 | + "S390", | ||
43 | + N_( "IBM S/390" ), | ||
44 | + NULL | ||
45 | + }, | ||
46 | + { | ||
54 | LIB3270_OPTION_AS400, | 47 | LIB3270_OPTION_AS400, |
55 | - "as400", | ||
56 | - N_( "Host is AS/400" ), | 48 | + "AS400", |
49 | + N_( "IBM AS/400" ), | ||
57 | NULL | 50 | NULL |
58 | }, | 51 | }, |
59 | - | ||
60 | { | 52 | { |
61 | LIB3270_OPTION_TSO, | 53 | LIB3270_OPTION_TSO, |
62 | - "tso", | ||
63 | - N_( "Host is TSO" ), | 54 | + "TSO", |
55 | + N_( "Other (TSO)" ), | ||
56 | + NULL | ||
57 | + }, | ||
58 | + { | ||
59 | + 0, | ||
60 | + "VM/CMS", | ||
61 | + N_( "Other (VM/CMS)" ), | ||
64 | NULL | 62 | NULL |
65 | }, | 63 | }, |
66 | 64 | ||
@@ -70,11 +68,9 @@ | @@ -70,11 +68,9 @@ | ||
70 | NULL, | 68 | NULL, |
71 | NULL | 69 | NULL |
72 | } | 70 | } |
73 | - | ||
74 | }; | 71 | }; |
75 | 72 | ||
76 | 73 | ||
77 | - | ||
78 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ | 74 | /*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
79 | 75 | ||
80 | LIB3270_EXPORT LIB3270_OPTION lib3270_get_options(H3270 *hSession) | 76 | LIB3270_EXPORT LIB3270_OPTION lib3270_get_options(H3270 *hSession) |
@@ -134,7 +130,7 @@ LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colort | @@ -134,7 +130,7 @@ LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colort | ||
134 | 130 | ||
135 | LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void) | 131 | LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void) |
136 | { | 132 | { |
137 | - return options; | 133 | + return host_type; |
138 | } | 134 | } |
139 | 135 | ||
140 | LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) | 136 | LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) |
@@ -145,6 +141,7 @@ LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) | @@ -145,6 +141,7 @@ LIB3270_EXPORT int lib3270_is_tso(H3270 *hSession) | ||
145 | 141 | ||
146 | LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name) | 142 | LIB3270_EXPORT LIB3270_OPTION lib3270_parse_host_type(const char *name) |
147 | { | 143 | { |
144 | + | ||
148 | int f; | 145 | int f; |
149 | 146 | ||
150 | for(f=0;f<(sizeof(host_type)/sizeof(host_type[0]));f++) | 147 | for(f=0;f<(sizeof(host_type)/sizeof(host_type[0]));f++) |
src/pw3270/v3270/hostselect.c
@@ -28,22 +28,11 @@ | @@ -28,22 +28,11 @@ | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "hostselect.h" | 30 | #include "hostselect.h" |
31 | + #include <lib3270/log.h> | ||
31 | #include <pw3270/v3270.h> | 32 | #include <pw3270/v3270.h> |
32 | 33 | ||
33 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ | 34 | /*--[ Widget definition ]----------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | - static const struct _host_type | ||
36 | - { | ||
37 | - const gchar * description; | ||
38 | - LIB3270_OPTION option; | ||
39 | - } host_type[] = | ||
40 | - { | ||
41 | - { N_( "IBM S/390" ), LIB3270_OPTION_S390 }, | ||
42 | - { N_( "IBM AS/400" ), LIB3270_OPTION_AS400 }, | ||
43 | - { N_( "Other (TSO)" ), LIB3270_OPTION_TSO }, | ||
44 | - { N_( "Other (VM/CMS)" ), 0 } | ||
45 | - }; | ||
46 | - | ||
47 | static const struct _colortable | 36 | static const struct _colortable |
48 | { | 37 | { |
49 | unsigned short colors; | 38 | unsigned short colors; |
@@ -191,11 +180,12 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | @@ -191,11 +180,12 @@ static void V3270HostSelectWidget_init(V3270HostSelectWidget *widget) | ||
191 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->combo[0]), renderer, TRUE); | 180 | gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget->combo[0]), renderer, TRUE); |
192 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->combo[0]), renderer, "text", 0, NULL); | 181 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->combo[0]), renderer, "text", 0, NULL); |
193 | 182 | ||
194 | - for(f=0;f<G_N_ELEMENTS(host_type);f++) | 183 | + const LIB3270_OPTION_ENTRY *entry = lib3270_get_option_list(); |
184 | + for(f=0;entry[f].name != NULL;f++) | ||
195 | { | 185 | { |
196 | GtkTreeIter iter; | 186 | GtkTreeIter iter; |
197 | gtk_list_store_append((GtkListStore *) model,&iter); | 187 | gtk_list_store_append((GtkListStore *) model,&iter); |
198 | - gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(host_type[f].description), 1, host_type[f].option, -1); | 188 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(entry[f].description), 1, entry[f].option, -1); |
199 | } | 189 | } |
200 | 190 | ||
201 | g_signal_connect(G_OBJECT(widget->combo[0]),"changed",G_CALLBACK(systype_changed),widget); | 191 | g_signal_connect(G_OBJECT(widget->combo[0]),"changed",G_CALLBACK(systype_changed),widget); |