From 1bc8832009583783c145efde9dfdce91ba4ae9b9 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 30 Oct 2019 16:25:50 -0300 Subject: [PATCH] Adding "file transfer" dialog. --- pw3270.cbp | 3 +++ src/objects/toolbar/toolbutton.c | 8 -------- src/objects/window/actions/filetransfer.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/objects/window/private.h | 1 + src/objects/window/window.c | 3 ++- ui/application.xml | 2 +- 6 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 src/objects/window/actions/filetransfer.c diff --git a/pw3270.cbp b/pw3270.cbp index 8933c51..0eea8b5 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -108,6 +108,9 @@ + + diff --git a/src/objects/toolbar/toolbutton.c b/src/objects/toolbar/toolbutton.c index 14eaafc..4b6be40 100644 --- a/src/objects/toolbar/toolbutton.c +++ b/src/objects/toolbar/toolbutton.c @@ -63,14 +63,6 @@ .tooltip = N_("Quit application") }, - { - .name = "file.transfer", - .icon_name = "drive-harddisk", - .label = N_("Send/Receive"), - .tooltip = N_("Send/Receive files") - } - - }; static const struct Button * get_button_info(const gchar *name) { diff --git a/src/objects/window/actions/filetransfer.c b/src/objects/window/actions/filetransfer.c new file mode 100644 index 0000000..95183bb --- /dev/null +++ b/src/objects/window/actions/filetransfer.c @@ -0,0 +1,84 @@ +/* + * "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_file_transfer_action_new(void) { + + pw3270SimpleAction * action = pw3270_simple_action_new(); + + action->parent.activate = activate; + action->parent.name = "file.transfer"; + action->icon_name = "drive-harddisk"; + action->label = N_("Send/Receive"); + action->tooltip = N_("Send/Receive files"); + + return G_ACTION(action); + + } + + void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) { + + debug("%s","Activating file transfer dialog"); + + GtkWidget * dialog = v3270ft_new(gtk_widget_get_toplevel(terminal)); + + do { + + gtk_widget_show_all(dialog); + + switch(gtk_dialog_run(GTK_DIALOG(dialog))) { + case GTK_RESPONSE_APPLY: + case GTK_RESPONSE_OK: + case GTK_RESPONSE_YES: + gtk_widget_hide(dialog); + v3270ft_transfer(dialog,v3270_get_session(terminal)); + break; + + case GTK_RESPONSE_CANCEL: + case GTK_RESPONSE_NO: + case GTK_RESPONSE_DELETE_EVENT: + v3270ft_remove_all(dialog); + break; + + default: + g_warning("Unexpected response from v3270ft"); + } + + } while(v3270ft_get_length(dialog) > 0); + + gtk_widget_destroy(dialog); + + } + diff --git a/src/objects/window/private.h b/src/objects/window/private.h index 6b3bfc6..2cd19ef 100644 --- a/src/objects/window/private.h +++ b/src/objects/window/private.h @@ -68,6 +68,7 @@ GAction * pw3270_set_host_action_new(void); GAction * pw3270_set_color_action_new(void); GAction * pw3270_session_preferences_action_new(void); + GAction * pw3270_file_transfer_action_new(void); G_GNUC_INTERNAL void pw3270_window_open_activated(GSimpleAction * action, GVariant *parameter, gpointer application); G_GNUC_INTERNAL void pw3270_window_close_activated(GSimpleAction * action, GVariant *parameter, gpointer application); diff --git a/src/objects/window/window.c b/src/objects/window/window.c index 4855050..46ee26b 100644 --- a/src/objects/window/window.c +++ b/src/objects/window/window.c @@ -102,7 +102,8 @@ GAction * actions[] = { pw3270_set_host_action_new(), pw3270_set_color_action_new(), - pw3270_session_preferences_action_new() + pw3270_session_preferences_action_new(), + pw3270_file_transfer_action_new() }; for(ix = 0; ix < G_N_ELEMENTS(actions); ix++) { diff --git a/ui/application.xml b/ui/application.xml index 42f79f4..a6e2baf 100644 --- a/ui/application.xml +++ b/ui/application.xml @@ -94,7 +94,7 @@ Send/Receive files - win.file_transfer + win.file.transfer -- libgit2 0.21.2