Commit 0478f33b712f8aded3b7ade9538e052df02221e6
1 parent
189e386b
Exists in
master
and in
4 other branches
Testing action activation.
Showing
2 changed files
with
10 additions
and
4 deletions
Show diff stats
src/actions/lib3270.c
| ... | ... | @@ -70,8 +70,12 @@ |
| 70 | 70 | |
| 71 | 71 | H3270 * hSession = pw3270_window_get_session_handle(window); |
| 72 | 72 | |
| 73 | + debug("Activating action %s on hSession %p", pw3270_action_get_name(action), hSession); | |
| 74 | + | |
| 73 | 75 | if(hSession) |
| 74 | 76 | PW3270_LIB3270_ACTION(action)->definition->activate(hSession); |
| 77 | + else | |
| 78 | + g_message("Action \"%s\" requires a lib3270 session", pw3270_action_get_name(action)); | |
| 75 | 79 | |
| 76 | 80 | } |
| 77 | 81 | ... | ... |
src/actions/testprogram/testprogram.c
| ... | ... | @@ -36,12 +36,12 @@ |
| 36 | 36 | |
| 37 | 37 | /*---[ Implement ]----------------------------------------------------------------------------------*/ |
| 38 | 38 | |
| 39 | - GtkWidget * pw3270_window_get_terminal_widget(GtkWidget G_GNUC_UNUSED(*window)) { | |
| 40 | - return NULL; | |
| 39 | + GtkWidget * pw3270_window_get_terminal_widget(GtkWidget *window) { | |
| 40 | + return g_object_get_data(G_OBJECT(window), "v3270_terminal"); | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - H3270 * pw3270_window_get_session_handle(GtkWidget G_GNUC_UNUSED(*window)) { | |
| 44 | - return NULL; | |
| 43 | + H3270 * pw3270_window_get_session_handle(GtkWidget *window) { | |
| 44 | + return v3270_get_session(pw3270_window_get_terminal_widget(window)); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | static gboolean handle_command(GtkWidget *trace, const gchar *cmd, const gchar *args, GtkWidget *window) { |
| ... | ... | @@ -71,6 +71,8 @@ |
| 71 | 71 | GtkWidget * notebook = gtk_notebook_new(); |
| 72 | 72 | GtkWidget * toolbar = gtk_toolbar_new(); |
| 73 | 73 | |
| 74 | + g_object_set_data(G_OBJECT(window),"v3270_terminal",terminal); | |
| 75 | + | |
| 74 | 76 | pw3270_window_add_actions(window); |
| 75 | 77 | |
| 76 | 78 | gtk_box_pack_start(GTK_BOX(vBox),toolbar,FALSE,TRUE,0); | ... | ... |