From 669a2ae0ef5d8c7874f76479fec3fe4269be55c0 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 11 Oct 2019 13:55:58 -0300 Subject: [PATCH] Implementing toggle action object. --- src/actions/lib3270/toggle.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+), 0 deletions(-) create mode 100644 src/actions/lib3270/toggle.c diff --git a/src/actions/lib3270/toggle.c b/src/actions/lib3270/toggle.c new file mode 100644 index 0000000..4e18a36 --- /dev/null +++ b/src/actions/lib3270/toggle.c @@ -0,0 +1,98 @@ +/* + * "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) + * + */ + + /** + * @brief Implement GAction "wrapper" for lib3270's toggles. + * + */ + + #include "../private.h" + #include + + #define PW3270_TYPE_LIB3270_TOGGLE_ACTION (Lib3270ToggleAction_get_type()) + #define PW3270_LIB3270_TOGGLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), PW3270_TYPE_LIB3270_TOGGLE_ACTION, Lib3270Action)) + #define PW3270_IS_LIB3270_TOGGLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), PW3270_TYPE_LIB3270_TOGGLE_ACTION)) + + typedef struct _Lib3270ToggleActionClass { + pw3270ActionClass parent_class; + + } Lib3270ToggleActionClass; + + typedef struct _Lib3270ToggleAction { + pw3270Action parent; + + const LIB3270_TOGGLE_ENTRY * definition; + + } Lib3270ToggleAction; + + static void Lib3270ToggleAction_class_init(Lib3270ActionClass *klass); + static void Lib3270ToggleAction_init(Lib3270Action *action); + + G_DEFINE_TYPE(Lib3270ToggleAction, Lib3270ToggleAction, PW3270_TYPE_ACTION); + + static gboolean action_enabled(GAction *action, GtkWidget *window) { + + + return FALSE; + } + + static void action_activate(GAction *action, GtkWidget *window) { + + + } + + void Lib3270Action_class_init(Lib3270ActionClass *klass) { + + pw3270ActionClass * action = PW3270_TOGGLE_ACTION_CLASS(klass); + + action->get_enabled = action_enabled; + action->activate = action_activate; + + } + + void Lib3270Action_init(Lib3270Action *action) { + } + + GAction * pw3270_toggle_action_new_from_lib3270(const LIB3270_TOGGLE_ENTRY * definition, GtkWidget *window) { + + Lib3270Action * action = (Lib3270Action *) g_object_new(PW3270_TYPE_LIB3270_TOGGLE_ACTION, NULL); + pw3270Action * abstract = PW3270_ACTION(action); + + action->definition = definition; + abstract->window = window; + + if(abstract->name) + g_free(abstract->name); + + abstract->name = g_strconcat("win.",definition->name,NULL); + + return G_ACTION(action); + } + + -- libgit2 0.21.2