diff --git a/configure.ac b/configure.ac index c1c8e78..579f252 100644 --- a/configure.ac +++ b/configure.ac @@ -206,6 +206,7 @@ AC_CONFIG_FILES([ src/lib3270/mkversion.sh src/gtk/Makefile src/gtk/uiparser/Makefile + src/gtk/common/common.h ]) diff --git a/src/gtk/common/common.h b/src/gtk/common/common.h deleted file mode 100644 index a9e62f3..0000000 --- a/src/gtk/common/common.h +++ /dev/null @@ -1,43 +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., 59 Temple - * Place, Suite 330, Boston, MA, 02111-1307, USA - * - * Este programa está nomeado como common.h e possui - linhas de código. - * - * Contatos: - * - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) - * - */ - - // Configuration - void configuration_init(void); - void configuration_deinit(void); - - gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); - gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); - gint get_integer_from_config(const gchar *group, const gchar *key, gint def); - - void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); - void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); - void set_integer_to_config(const gchar *group, const gchar *key, gint val); - - gchar * build_data_filename(const gchar *first_element, ...); - diff --git a/src/gtk/common/common.h.in b/src/gtk/common/common.h.in new file mode 100644 index 0000000..ddf8254 --- /dev/null +++ b/src/gtk/common/common.h.in @@ -0,0 +1,71 @@ +/* + * "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., 59 Temple + * Place, Suite 330, Boston, MA, 02111-1307, USA + * + * Este programa está nomeado como common.h e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +#ifndef COMMON_H_INCLUDED + + #define COMMON_H_INCLUDED 1 + + // "PW" Standards + #include + #include + + #ifndef PACKAGE_NAME + #define PACKAGE_NAME "@PACKAGE_NAME@" + #endif + + #define ENABLE_NLS + + #ifndef GETTEXT_PACKAGE + #define GETTEXT_PACKAGE PACKAGE_NAME + #endif + + #include + #include + + #if defined( DEBUG ) + #define trace(x, ...) fprintf(stderr,"%s(%d):\t" x "\n",__FILE__,__LINE__, __VA_ARGS__); fflush(stderr); + #else + #define trace(x, ...) /* */ + #endif + + // Configuration + void configuration_init(void); + void configuration_deinit(void); + + gchar * get_string_from_config(const gchar *group, const gchar *key, const gchar *def); + gboolean get_boolean_from_config(const gchar *group, const gchar *key, gboolean def); + gint get_integer_from_config(const gchar *group, const gchar *key, gint def); + + void set_string_to_config(const gchar *group, const gchar *key, const gchar *fmt, ...); + void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val); + void set_integer_to_config(const gchar *group, const gchar *key, gint val); + + gchar * build_data_filename(const gchar *first_element, ...); + +#endif diff --git a/src/gtk/common/config.c b/src/gtk/common/config.c index 3f133f6..087bae8 100644 --- a/src/gtk/common/config.c +++ b/src/gtk/common/config.c @@ -30,7 +30,8 @@ * */ - #include "../globals.h" + #include + #include "common.h" #include #include diff --git a/src/gtk/uiparser/accelerator.c b/src/gtk/uiparser/accelerator.c index 0cea0c7..438f89d 100644 --- a/src/gtk/uiparser/accelerator.c +++ b/src/gtk/uiparser/accelerator.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/action.c b/src/gtk/uiparser/action.c index f8392d4..b57c79f 100644 --- a/src/gtk/uiparser/action.c +++ b/src/gtk/uiparser/action.c @@ -30,7 +30,6 @@ */ #include - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/menu.c b/src/gtk/uiparser/menu.c index d357a10..b7792c1 100644 --- a/src/gtk/uiparser/menu.c +++ b/src/gtk/uiparser/menu.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/menubar.c b/src/gtk/uiparser/menubar.c index 487838b..51b9246 100644 --- a/src/gtk/uiparser/menubar.c +++ b/src/gtk/uiparser/menubar.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/menuitem.c b/src/gtk/uiparser/menuitem.c index 2a723f8..adf0123 100644 --- a/src/gtk/uiparser/menuitem.c +++ b/src/gtk/uiparser/menuitem.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/parsefile.c b/src/gtk/uiparser/parsefile.c index 0961dbd..8289d78 100644 --- a/src/gtk/uiparser/parsefile.c +++ b/src/gtk/uiparser/parsefile.c @@ -30,7 +30,6 @@ */ #include - #include "../globals.h" #include "private.h" /*--[ Globals ]--------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/parser.c b/src/gtk/uiparser/parser.c index 92b1a77..514d684 100644 --- a/src/gtk/uiparser/parser.c +++ b/src/gtk/uiparser/parser.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -207,7 +206,7 @@ void parser_build(struct parser *p, GtkWidget *widget) } -GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, GtkWidget *widget, const SETUP_ITEM *setup) +GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const SETUP_ITEM *setup) { struct parser p; GDir * dir; diff --git a/src/gtk/uiparser/parser.h b/src/gtk/uiparser/parser.h index 2c4b782..7cda1e9 100644 --- a/src/gtk/uiparser/parser.h +++ b/src/gtk/uiparser/parser.h @@ -35,7 +35,7 @@ void (*setup)(GtkWidget *widget, GtkWidget *obj); } SETUP_ITEM; - GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, GtkWidget *widget, const SETUP_ITEM *itn); + GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const SETUP_ITEM *itn); void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id); diff --git a/src/gtk/uiparser/popup.c b/src/gtk/uiparser/popup.c index e42c2a1..f588038 100644 --- a/src/gtk/uiparser/popup.c +++ b/src/gtk/uiparser/popup.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/private.h b/src/gtk/uiparser/private.h index eb631bf..b1dac5f 100644 --- a/src/gtk/uiparser/private.h +++ b/src/gtk/uiparser/private.h @@ -30,14 +30,7 @@ */ #include - - #include - - #define ENABLE_NLS - #define GETTEXT_PACKAGE PACKAGE_NAME - - #include - #include + #include "../common/common.h" #define ERROR_DOMAIN g_quark_from_static_string("uiparser") diff --git a/src/gtk/uiparser/script.c b/src/gtk/uiparser/script.c index aac4995..e2e2414 100644 --- a/src/gtk/uiparser/script.c +++ b/src/gtk/uiparser/script.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Parser struct ]--------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/separator.c b/src/gtk/uiparser/separator.c index c9d4b35..c4fbcb1 100644 --- a/src/gtk/uiparser/separator.c +++ b/src/gtk/uiparser/separator.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/testprogram.c b/src/gtk/uiparser/testprogram.c index 3817849..bbcaeda 100644 --- a/src/gtk/uiparser/testprogram.c +++ b/src/gtk/uiparser/testprogram.c @@ -1,5 +1,6 @@ -#include "../globals.h" +#include +#include "../common/common.h" #include "parser.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -45,6 +46,11 @@ int main (int argc, char *argv[]) "filetransfer", "paste", NULL }; + + static const gchar *popupname[] = { "default", + "selection", + "offline", + NULL }; GtkWidget * window; gchar * path; @@ -52,7 +58,7 @@ int main (int argc, char *argv[]) configuration_init(); path = build_data_filename("ui",NULL); - window = ui_parse_xml_folder(path,groupname,NULL,NULL); + window = ui_parse_xml_folder(path,groupname,popupname,NULL,NULL); g_free(path); if(window) diff --git a/src/gtk/uiparser/toolbar.c b/src/gtk/uiparser/toolbar.c index 5768948..efad951 100644 --- a/src/gtk/uiparser/toolbar.c +++ b/src/gtk/uiparser/toolbar.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/toolitem.c b/src/gtk/uiparser/toolitem.c index 6c82147..633563f 100644 --- a/src/gtk/uiparser/toolitem.c +++ b/src/gtk/uiparser/toolitem.c @@ -29,7 +29,6 @@ * */ - #include "../globals.h" #include "private.h" /*--[ Implement ]------------------------------------------------------------------------------------*/ diff --git a/src/gtk/uiparser/uiparser.cbp b/src/gtk/uiparser/uiparser.cbp index cbd2683..349bdb6 100644 --- a/src/gtk/uiparser/uiparser.cbp +++ b/src/gtk/uiparser/uiparser.cbp @@ -7,8 +7,8 @@