From c6335708f56af01c1a0368f9f1abe0e1ffb8d2a9 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 3 Dec 2021 11:05:34 -0300 Subject: [PATCH] Moving _fire_copy and _fire_past to static in the action table source. --- src/terminal/actions/clipboard.c | 78 ------------------------------------------------------------------------------ src/terminal/actions/private.h | 38 +++++++++++++------------------------- src/terminal/actions/table.c | 86 ++++++++++++++++++++++++++++++++++++++++---------------------------------------------- 3 files changed, 53 insertions(+), 149 deletions(-) delete mode 100644 src/terminal/actions/clipboard.c diff --git a/src/terminal/actions/clipboard.c b/src/terminal/actions/clipboard.c deleted file mode 100644 index 18f74d8..0000000 --- a/src/terminal/actions/clipboard.c +++ /dev/null @@ -1,78 +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 properties.c 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 - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - - int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION * action) { - - debug("%s",__FUNCTION__); - - v3270_clipboard_set( - widget, - (action->flags & 0x0F), - (action->flags & V3270_ACTION_FLAG_CUT) != 0 - ); - - return EINVAL; - } - - int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION * action) { - - switch((int) action->flags) - { - case 0: // Default paste. - v3270_clipboard_get_from_url(widget,NULL); - break; - - case 1: // Text paste. - v3270_clipboard_get_from_url(widget,"text://"); - break; - - case 2: // File paste. - v3270_clipboard_get_from_url(widget,"file://"); - break; - - case 3: // screen paste. - v3270_clipboard_get_from_url(widget,"screen://"); - break; - - default: - g_warning("Unexpected paste flags %u",(unsigned int) action->flags); - } - - return 0; - } - - diff --git a/src/terminal/actions/private.h b/src/terminal/actions/private.h index 217cbbc..9c3b0c4 100644 --- a/src/terminal/actions/private.h +++ b/src/terminal/actions/private.h @@ -1,30 +1,20 @@ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ + /* - * "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. + * Copyright (C) 2008 Banco do Brasil S.A. * - * Contatos: + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . */ #include @@ -55,8 +45,6 @@ // Internal methods - G_GNUC_INTERNAL int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION *action); - G_GNUC_INTERNAL int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION *action); G_GNUC_INTERNAL int fire_zoom_action(GtkWidget *widget, const V3270_ACTION *action); G_GNUC_INTERNAL int fire_save_action(GtkWidget *widget, const V3270_ACTION *action); G_GNUC_INTERNAL int fire_print_action(GtkWidget *widget, const V3270_ACTION *action); diff --git a/src/terminal/actions/table.c b/src/terminal/actions/table.c index 00a729d..e579aae 100644 --- a/src/terminal/actions/table.c +++ b/src/terminal/actions/table.c @@ -27,6 +27,9 @@ static int fire_copy_as_html(GtkWidget *widget, const struct _v3270_action * action); static int fire_copy_as_pixbuff(GtkWidget *widget, const struct _v3270_action * action); + static int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION *action); + static int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION *action); + // Dialogs static int fire_accelerators_dialog(GtkWidget *widget, const struct _v3270_action * action); static int fire_host_dialog(GtkWidget *widget, const struct _v3270_action * action); @@ -402,7 +405,6 @@ } static int fire_host_dialog(GtkWidget *widget, const struct _v3270_action G_GNUC_UNUSED(* action)) { - gtk_widget_show_all( v3270_settings_popup_dialog( v3270_host_settings_new(), @@ -410,51 +412,7 @@ TRUE ) ); - return 0; - - /* - GtkWidget * dialog = v3270_settings_dialog_new(); - GtkWidget * settings = v3270_host_settings_new(); - - v3270_settings_dialog_set_has_subtitle(dialog,FALSE); - - gtk_window_set_title(GTK_WINDOW(dialog), v3270_settings_get_title(settings)); - gtk_container_add(GTK_CONTAINER(dialog), settings); - - gtk_dialog_set_toplevel(dialog,widget); - gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); - - v3270_settings_dialog_set_terminal_widget(dialog, widget); - - gtk_window_set_default_size(GTK_WINDOW(dialog), 700, 150); - gtk_widget_show_all(dialog); - - gboolean again = TRUE; - while(again) - { - gtk_widget_set_sensitive(dialog,TRUE); - gtk_widget_set_visible(dialog,TRUE); - - switch(gtk_dialog_run(GTK_DIALOG(dialog))) - { - case GTK_RESPONSE_APPLY: - debug("V3270HostSelectWidget::%s=%s",__FUNCTION__,"GTK_RESPONSE_APPLY"); - v3270_settings_dialog_apply(dialog); - again = lib3270_reconnect(v3270_get_session(widget),0); - break; - - case GTK_RESPONSE_CANCEL: - again = FALSE; - debug("V3270HostSelectWidget::%s=%s",__FUNCTION__,"GTK_RESPONSE_CANCEL"); - v3270_settings_dialog_revert(dialog); - break; - } - } - - gtk_widget_destroy(dialog); - */ - } static int fire_color_dialog(GtkWidget *widget, const struct _v3270_action G_GNUC_UNUSED(* action)) { @@ -487,9 +445,45 @@ widget, TRUE ); - gtk_window_set_default_size(GTK_WINDOW(dialog),950,400); gtk_widget_show_all(dialog); + return 0; + } + + static int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION * action) { + + v3270_clipboard_set( + widget, + (action->flags & 0x0F), + (action->flags & V3270_ACTION_FLAG_CUT) != 0 + ); + + return EINVAL; + } + + static int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION * action) { + + switch((int) action->flags) + { + case 0: // Default paste. + v3270_clipboard_get_from_url(widget,NULL); + break; + + case 1: // Text paste. + v3270_clipboard_get_from_url(widget,"text://"); + break; + + case 2: // File paste. + v3270_clipboard_get_from_url(widget,"file://"); + break; + + case 3: // screen paste. + v3270_clipboard_get_from_url(widget,"screen://"); + break; + + default: + g_warning("Unexpected paste flags %u",(unsigned int) action->flags); + } return 0; } -- libgit2 0.21.2