From 662a8eb2f55cde0af5885f1103fec46c54122b4d Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 21 Jun 2019 10:51:53 -0300 Subject: [PATCH] Working on the new IPC plugin module. --- pw3270-plugin-ipc.cbp | 1 - src/plugin/plugin.c | 2 +- src/testprogram/testprogram.c | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/pw3270-plugin-ipc.cbp b/pw3270-plugin-ipc.cbp index aebb3d2..91cf765 100644 --- a/pw3270-plugin-ipc.cbp +++ b/pw3270-plugin-ipc.cbp @@ -80,7 +80,6 @@ - diff --git a/src/plugin/plugin.c b/src/plugin/plugin.c index 04ac8b0..607c423 100644 --- a/src/plugin/plugin.c +++ b/src/plugin/plugin.c @@ -30,7 +30,7 @@ /** - * @brief Plugin startup/stop for linux. + * @brief IPC Plugin startup/stop for linux. * */ diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 4f813c5..8a68f49 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -121,6 +121,30 @@ return item; } + static void session_changed(GtkWidget *widget, GtkWidget *window) { + + g_autofree gchar * title = NULL; + + g_message("Session name was changed"); + + if(v3270_is_connected(widget)) { + const gchar *host = v3270_get_hostname(widget); + + if(host && *host) + title = g_strdup_printf("%s - %s",v3270_get_session_name(widget),host); + else + title = g_strdup_printf("%s",v3270_get_session_name(widget)); + + } else { + + title = g_strdup_printf("%s - Disconnected",v3270_get_session_name(widget)); + } + + gtk_window_set_title(GTK_WINDOW(window),title); + + + } + static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { GtkWidget * window = gtk_application_window_new(app); @@ -204,6 +228,8 @@ } + g_signal_connect(terminal,"session_changed",G_CALLBACK(session_changed),window); + } int main (int argc, char **argv) { -- libgit2 0.21.2