diff --git a/src/actions/actions.cbp b/src/actions/actions.cbp index c130b56..eaf60e5 100644 --- a/src/actions/actions.cbp +++ b/src/actions/actions.cbp @@ -43,7 +43,10 @@ - + + + diff --git a/src/actions/lib3270.c b/src/actions/lib3270.c deleted file mode 100644 index 416549f..0000000 --- a/src/actions/lib3270.c +++ /dev/null @@ -1,110 +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) - * - */ - - /** - * @brief Implement GAction "wrapper" for lib3270's actions. - * - */ - - #include "private.h" - #include - - #define PW3270_TYPE_LIB3270_ACTION (Lib3270Action_get_type()) - #define PW3270_LIB3270_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), PW3270_TYPE_LIB3270_ACTION, Lib3270Action)) - #define PW3270_IS_LIB3270_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), PW3270_TYPE_LIB3270_ACTION)) - - typedef struct _Lib3270ActionClass { - pw3270ActionClass parent_class; - - } Lib3270ActionClass; - - typedef struct _Lib3270Action { - pw3270Action parent; - - const LIB3270_ACTION * definition; - - } Lib3270Action; - - static void Lib3270Action_class_init(Lib3270ActionClass *klass); - static void Lib3270Action_init(Lib3270Action *action); - - G_DEFINE_TYPE(Lib3270Action, Lib3270Action, PW3270_TYPE_ACTION); - - static gboolean action_enabled(GAction *action, GtkWidget *window) { - - H3270 * hSession = pw3270_window_get_session_handle(window); - - if(hSession) - return PW3270_LIB3270_ACTION(action)->definition->activatable(hSession) > 0 ? TRUE : FALSE; - - return FALSE; - } - - static void action_activate(GAction *action, GtkWidget *window) { - - H3270 * hSession = pw3270_window_get_session_handle(window); - - debug("Activating action %s on hSession %p", pw3270_action_get_name(action), hSession); - - if(hSession) - PW3270_LIB3270_ACTION(action)->definition->activate(hSession); - else - g_message("Action \"%s\" requires a lib3270 session", pw3270_action_get_name(action)); - - } - - void Lib3270Action_class_init(Lib3270ActionClass *klass) { - - pw3270ActionClass * action = PW3270_ACTION_CLASS(klass); - - action->get_enabled = action_enabled; - action->activate = action_activate; - - } - - void Lib3270Action_init(Lib3270Action *action) { - } - - GAction * pw3270_action_new_from_lib3270(const LIB3270_ACTION * definition, GtkWidget *window) { - - Lib3270Action * action = (Lib3270Action *) g_object_new(PW3270_TYPE_LIB3270_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); - } - - diff --git a/src/actions/lib3270/action.c b/src/actions/lib3270/action.c new file mode 100644 index 0000000..124d929 --- /dev/null +++ b/src/actions/lib3270/action.c @@ -0,0 +1,110 @@ +/* + * "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 actions. + * + */ + + #include "../private.h" + #include + + #define PW3270_TYPE_LIB3270_ACTION (Lib3270Action_get_type()) + #define PW3270_LIB3270_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), PW3270_TYPE_LIB3270_ACTION, Lib3270Action)) + #define PW3270_IS_LIB3270_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), PW3270_TYPE_LIB3270_ACTION)) + + typedef struct _Lib3270ActionClass { + pw3270ActionClass parent_class; + + } Lib3270ActionClass; + + typedef struct _Lib3270Action { + pw3270Action parent; + + const LIB3270_ACTION * definition; + + } Lib3270Action; + + static void Lib3270Action_class_init(Lib3270ActionClass *klass); + static void Lib3270Action_init(Lib3270Action *action); + + G_DEFINE_TYPE(Lib3270Action, Lib3270Action, PW3270_TYPE_ACTION); + + static gboolean action_enabled(GAction *action, GtkWidget *window) { + + H3270 * hSession = pw3270_window_get_session_handle(window); + + if(hSession) + return PW3270_LIB3270_ACTION(action)->definition->activatable(hSession) > 0 ? TRUE : FALSE; + + return FALSE; + } + + static void action_activate(GAction *action, GtkWidget *window) { + + H3270 * hSession = pw3270_window_get_session_handle(window); + + debug("Activating action %s on hSession %p", pw3270_action_get_name(action), hSession); + + if(hSession) + PW3270_LIB3270_ACTION(action)->definition->activate(hSession); + else + g_message("Action \"%s\" requires a lib3270 session", pw3270_action_get_name(action)); + + } + + void Lib3270Action_class_init(Lib3270ActionClass *klass) { + + pw3270ActionClass * action = PW3270_ACTION_CLASS(klass); + + action->get_enabled = action_enabled; + action->activate = action_activate; + + } + + void Lib3270Action_init(Lib3270Action *action) { + } + + GAction * pw3270_action_new_from_lib3270(const LIB3270_ACTION * definition, GtkWidget *window) { + + Lib3270Action * action = (Lib3270Action *) g_object_new(PW3270_TYPE_LIB3270_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); + } + + diff --git a/src/include/pw3270/actions.h b/src/include/pw3270/actions.h index 2a87de3..2b8791b 100644 --- a/src/include/pw3270/actions.h +++ b/src/include/pw3270/actions.h @@ -55,6 +55,7 @@ GType pw3270Action_get_type(void) G_GNUC_CONST; GAction * pw3270_action_new_from_lib3270(const LIB3270_ACTION * definition, GtkWidget *window); + GAction * pw3270_toggle_action_new_from_lib3270(const LIB3270_TOGGLE_ENTRY * definition, GtkWidget *window); const gchar * pw3270_action_get_name(GAction *action); void pw3270_action_set_name(GAction *action, const gchar *name); -- libgit2 0.21.2