From cb68047cd0126034f8f40ed7af806e48ef65dc89 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 9 Dec 2019 09:57:22 -0300 Subject: [PATCH] Adding session properties dialog. --- pw3270.cbp | 8 ++++---- src/objects/window/actions/hostproperties.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/objects/window/actions/preferences.c | 56 -------------------------------------------------------- src/objects/window/actions/sessionproperties.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/objects/window/actions/sethost.c | 92 -------------------------------------------------------------------------------------------- src/objects/window/private.h | 5 +++-- src/objects/window/window.c | 6 +++--- ui/window.xml | 9 +++++++-- 8 files changed, 162 insertions(+), 159 deletions(-) create mode 100644 src/objects/window/actions/hostproperties.c delete mode 100644 src/objects/window/actions/preferences.c create mode 100644 src/objects/window/actions/sessionproperties.c delete mode 100644 src/objects/window/actions/sethost.c diff --git a/pw3270.cbp b/pw3270.cbp index bc822d9..963918b 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -129,16 +129,16 @@ - + - + - + - + diff --git a/src/objects/window/actions/hostproperties.c b/src/objects/window/actions/hostproperties.c new file mode 100644 index 0000000..f1ead66 --- /dev/null +++ b/src/objects/window/actions/hostproperties.c @@ -0,0 +1,71 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + + #include "../private.h" + #include + #include + #include + #include + + static GtkWidget * factory(GtkWidget *terminal); + + GAction * pw3270_action_host_properties_new(void) { + + pw3270SimpleAction * action = pw3270_dialog_action_new(factory); + + action->parent.name = "host.properties"; + action->group.id = LIB3270_ACTION_GROUP_OFFLINE; + action->icon_name = "network-server"; + action->label = N_("Host properties"); + + return G_ACTION(action); + } + + GtkWidget * factory(GtkWidget *terminal) { + + GtkWidget * dialog = v3270_settings_dialog_new(); + V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_select_new()); + + if(settings->title) + gtk_window_set_title(GTK_WINDOW(dialog), settings->title); + + gtk_container_add(GTK_CONTAINER(dialog), GTK_WIDGET(settings)); + + gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal))); + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); + + v3270_settings_dialog_set_terminal_widget(dialog, terminal); + + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); + g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),settings); + + return dialog; + + } + diff --git a/src/objects/window/actions/preferences.c b/src/objects/window/actions/preferences.c deleted file mode 100644 index 25f2c03..0000000 --- a/src/objects/window/actions/preferences.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Este programa está nomeado como - e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - - #include "../private.h" - #include - #include - #include - - static void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal); - - GAction * pw3270_session_preferences_action_new(void) { - - pw3270SimpleAction * action = pw3270_simple_action_new(); - - action->parent.activate = activate; - action->parent.name = "preferences"; - action->icon_name = "preferences-other"; - action->label = N_("Session properties"); - - return G_ACTION(action); - - - } - - void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { - - debug("%s","Activating session properties dialog"); - - } - diff --git a/src/objects/window/actions/sessionproperties.c b/src/objects/window/actions/sessionproperties.c new file mode 100644 index 0000000..f22f05c --- /dev/null +++ b/src/objects/window/actions/sessionproperties.c @@ -0,0 +1,74 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como - e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + + #include "../private.h" + #include + #include + #include + #include + #include + + static GtkWidget * factory(GtkWidget *terminal); + + GAction * pw3270_action_session_properties_new(void) { + + pw3270SimpleAction * action = pw3270_dialog_action_new(factory); + + action->parent.name = "session.properties"; + action->icon_name = "preferences-other"; + action->label = N_("Session properties"); + + return G_ACTION(action); + + + } + + GtkWidget * factory(GtkWidget *terminal) { + + GtkWidget * dialog = v3270_settings_dialog_new(); + + gtk_window_set_title(GTK_WINDOW(dialog), _("Session properties")); + + // Add settings pages. + gtk_container_add(GTK_CONTAINER(dialog), v3270_host_select_new()); + gtk_container_add(GTK_CONTAINER(dialog), v3270_color_selection_new()); + gtk_container_add(GTK_CONTAINER(dialog), v3270_font_chooser_widget_new()); + + // Setup dialog box + gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal))); + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); + + v3270_settings_dialog_set_terminal_widget(dialog, terminal); + + g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); + g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),terminal); + + return dialog; + + } diff --git a/src/objects/window/actions/sethost.c b/src/objects/window/actions/sethost.c deleted file mode 100644 index cc028e9..0000000 --- a/src/objects/window/actions/sethost.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. - * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Este programa está nomeado como - e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - - #include "../private.h" - #include - #include - #include - #include - - static GtkWidget * factory(GtkWidget *terminal); - - GAction * pw3270_set_host_action_new(void) { - - pw3270SimpleAction * action = pw3270_dialog_action_new(factory); - - action->parent.name = "set.host"; - action->group.id = LIB3270_ACTION_GROUP_OFFLINE; - action->icon_name = "network-server"; - action->label = N_("Host definition"); - - return G_ACTION(action); - } - - /* - static void on_response(GtkWidget *dialog, gint response_id, GtkWidget *settings) { - - if(response_id == GTK_RESPONSE_APPLY) { - - GtkWidget * terminal = v3270_settings_get_terminal_widget(settings); - - v3270_settings_dialog_apply(dialog); - if(terminal) - lib3270_reconnect(v3270_get_session(terminal),0); - - } else { - - v3270_settings_dialog_revert(dialog); - } - - gtk_widget_destroy(GTK_WIDGET(dialog)); - - } - */ - - GtkWidget * factory(GtkWidget *terminal) { - - GtkWidget * dialog = v3270_settings_dialog_new(); - V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_select_new()); - - if(settings->title) - gtk_window_set_title(GTK_WINDOW(dialog), settings->title); - - gtk_container_add(GTK_CONTAINER(dialog), GTK_WIDGET(settings)); - - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal))); - gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); - - v3270_settings_dialog_set_terminal_widget(dialog, terminal); - - g_signal_connect(dialog,"close",G_CALLBACK(gtk_widget_destroy),NULL); - g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),settings); - - return dialog; - - } - diff --git a/src/objects/window/private.h b/src/objects/window/private.h index 101c34b..514b06f 100644 --- a/src/objects/window/private.h +++ b/src/objects/window/private.h @@ -77,11 +77,12 @@ G_GNUC_INTERNAL GtkWidget * pw3270_setup_image_button(GtkWidget *button, const gchar *image_name); // Actions - GAction * pw3270_set_host_action_new(void); + GAction * pw3270_action_host_properties_new(void); GAction * pw3270_set_color_action_new(void); - GAction * pw3270_session_preferences_action_new(void); GAction * pw3270_file_transfer_action_new(void); + GAction * pw3270_action_session_properties_new(void); + // Terminal actions. GAction * pw3270_model_number_action_new(GtkWidget *terminal); diff --git a/src/objects/window/window.c b/src/objects/window/window.c index a17616a..c5fd888 100644 --- a/src/objects/window/window.c +++ b/src/objects/window/window.c @@ -111,9 +111,9 @@ size_t ix; GAction * actions[] = { - pw3270_set_host_action_new(), + pw3270_action_host_properties_new(), pw3270_set_color_action_new(), - pw3270_session_preferences_action_new(), + pw3270_action_session_properties_new(), pw3270_file_transfer_action_new() }; @@ -162,7 +162,7 @@ "win.disconnect", "separator", "win.set.colors", - "win.preferences", + "win.session.properties", "win.file.transfer", "win.print", "app.quit" diff --git a/ui/window.xml b/ui/window.xml index 6bd6d2c..a59752c 100644 --- a/ui/window.xml +++ b/ui/window.xml @@ -44,6 +44,11 @@ + Session properties + win.session.properties + + + Preferences win.preferences @@ -296,8 +301,8 @@ - Host properties - win.set.host + Session properties + win.session.properties -- libgit2 0.21.2