From 0478f33b712f8aded3b7ade9538e052df02221e6 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 10 Oct 2019 11:19:16 -0300 Subject: [PATCH] Testing action activation. --- src/actions/lib3270.c | 4 ++++ src/actions/testprogram/testprogram.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/actions/lib3270.c b/src/actions/lib3270.c index c4f7289..416549f 100644 --- a/src/actions/lib3270.c +++ b/src/actions/lib3270.c @@ -70,8 +70,12 @@ H3270 * hSession = pw3270_window_get_session_handle(window); + debug("Activating action %s on hSession %p", pw3270_action_get_name(action), hSession); + if(hSession) PW3270_LIB3270_ACTION(action)->definition->activate(hSession); + else + g_message("Action \"%s\" requires a lib3270 session", pw3270_action_get_name(action)); } diff --git a/src/actions/testprogram/testprogram.c b/src/actions/testprogram/testprogram.c index 31915ae..506df65 100644 --- a/src/actions/testprogram/testprogram.c +++ b/src/actions/testprogram/testprogram.c @@ -36,12 +36,12 @@ /*---[ Implement ]----------------------------------------------------------------------------------*/ - GtkWidget * pw3270_window_get_terminal_widget(GtkWidget G_GNUC_UNUSED(*window)) { - return NULL; + GtkWidget * pw3270_window_get_terminal_widget(GtkWidget *window) { + return g_object_get_data(G_OBJECT(window), "v3270_terminal"); } - H3270 * pw3270_window_get_session_handle(GtkWidget G_GNUC_UNUSED(*window)) { - return NULL; + H3270 * pw3270_window_get_session_handle(GtkWidget *window) { + return v3270_get_session(pw3270_window_get_terminal_widget(window)); } static gboolean handle_command(GtkWidget *trace, const gchar *cmd, const gchar *args, GtkWidget *window) { @@ -71,6 +71,8 @@ GtkWidget * notebook = gtk_notebook_new(); GtkWidget * toolbar = gtk_toolbar_new(); + g_object_set_data(G_OBJECT(window),"v3270_terminal",terminal); + pw3270_window_add_actions(window); gtk_box_pack_start(GTK_BOX(vBox),toolbar,FALSE,TRUE,0); -- libgit2 0.21.2