Commit ee1db88e2ef567fa77c433dce7a99d0c96daa749
1 parent
c03eb89e
Exists in
master
and in
5 other branches
Finalizando diálogo de configuração do host
Showing
1 changed file
with
44 additions
and
5 deletions
Show diff stats
src/pw3270/hostdialog.c
... | ... | @@ -69,7 +69,39 @@ |
69 | 69 | gtk_label_set_mnemonic_widget(GTK_LABEL(label),widget); |
70 | 70 | } |
71 | 71 | |
72 | - void hostname_action(GtkAction *action, GtkWidget *widget) | |
72 | + static void systype_changed(GtkComboBox *widget, int *iHostType) | |
73 | + { | |
74 | + GValue value = { 0, }; | |
75 | + GtkTreeIter iter; | |
76 | + | |
77 | + if(!gtk_combo_box_get_active_iter(widget,&iter)) | |
78 | + return; | |
79 | + | |
80 | + gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,1,&value); | |
81 | + | |
82 | + *iHostType = g_value_get_int(&value); | |
83 | + | |
84 | + trace("Selected host type: %s",host_type[*iHostType].name); | |
85 | + | |
86 | + } | |
87 | + | |
88 | + static void color_changed(GtkComboBox *widget, int *iColorTable) | |
89 | + { | |
90 | + GValue value = { 0, }; | |
91 | + GtkTreeIter iter; | |
92 | + | |
93 | + if(!gtk_combo_box_get_active_iter(widget,&iter)) | |
94 | + return; | |
95 | + | |
96 | + gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,1,&value); | |
97 | + | |
98 | + *iColorTable = g_value_get_int(&value); | |
99 | + | |
100 | + trace("Selected color type: %d",(int) colortable[*iColorTable].colors); | |
101 | + | |
102 | + } | |
103 | + | |
104 | + void hostname_action(GtkAction *action, GtkWidget *widget) | |
73 | 105 | { |
74 | 106 | const gchar * title = g_object_get_data(G_OBJECT(action),"title"); |
75 | 107 | gchar * cfghost = get_string_from_config("host","uri",""); |
... | ... | @@ -144,13 +176,15 @@ |
144 | 176 | gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(host_type[f].description), 1, f, -1); |
145 | 177 | |
146 | 178 | if(!g_ascii_strcasecmp(host_type[f].name,str)) |
147 | - gtk_combo_box_set_active(GTK_COMBO_BOX(widget),f); | |
179 | + gtk_combo_box_set_active(GTK_COMBO_BOX(widget),iHostType=f); | |
148 | 180 | } |
149 | 181 | |
150 | 182 | g_free(str); |
151 | 183 | |
152 | 184 | set_row(row++,widget,container,_("System _type:")); |
153 | 185 | |
186 | + g_signal_connect(G_OBJECT(widget),"changed",G_CALLBACK(systype_changed),&iHostType); | |
187 | + | |
154 | 188 | } |
155 | 189 | else |
156 | 190 | { |
... | ... | @@ -175,18 +209,20 @@ |
175 | 209 | GtkTreeIter iter; |
176 | 210 | |
177 | 211 | gtk_list_store_append((GtkListStore *) model,&iter); |
178 | - gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(colortable[f].description), 1, (int) colortable[f].colors, -1); | |
212 | + gtk_list_store_set((GtkListStore *) model, &iter, 0, gettext(colortable[f].description), 1, (int) f, -1); | |
179 | 213 | |
180 | 214 | if(colortable[f].colors == colors) |
181 | - gtk_combo_box_set_active(GTK_COMBO_BOX(widget),f); | |
215 | + gtk_combo_box_set_active(GTK_COMBO_BOX(widget),iColorTable=f); | |
182 | 216 | } |
183 | 217 | |
184 | 218 | set_row(row++,widget,container,_("_Color table:")); |
185 | 219 | |
220 | + g_signal_connect(G_OBJECT(widget),"changed",G_CALLBACK(color_changed),&iColorTable); | |
221 | + | |
186 | 222 | } |
187 | 223 | else |
188 | 224 | { |
189 | - #warning TODO: Configurar tabela de cores de acordo com systype | |
225 | + #warning TODO: Configurar tabela de cores de acordo com colortype | |
190 | 226 | } |
191 | 227 | |
192 | 228 | gtk_container_add(GTK_CONTAINER(expander),GTK_WIDGET(container)); |
... | ... | @@ -244,6 +280,9 @@ |
244 | 280 | |
245 | 281 | gtk_widget_set_visible(dialog,FALSE); |
246 | 282 | |
283 | + set_string_to_config("host","systype",host_type[iHostType].name); | |
284 | + set_integer_to_config("host","colortype",colortable[iColorTable].colors); | |
285 | + | |
247 | 286 | v3270_set_session_options(widget,host_type[iHostType].option); |
248 | 287 | v3270_set_session_color_type(widget,colortable[iColorTable].colors); |
249 | 288 | ... | ... |