Commit 60f6a213cb8a32a869b42052025985c5154912c6
1 parent
4e303018
Exists in
master
and in
5 other branches
Tornando o parser de interface mais generico
Showing
20 changed files
with
93 additions
and
75 deletions
Show diff stats
configure.ac
src/gtk/common/common.h
| ... | ... | @@ -1,43 +0,0 @@ |
| 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., 59 Temple | |
| 19 | - * Place, Suite 330, Boston, MA, 02111-1307, USA | |
| 20 | - * | |
| 21 | - * Este programa está nomeado como common.h 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 | - // Configuration | |
| 31 | - void configuration_init(void); | |
| 32 | - void configuration_deinit(void); | |
| 33 | - | |
| 34 | - gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); | |
| 35 | - gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); | |
| 36 | - gint get_integer_from_config(const gchar *group, const gchar *key, gint def); | |
| 37 | - | |
| 38 | - void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); | |
| 39 | - void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); | |
| 40 | - void set_integer_to_config(const gchar *group, const gchar *key, gint val); | |
| 41 | - | |
| 42 | - gchar * build_data_filename(const gchar *first_element, ...); | |
| 43 | - |
| ... | ... | @@ -0,0 +1,71 @@ |
| 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., 59 Temple | |
| 19 | + * Place, Suite 330, Boston, MA, 02111-1307, USA | |
| 20 | + * | |
| 21 | + * Este programa está nomeado como common.h 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 | +#ifndef COMMON_H_INCLUDED | |
| 31 | + | |
| 32 | + #define COMMON_H_INCLUDED 1 | |
| 33 | + | |
| 34 | + // "PW" Standards | |
| 35 | + #include <gtk/gtk.h> | |
| 36 | + #include <errno.h> | |
| 37 | + | |
| 38 | + #ifndef PACKAGE_NAME | |
| 39 | + #define PACKAGE_NAME "@PACKAGE_NAME@" | |
| 40 | + #endif | |
| 41 | + | |
| 42 | + #define ENABLE_NLS | |
| 43 | + | |
| 44 | + #ifndef GETTEXT_PACKAGE | |
| 45 | + #define GETTEXT_PACKAGE PACKAGE_NAME | |
| 46 | + #endif | |
| 47 | + | |
| 48 | + #include <libintl.h> | |
| 49 | + #include <glib/gi18n.h> | |
| 50 | + | |
| 51 | + #if defined( DEBUG ) | |
| 52 | + #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr); | |
| 53 | + #else | |
| 54 | + #define trace(x, ...) /* */ | |
| 55 | + #endif | |
| 56 | + | |
| 57 | + // Configuration | |
| 58 | + void configuration_init(void); | |
| 59 | + void configuration_deinit(void); | |
| 60 | + | |
| 61 | + gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); | |
| 62 | + gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); | |
| 63 | + gint get_integer_from_config(const gchar *group, const gchar *key, gint def); | |
| 64 | + | |
| 65 | + void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); | |
| 66 | + void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); | |
| 67 | + void set_integer_to_config(const gchar *group, const gchar *key, gint val); | |
| 68 | + | |
| 69 | + gchar * build_data_filename(const gchar *first_element, ...); | |
| 70 | + | |
| 71 | +#endif | ... | ... |
src/gtk/common/config.c
src/gtk/uiparser/accelerator.c
src/gtk/uiparser/action.c
src/gtk/uiparser/menu.c
src/gtk/uiparser/menubar.c
src/gtk/uiparser/menuitem.c
src/gtk/uiparser/parsefile.c
src/gtk/uiparser/parser.c
| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | - #include "../globals.h" | |
| 33 | 32 | #include "private.h" |
| 34 | 33 | |
| 35 | 34 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| ... | ... | @@ -207,7 +206,7 @@ void parser_build(struct parser *p, GtkWidget *widget) |
| 207 | 206 | |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | -GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, GtkWidget *widget, const SETUP_ITEM *setup) | |
| 209 | +GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const SETUP_ITEM *setup) | |
| 211 | 210 | { |
| 212 | 211 | struct parser p; |
| 213 | 212 | GDir * dir; | ... | ... |
src/gtk/uiparser/parser.h
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | void (*setup)(GtkWidget *widget, GtkWidget *obj); |
| 36 | 36 | } SETUP_ITEM; |
| 37 | 37 | |
| 38 | - GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, GtkWidget *widget, const SETUP_ITEM *itn); | |
| 38 | + GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const SETUP_ITEM *itn); | |
| 39 | 39 | void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); |
| 40 | 40 | void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); |
| 41 | 41 | void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); | ... | ... |
src/gtk/uiparser/popup.c
src/gtk/uiparser/private.h
| ... | ... | @@ -30,14 +30,7 @@ |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | #include <lib3270/config.h> |
| 33 | - | |
| 34 | - #include <gtk/gtk.h> | |
| 35 | - | |
| 36 | - #define ENABLE_NLS | |
| 37 | - #define GETTEXT_PACKAGE PACKAGE_NAME | |
| 38 | - | |
| 39 | - #include <libintl.h> | |
| 40 | - #include <glib/gi18n.h> | |
| 33 | + #include "../common/common.h" | |
| 41 | 34 | |
| 42 | 35 | #define ERROR_DOMAIN g_quark_from_static_string("uiparser") |
| 43 | 36 | ... | ... |
src/gtk/uiparser/script.c
src/gtk/uiparser/separator.c
src/gtk/uiparser/testprogram.c
| 1 | 1 | |
| 2 | -#include "../globals.h" | |
| 2 | +#include <gtk/gtk.h> | |
| 3 | +#include "../common/common.h" | |
| 3 | 4 | #include "parser.h" |
| 4 | 5 | |
| 5 | 6 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| ... | ... | @@ -45,6 +46,11 @@ int main (int argc, char *argv[]) |
| 45 | 46 | "filetransfer", |
| 46 | 47 | "paste", |
| 47 | 48 | NULL }; |
| 49 | + | |
| 50 | + static const gchar *popupname[] = { "default", | |
| 51 | + "selection", | |
| 52 | + "offline", | |
| 53 | + NULL }; | |
| 48 | 54 | GtkWidget * window; |
| 49 | 55 | gchar * path; |
| 50 | 56 | |
| ... | ... | @@ -52,7 +58,7 @@ int main (int argc, char *argv[]) |
| 52 | 58 | configuration_init(); |
| 53 | 59 | |
| 54 | 60 | path = build_data_filename("ui",NULL); |
| 55 | - window = ui_parse_xml_folder(path,groupname,NULL,NULL); | |
| 61 | + window = ui_parse_xml_folder(path,groupname,popupname,NULL,NULL); | |
| 56 | 62 | g_free(path); |
| 57 | 63 | |
| 58 | 64 | if(window) | ... | ... |
src/gtk/uiparser/toolbar.c
src/gtk/uiparser/toolitem.c
src/gtk/uiparser/uiparser.cbp
| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | <Option compiler="gcc" /> |
| 8 | 8 | <Build> |
| 9 | 9 | <Target title="Debug"> |
| 10 | - <Option output=".bin\Debug\uiparser" prefix_auto="1" extension_auto="1" /> | |
| 11 | - <Option object_output=".obj\Debug\" /> | |
| 10 | + <Option output=".bin/Debug/uiparser" prefix_auto="1" extension_auto="1" /> | |
| 11 | + <Option object_output=".obj/Debug/" /> | |
| 12 | 12 | <Option type="1" /> |
| 13 | 13 | <Option compiler="gcc" /> |
| 14 | 14 | <Compiler> |
| ... | ... | @@ -17,8 +17,8 @@ |
| 17 | 17 | </Compiler> |
| 18 | 18 | </Target> |
| 19 | 19 | <Target title="Release"> |
| 20 | - <Option output=".bin\Release\uiparser" prefix_auto="1" extension_auto="1" /> | |
| 21 | - <Option object_output=".obj\Release\" /> | |
| 20 | + <Option output=".bin/Release/uiparser" prefix_auto="1" extension_auto="1" /> | |
| 21 | + <Option object_output=".obj/Release/" /> | |
| 22 | 22 | <Option type="0" /> |
| 23 | 23 | <Option compiler="gcc" /> |
| 24 | 24 | <Compiler> |
| ... | ... | @@ -32,15 +32,16 @@ |
| 32 | 32 | <Compiler> |
| 33 | 33 | <Add option="-Wall" /> |
| 34 | 34 | <Add option="`pkg-config gtk+-2.0 lib3270 --cflags`" /> |
| 35 | - <Add directory="..\..\include" /> | |
| 35 | + <Add directory="../../include" /> | |
| 36 | 36 | </Compiler> |
| 37 | 37 | <Linker> |
| 38 | 38 | <Add option="`pkg-config gtk+-2.0 lib3270 --libs`" /> |
| 39 | 39 | </Linker> |
| 40 | - <Unit filename="..\common\config.c"> | |
| 40 | + <Unit filename="../common/common.h" /> | |
| 41 | + <Unit filename="../common/common.h.in" /> | |
| 42 | + <Unit filename="../common/config.c"> | |
| 41 | 43 | <Option compilerVar="CC" /> |
| 42 | 44 | </Unit> |
| 43 | - <Unit filename="..\globals.h" /> | |
| 44 | 45 | <Unit filename="accelerator.c"> |
| 45 | 46 | <Option compilerVar="CC" /> |
| 46 | 47 | </Unit> | ... | ... |