Commit 54c30a1273683a1f9e0ce84e108a911f8c999a4e
1 parent
6bb62c53
Exists in
master
and in
4 other branches
Working in the main window.
Showing
3 changed files
with
20 additions
and
4 deletions
Show diff stats
src/widgets/window/terminal.c
... | ... | @@ -28,21 +28,32 @@ |
28 | 28 | */ |
29 | 29 | |
30 | 30 | #include "private.h" |
31 | + #include <pw3270/actions.h> | |
31 | 32 | |
32 | 33 | static gboolean on_terminal_focus(GtkWidget *terminal, GdkEvent *event, pw3270ApplicationWindow * window) { |
33 | 34 | |
34 | 35 | debug("Focus on terminal %p", terminal); |
36 | + | |
35 | 37 | window->terminal = terminal; |
36 | 38 | |
37 | 39 | return FALSE; |
38 | 40 | } |
39 | 41 | |
40 | - GtkWidget * pw3270_terminal_new(GtkWidget *window) { | |
42 | + static void session_changed(GtkWidget *terminal, GtkWidget *label) { | |
43 | + gtk_label_set_text(GTK_LABEL(label),v3270_get_session_name(terminal)); | |
44 | + } | |
45 | + | |
46 | + GtkWidget * pw3270_terminal_new(GtkWidget *widget) { | |
41 | 47 | |
48 | + pw3270ApplicationWindow * window = PW3270_APPLICATION_WINDOW(widget); | |
42 | 49 | GtkWidget * terminal = v3270_new(); |
43 | - g_signal_connect(G_OBJECT(terminal), "focus-in-event", G_CALLBACK(on_terminal_focus), window); | |
50 | + GtkWidget * label = gtk_label_new(v3270_get_session_name(terminal)); | |
51 | + | |
52 | + g_signal_connect(G_OBJECT(terminal), "focus-in-event", G_CALLBACK(on_terminal_focus), widget); | |
53 | + g_signal_connect(G_OBJECT(terminal), "session_changed", G_CALLBACK(session_changed),label); | |
44 | 54 | |
45 | - gtk_notebook_append_page(PW3270_APPLICATION_WINDOW(window)->notebook,terminal,NULL); | |
55 | + gtk_notebook_append_page(GTK_NOTEBOOK(window->notebook),terminal,label); | |
56 | + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(window->notebook),gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->notebook)) > 1); | |
46 | 57 | |
47 | 58 | return terminal; |
48 | 59 | ... | ... |
src/widgets/window/testprogram/testprogram.c
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | */ |
30 | 30 | |
31 | 31 | #include <config.h> |
32 | - #include <pw3270/toolbar.h> | |
32 | + #include <pw3270/window.h> | |
33 | 33 | #include <v3270.h> |
34 | 34 | #include <v3270/trace.h> |
35 | 35 | #include <lib3270/log.h> |
... | ... | @@ -40,6 +40,10 @@ |
40 | 40 | |
41 | 41 | GtkWidget * window = pw3270_application_window_new(app); |
42 | 42 | |
43 | + // Create terminal widget | |
44 | + pw3270_terminal_new(window); | |
45 | + pw3270_terminal_new(window); | |
46 | + | |
43 | 47 | // Setup and show main window |
44 | 48 | gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); |
45 | 49 | gtk_window_set_default_size (GTK_WINDOW (window), 800, 500); | ... | ... |
src/widgets/window/window.cbp
... | ... | @@ -38,6 +38,7 @@ |
38 | 38 | <Linker> |
39 | 39 | <Add option="`pkg-config --libs gtk+-3.0 libv3270`" /> |
40 | 40 | </Linker> |
41 | + <Unit filename="../../include/pw3270/actions.h" /> | |
41 | 42 | <Unit filename="../../include/pw3270/window.h" /> |
42 | 43 | <Unit filename="core.c"> |
43 | 44 | <Option compilerVar="CC" /> | ... | ... |