Commit 812c18aee34868ac7585ce5bc4a2935579c0cf4d

Authored by Perry Werneck
1 parent a5798a49
Exists in master and in 1 other branch develop

Adding PF/PA Actions.

src/include/v3270/actions.h
... ... @@ -165,6 +165,9 @@
165 165 LIB3270_EXPORT GAction * g_action_new_from_lib3270(const LIB3270_ACTION * definition);
166 166 LIB3270_EXPORT GAction * g_action_new_from_toggle(const LIB3270_TOGGLE * definition);
167 167  
  168 + LIB3270_EXPORT GAction * v3270_pfkey_action_new(void);
  169 + LIB3270_EXPORT GAction * v3270_pakey_action_new(void);
  170 +
168 171 LIB3270_EXPORT void g_action_map_add_v3270_actions(GActionMap *action_map);
169 172 LIB3270_EXPORT void g_action_map_add_lib3270_actions(GActionMap *action_map);
170 173 LIB3270_EXPORT void g_action_map_add_lib3270_toggles(GActionMap *action_map);
... ...
src/terminal/actions/pakey.c 0 → 100644
... ... @@ -0,0 +1,104 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + /**
  31 + * @brief Implement GAction "wrapper" for lib3270's PAs.
  32 + *
  33 + */
  34 +
  35 + #include <internals.h>
  36 + #include <v3270.h>
  37 + #include <v3270/actions.h>
  38 +
  39 + #define LIB3270_TYPE_PA_ACTION (Lib3270PaAction_get_type())
  40 + #define LIB3270_PA_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), LIB3270_TYPE_PA_ACTION, Lib3270PaAction))
  41 + #define LIB3270_IS_PA_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), LIB3270_TYPE_PA_ACTION))
  42 +
  43 + typedef struct _Lib3270PaActionClass {
  44 + V3270ActionClass parent_class;
  45 +
  46 + } Lib3270PaActionClass;
  47 +
  48 + typedef struct _Lib3270PaAction {
  49 + V3270Action parent;
  50 + } Lib3270PaAction;
  51 +
  52 + static void Lib3270PaAction_class_init(Lib3270PaActionClass *klass);
  53 + static void Lib3270PaAction_init(Lib3270PaAction *action);
  54 +
  55 + G_DEFINE_TYPE(Lib3270PaAction, Lib3270PaAction, V3270_TYPE_ACTION);
  56 +
  57 + static void activate(GAction *action, GVariant *parameter, GtkWidget *terminal) {
  58 +
  59 + if(action && terminal && parameter) {
  60 +
  61 + H3270 * hSession = v3270_get_session(terminal);
  62 +
  63 + if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_INT32)) {
  64 +
  65 + lib3270_pakey(hSession,(int) g_variant_get_int32(parameter));
  66 +
  67 + } else if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_UINT32)) {
  68 +
  69 + lib3270_pakey(hSession,(int) g_variant_get_uint32(parameter));
  70 +
  71 + } else if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_INT16)) {
  72 +
  73 + lib3270_pakey(hSession,(int) g_variant_get_int16(parameter));
  74 +
  75 + } else if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_UINT16)) {
  76 +
  77 + lib3270_pakey(hSession,(int) g_variant_get_uint16(parameter));
  78 +
  79 + }
  80 +
  81 + }
  82 +
  83 + }
  84 +
  85 + void Lib3270PaAction_class_init(Lib3270PaActionClass *klass) {
  86 + klass->parent_class.type.parameter = G_VARIANT_TYPE_UINT32;
  87 + }
  88 +
  89 + void Lib3270PaAction_init(Lib3270PaAction *action) {
  90 +
  91 + static const LIB3270_PROPERTY info = {
  92 + .name = "pakey",
  93 + .group = LIB3270_ACTION_GROUP_ONLINE
  94 + };
  95 +
  96 + action->parent.activate = activate;
  97 + action->parent.info = &info;
  98 +
  99 + }
  100 +
  101 + GAction * v3270_pakey_action_new(void) {
  102 + return G_ACTION(g_object_new(LIB3270_TYPE_PA_ACTION, NULL));
  103 + }
  104 +
... ...
src/terminal/actions/pfkey.c 0 → 100644
... ... @@ -0,0 +1,104 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + /**
  31 + * @brief Implement GAction "wrapper" for lib3270's PFs.
  32 + *
  33 + */
  34 +
  35 + #include <internals.h>
  36 + #include <v3270.h>
  37 + #include <v3270/actions.h>
  38 +
  39 + #define LIB3270_TYPE_PF_ACTION (Lib3270PfAction_get_type())
  40 + #define LIB3270_PF_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), LIB3270_TYPE_PF_ACTION, Lib3270PfAction))
  41 + #define LIB3270_IS_PF_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), LIB3270_TYPE_PF_ACTION))
  42 +
  43 + typedef struct _Lib3270PfActionClass {
  44 + V3270ActionClass parent_class;
  45 +
  46 + } Lib3270PfActionClass;
  47 +
  48 + typedef struct _Lib3270PfAction {
  49 + V3270Action parent;
  50 + } Lib3270PfAction;
  51 +
  52 + static void Lib3270PfAction_class_init(Lib3270PfActionClass *klass);
  53 + static void Lib3270PfAction_init(Lib3270PfAction *action);
  54 +
  55 + G_DEFINE_TYPE(Lib3270PfAction, Lib3270PfAction, V3270_TYPE_ACTION);
  56 +
  57 + static void activate(GAction *action, GVariant *parameter, GtkWidget *terminal) {
  58 +
  59 + if(action && terminal && parameter) {
  60 +
  61 + H3270 * hSession = v3270_get_session(terminal);
  62 +
  63 + if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_INT32)) {
  64 +
  65 + lib3270_pfkey(hSession,(int) g_variant_get_int32(parameter));
  66 +
  67 + } else if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_UINT32)) {
  68 +
  69 + lib3270_pfkey(hSession,(int) g_variant_get_uint32(parameter));
  70 +
  71 + } else if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_INT16)) {
  72 +
  73 + lib3270_pfkey(hSession,(int) g_variant_get_int16(parameter));
  74 +
  75 + } else if(g_variant_is_of_type(parameter, G_VARIANT_TYPE_UINT16)) {
  76 +
  77 + lib3270_pfkey(hSession,(int) g_variant_get_uint16(parameter));
  78 +
  79 + }
  80 +
  81 + }
  82 +
  83 + }
  84 +
  85 + void Lib3270PfAction_class_init(Lib3270PfActionClass *klass) {
  86 + klass->parent_class.type.parameter = G_VARIANT_TYPE_UINT32;
  87 + }
  88 +
  89 + void Lib3270PfAction_init(Lib3270PfAction *action) {
  90 +
  91 + static const LIB3270_PROPERTY info = {
  92 + .name = "pfkey",
  93 + .group = LIB3270_ACTION_GROUP_ONLINE
  94 + };
  95 +
  96 + action->parent.activate = activate;
  97 + action->parent.info = &info;
  98 +
  99 + }
  100 +
  101 + GAction * v3270_pfkey_action_new(void) {
  102 + return G_ACTION(g_object_new(LIB3270_TYPE_PF_ACTION, NULL));
  103 + }
  104 +
... ...
v3270.cbp
... ... @@ -236,6 +236,12 @@
236 236 <Unit filename="src/terminal/actions/lib3270.c">
237 237 <Option compilerVar="CC" />
238 238 </Unit>
  239 + <Unit filename="src/terminal/actions/pakey.c">
  240 + <Option compilerVar="CC" />
  241 + </Unit>
  242 + <Unit filename="src/terminal/actions/pfkey.c">
  243 + <Option compilerVar="CC" />
  244 + </Unit>
239 245 <Unit filename="src/terminal/actions/print.c">
240 246 <Option compilerVar="CC" />
241 247 </Unit>
... ...