Commit b23ffbada534c7fcb584aba21c6017348ec6f677
1 parent
55be299a
Exists in
master
and in
1 other branch
Testing terminal widget.
Showing
2 changed files
with
41 additions
and
5 deletions
Show diff stats
src/dialogs/hostselect.c
... | ... | @@ -285,8 +285,6 @@ LIB3270_EXPORT void v3270_host_select_set_session(GtkWidget *w, GtkWidget *sessi |
285 | 285 | |
286 | 286 | gtk_tree_model_get_value(model,&iter,1,&value); |
287 | 287 | |
288 | - g_message("%d - %d",g_value_get_int(&value),colors); | |
289 | - | |
290 | 288 | if(g_value_get_int(&value) == colors) |
291 | 289 | { |
292 | 290 | gtk_combo_box_set_active_iter(widget->input.combo[1],&iter); | ... | ... |
src/testprogram/testprogram.c
... | ... | @@ -135,6 +135,16 @@ static void host_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) |
135 | 135 | v3270_select_host(terminal); |
136 | 136 | } |
137 | 137 | |
138 | +static void connect_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) | |
139 | +{ | |
140 | + lib3270_reconnect(v3270_get_session(terminal),0); | |
141 | +} | |
142 | + | |
143 | +static void disconnect_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) | |
144 | +{ | |
145 | + lib3270_disconnect(v3270_get_session(terminal)); | |
146 | +} | |
147 | + | |
138 | 148 | static void color_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal) |
139 | 149 | { |
140 | 150 | GtkWidget * dialog = v3270_dialog_new(_("Color setup"), NULL, _("_Save")); |
... | ... | @@ -165,8 +175,10 @@ static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { |
165 | 175 | GtkWidget * window = gtk_application_window_new(app); |
166 | 176 | GtkWidget * terminal = v3270_new(); |
167 | 177 | GValue val = G_VALUE_INIT; |
178 | + size_t f; | |
168 | 179 | |
169 | 180 | v3270_set_url(terminal,NULL); |
181 | + v3270_set_toggle(terminal,LIB3270_TOGGLE_RECONNECT,TRUE); | |
170 | 182 | |
171 | 183 | // v3270_set_font_family(terminal,"Droid Sans Mono"); |
172 | 184 | g_signal_connect(terminal,"field_clicked",G_CALLBACK(field_clicked),window); |
... | ... | @@ -219,10 +231,33 @@ static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { |
219 | 231 | |
220 | 232 | // Create box |
221 | 233 | GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL,2); |
222 | - GtkWidget *grid = gtk_grid_new(); | |
234 | + | |
235 | + // https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html | |
236 | + static const struct _buttons { | |
237 | + const gchar * icon; | |
238 | + GCallback callback; | |
239 | + const gchar * tooltip; | |
240 | + } buttons[] = { | |
241 | + { "gtk-connect", G_CALLBACK(connect_clicked), "Connect to host" }, | |
242 | + { "gtk-disconnect", G_CALLBACK(disconnect_clicked), "Disconnect from host" }, | |
243 | + { "gtk-select-color", G_CALLBACK(color_clicked), "Edit or change color scheme" }, | |
244 | + { "gtk-home", G_CALLBACK(host_clicked), "Configure host" }, | |
245 | + { "gtk-print", G_CALLBACK(print_clicked), "Print screen contents" } | |
246 | + }; | |
247 | + | |
248 | + GtkWidget * toolbar = gtk_toolbar_new(); | |
249 | + for(f = 0; f < G_N_ELEMENTS(buttons); f++) | |
250 | + { | |
251 | + GtkWidget * button = gtk_tool_button_new_from_stock(buttons[f].icon); | |
252 | + gtk_widget_set_tooltip_markup(button,buttons[f].tooltip); | |
253 | + g_signal_connect(G_OBJECT(button),"clicked",buttons[f].callback,terminal); | |
254 | + gtk_toolbar_insert(GTK_TOOLBAR(toolbar),GTK_TOOL_ITEM(button),-1); | |
255 | + } | |
256 | + | |
257 | + /* | |
223 | 258 | GtkWidget *color = gtk_button_new_with_label("Colors"); |
224 | 259 | GtkWidget *print = gtk_button_new_with_label("Print"); |
225 | - GtkWidget *host = gtk_button_new_with_label("Host"); | |
260 | + GtkWidget *host = gtk_button_new_with_label("Host"); | |
226 | 261 | |
227 | 262 | gtk_widget_set_focus_on_click(print,FALSE); |
228 | 263 | g_signal_connect(G_OBJECT(print),"clicked",G_CALLBACK(print_clicked),terminal); |
... | ... | @@ -232,17 +267,20 @@ static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { |
232 | 267 | |
233 | 268 | gtk_widget_set_focus_on_click(color,FALSE); |
234 | 269 | g_signal_connect(G_OBJECT(color),"clicked",G_CALLBACK(color_clicked),terminal); |
270 | + */ | |
235 | 271 | |
236 | 272 | /* |
237 | 273 | v3270_color_scheme_set_rgba(color,v3270_get_color_table(terminal)); |
238 | 274 | g_signal_connect(G_OBJECT(color),"update-colors",G_CALLBACK(color_scheme_changed),terminal); |
239 | 275 | */ |
240 | 276 | |
277 | + /* | |
241 | 278 | gtk_grid_attach(GTK_GRID(grid),color,0,0,1,1); |
242 | 279 | gtk_grid_attach(GTK_GRID(grid),print,1,0,1,1); |
243 | 280 | gtk_grid_attach(GTK_GRID(grid),host,2,0,1,1); |
281 | + */ | |
244 | 282 | |
245 | - gtk_box_pack_start(GTK_BOX(box),grid,FALSE,TRUE,0); | |
283 | + gtk_box_pack_start(GTK_BOX(box),toolbar,FALSE,TRUE,0); | |
246 | 284 | gtk_box_pack_start(GTK_BOX(box),terminal,TRUE,TRUE,0); |
247 | 285 | |
248 | 286 | // Setup and show window | ... | ... |