diff --git a/configure.ac b/configure.ac
index db3d3d1..e8b118c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -483,7 +483,6 @@ dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES(src/pw3270/Makefile)
AC_CONFIG_FILES(src/pw3270/uiparser/Makefile)
-AC_CONFIG_FILES(src/pw3270/common/Makefile)
AC_CONFIG_FILES(src/libpw3270cpp/Makefile)
diff --git a/pw3270.cbp b/pw3270.cbp
index da82a1e..f745cb2 100644
--- a/pw3270.cbp
+++ b/pw3270.cbp
@@ -134,6 +134,7 @@
+
@@ -153,6 +154,9 @@
+
+
+
@@ -235,6 +239,9 @@
+
+
+
diff --git a/src/pw3270/Makefile.in b/src/pw3270/Makefile.in
index 250f963..d25e60f 100644
--- a/src/pw3270/Makefile.in
+++ b/src/pw3270/Makefile.in
@@ -45,8 +45,7 @@ APP_SOURCES=\
$(wildcard @OSNAME@/*.rc)
MODULES=\
- uiparser \
- common
+ uiparser
#---[ Configuration values ]-------------------------------------------------------------
diff --git a/src/pw3270/common.h b/src/pw3270/common.h
new file mode 100644
index 0000000..6d90af4
--- /dev/null
+++ b/src/pw3270/common.h
@@ -0,0 +1,89 @@
+/*
+ * "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 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
+
+ #include
+
+#ifdef _WIN32
+ #include
+#endif // _WIN32
+
+
+ #define COMMON_H_INCLUDED 1
+
+ #include
+ #include
+
+ #ifndef GETTEXT_PACKAGE
+ #define GETTEXT_PACKAGE PACKAGE_NAME
+ #endif
+
+ #include
+ #include
+ #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
+ LIB3270_EXPORT void pw3270_session_config_load(const gchar *filename);
+ LIB3270_EXPORT void pw3270_session_config_free(void);
+ LIB3270_EXPORT GKeyFile * pw3270_session_config_get(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, ...);
+ gchar * filename_from_va(const gchar *first_element, va_list args);
+
+ void save_window_state_to_config(const gchar *group, const gchar *key, GdkWindowState CurrentState);
+ void save_window_size_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd);
+
+ void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd);
+
+ #ifdef ENABLE_WINDOWS_REGISTRY
+ gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired);
+ HKEY get_application_registry(REGSAM samDesired);
+ void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data);
+ void registry_set_double(HKEY hKey, const gchar *key, gdouble value);
+ gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value);
+ #endif // ENABLE_WINDOWS_REGISTRY
+
+
+#endif
diff --git a/src/pw3270/common/Makefile.in b/src/pw3270/common/Makefile.in
deleted file mode 100644
index dd87ddf..0000000
--- a/src/pw3270/common/Makefile.in
+++ /dev/null
@@ -1,174 +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
-#
-# Contatos:
-#
-# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
-# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
-#
-
-MODULE_NAME=common
-
-SOURCES=config.c
-
-#---[ Configuration values ]-------------------------------------------------------------
-
-PACKAGE_NAME=@PACKAGE_NAME@
-PACKAGE_VERSION=@PACKAGE_VERSION@
-PACKAGE_TARNAME=@PACKAGE_TARNAME@
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-sbindir=@sbindir@
-libdir=@libdir@
-datarootdir=@datarootdir@
-
-BASEDIR=@BASEDIR@
-SRCDIR=$(BASEDIR)/.src/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/src/pw3270/$(MODULE_NAME)
-POTDIR=$(BASEDIR)/.pot/$(PACKAGE_TARNAME)/$(MODULE_NAME)
-
-OBJDIR=$(BASEDIR)/.obj/application/common
-OBJDBG=$(OBJDIR)/Debug
-OBJRLS=$(OBJDIR)/Release
-
-MKDIR=@MKDIR_P@
-CC=@CC@
-LD=@CC@
-AR=@AR@
-XGETTEXT=@XGETTEXT@
-MSGCAT=@MSGCAT@
-INSTALL=@INSTALL@
-INSTALL_DATA=@INSTALL_DATA@
-
-CFLAGS= \
- @CFLAGS@ \
- @LIB3270_CFLAGS@ \
- @LIBV3270_CFLAGS@ \
- @PW3270_CFLAGS@ \
- -Wno-deprecated-declarations \
- -DDATAROOTDIR=\"$(datarootdir)\" \
- @GTK_CFLAGS@
-
-LIBS= \
- @LIBS@ \
- @GTK_LIBS@ \
- @LIB3270_LIBS@ \
- @LIBV3270_LIBS@
-
-#---[ Rules ]----------------------------------------------------------------------------
-
-DEPENDS= \
- ../../include/*.h
-
-$(OBJDBG)/%.o: \
- %.c \
- $(DEPENDS)
-
- @echo $< ...
- @$(MKDIR) `dirname $@`
- @$(CC) $(CFLAGS) \
- @DBG_CFLAGS@ \
- -DBUILD_DATE=`date +"0x%Y%m%d"`\
- -o $@ -c $<
-
-$(OBJRLS)/%.o: \
- %.c \
- $(DEPENDS)
-
- @echo $< ...
- @$(MKDIR) `dirname $@`
- @$(CC) $(CFLAGS) \
- @RLS_CFLAGS@ \
- -DBUILD_DATE=`date +"0x%Y%m%d"` \
- -o $@ -c $<
-
-$(POTDIR)/%.pot: %.c
-
- @echo $(notdir $@) ...
- @$(MKDIR) `dirname $@`
- @$(XGETTEXT) \
- --default-domain=$(PACKAGE) \
- --language=C \
- --keyword=_ \
- --keyword=N_ \
- --keyword=MSG_:2 \
- --output=$@ \
- $<
-
- @touch $@
-
-#---[ Release Targets ]------------------------------------------------------------------
-
-Release: \
- $(BASEDIR)/.obj/Release/$(MODULE_NAME).a
-
-$(BASEDIR)/.obj/Release/$(MODULE_NAME).a: \
- $(foreach SRC, $(basename $(SOURCES)), $(OBJRLS)/$(SRC).o)
-
- @echo $@ ...
- @$(MKDIR) `dirname $@`
- @$(AR) rcs $@ $^
-
-pot: \
- $(BASEDIR)/.pot/$(PACKAGE_TARNAME)/$(MODULE_NAME).pot
-
-$(BASEDIR)/.pot/$(PACKAGE_TARNAME)/$(MODULE_NAME).pot: \
- $(foreach SRC, $(basename $(SOURCES)), $(POTDIR)/$(SRC).pot)
-
- @rm -f $@
- @mkdir -p `dirname $@`
- @$(MSGCAT) --sort-output $^ > $@
-
-$(SRCDIR): \
- clean
-
- @$(MKDIR) $@
- @$(INSTALL_DATA) *.c *.h *.in $@
-
-#---[ Debug Targets ]--------------------------------------------------------------------
-
-Debug: \
- $(BASEDIR)/.obj/Debug/$(MODULE_NAME).a
-
-$(BASEDIR)/.obj/Debug/$(MODULE_NAME).a: \
- $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o)
-
- @echo $@ ...
- @$(MKDIR) `dirname $@`
- @$(AR) rcs $@ $^
-
-#---[ Clean Targets]---------------------------------------------------------------------
-
-cleanDebug:
-
- @rm -fr $(BASEDIR)/.obj/Debug/$(MODULE_NAME).a \
- $(OBJDBG)
-
-cleanRelease:
-
- @rm -fr $(BASEDIR)/.obj/Release/$(MODULE_NAME).a \
- $(OBJRLS)
-
-clean: \
- cleanDebug \
- cleanRelease
-
-
diff --git a/src/pw3270/common/common.h b/src/pw3270/common/common.h
deleted file mode 100644
index 74ba23c..0000000
--- a/src/pw3270/common/common.h
+++ /dev/null
@@ -1,89 +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 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
-
- #include
-
-#ifdef _WIN32
- #include
-#endif // _WIN32
-
-
- #define COMMON_H_INCLUDED 1
-
- #include
- #include
-
- #ifndef GETTEXT_PACKAGE
- #define GETTEXT_PACKAGE PACKAGE_NAME
- #endif
-
- #include
- #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, ...);
- gchar * filename_from_va(const gchar *first_element, va_list args);
-
- void save_window_state_to_config(const gchar *group, const gchar *key, GdkWindowState CurrentState);
- void save_window_size_to_config(const gchar *group, const gchar *key, GtkWidget *hwnd);
-
- void restore_window_from_config(const gchar *group, const gchar *key, GtkWidget *hwnd);
-
- #ifdef ENABLE_WINDOWS_REGISTRY
- gboolean get_registry_handle(const gchar *group, HKEY *hKey, REGSAM samDesired);
- HKEY get_application_registry(REGSAM samDesired);
- void registry_foreach(HKEY parent, const gchar *name,void (*cbk)(const gchar *key, const gchar *val, gpointer *user_data), gpointer *user_data);
- void registry_set_double(HKEY hKey, const gchar *key, gdouble value);
- gboolean registry_get_double(HKEY hKey, const gchar *key, gdouble *value);
- #else
- GKeyFile * get_application_keyfile(void);
- #endif // ENABLE_WINDOWS_REGISTRY
-
-
-#endif
diff --git a/src/pw3270/common/config.c b/src/pw3270/common/config.c
deleted file mode 100644
index 749397d..0000000
--- a/src/pw3270/common/config.c
+++ /dev/null
@@ -1,938 +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 config.c e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
- * licinio@bb.com.br (Licínio Luis Branco)
- * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
- *
- */
-
-#ifdef _WIN32
- #include
-#endif // _WIN32
-
- #include "../pw3270/private.h"
-
- #include "common.h"
- #include
- #include
-
-#ifdef _WIN32
-
- #include
-
- #ifndef KEY_WOW64_64KEY
- #define KEY_WOW64_64KEY 0x0100
- #endif // KEY_WOW64_64KEY
-
- #ifndef KEY_WOW64_32KEY
- #define KEY_WOW64_32KEY 0x0200
- #endif // KEY_WOW64_64KEY
-
-#endif // _WIN32
-
-/*--[ Globals ]--------------------------------------------------------------------------------------*/
-
-#ifdef ENABLE_WINDOWS_REGISTRY
-
- static const gchar * registry_path = "SOFTWARE";
-
-#else
-
- static GKeyFile * program_config = NULL;
-
-#endif // ENABLE_WINDOWS_REGISTRY
-
-/*--[ Implement ]------------------------------------------------------------------------------------*/
-
-#ifdef ENABLE_WINDOWS_REGISTRY
-
- enum REG_KEY
- {
- REG_KEY_USER,
- REG_KEY_SYSTEM,
- REG_KEY_INEXISTENT
- };
-
- static enum REG_KEY registry_query(const gchar *group, const gchar *key, HKEY *hKey)
- {
- static HKEY predefined[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
- gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group);
- int f;
-
- for(f=0;fmessage);
- g_error_free(error);
- }
-
- }
-
- g_key_file_free(program_config);
- program_config = NULL;
-
-#endif // ENABLE_WINDOWS_REGISTRY
-}
-
-gchar * build_data_filename(const gchar *first_element, ...)
-{
- va_list args;
- gchar *path;
-
- va_start(args, first_element);
- path = filename_from_va(first_element,args);
- va_end(args);
- return path;
-}
-
-gchar * filename_from_va(const gchar *first_element, va_list args)
-{
- const gchar * appname[] = { g_get_application_name(), PACKAGE_NAME };
- size_t p,f;
-
- // Make base path
- const gchar *element;
- GString * result = g_string_new("");
- for(element = first_element;element;element = va_arg(args, gchar *))
- {
- g_string_append_c(result,G_DIR_SEPARATOR);
- g_string_append(result,element);
- }
-
- g_autofree gchar * suffix = g_string_free(result, FALSE);
-
-#if defined( ENABLE_WINDOWS_REGISTRY )
- for(p=0;p
+ *
+ * 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 config.c e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ * licinio@bb.com.br (Licínio Luis Branco)
+ * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
+ *
+ */
+
+#ifdef _WIN32
+ #include
+#endif // _WIN32
+
+ #include "../pw3270/private.h"
+
+ #include "../common.h"
+ #include
+ #include
+
+/*--[ Globals ]--------------------------------------------------------------------------------------*/
+
+ static GKeyFile * keyfile = NULL;
+ static gchar * keyfilename = NULL;
+
+/*--[ Implement ]------------------------------------------------------------------------------------*/
+
+ static gchar * search_for_ini(void)
+ {
+ static const gchar * (*dir[])(void) =
+ {
+ g_get_user_config_dir,
+ g_get_user_data_dir,
+ g_get_home_dir,
+ };
+
+ size_t f;
+ g_autofree gchar * name = g_strconcat(g_get_application_name(),".conf",NULL);
+
+ //
+ // First search the user data
+ //
+
+ for(f=0;fmessage);
+ g_error_free(error);
+ }
+
+ }
+
+ g_key_file_free(keyfile);
+ keyfile = NULL;
+
+}
+
+gchar * build_data_filename(const gchar *first_element, ...)
+{
+ va_list args;
+ gchar *path;
+
+ va_start(args, first_element);
+ path = filename_from_va(first_element,args);
+ va_end(args);
+ return path;
+}
+
+gchar * filename_from_va(const gchar *first_element, va_list args)
+{
+ const gchar * appname[] = { g_get_application_name(), PACKAGE_NAME };
+ size_t p,f;
+
+ // Make base path
+ const gchar *element;
+ GString * result = g_string_new("");
+ for(element = first_element;element;element = va_arg(args, gchar *))
+ {
+ g_string_append_c(result,G_DIR_SEPARATOR);
+ g_string_append(result,element);
+ }
+
+ g_autofree gchar * suffix = g_string_free(result, FALSE);
+
+ // Check system data dirs
+ const gchar * const * system_data_dirs = g_get_system_data_dirs();
+ for(p=0;p
#include
+#include "common.h"
#define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME)
@@ -475,6 +476,21 @@ int main(int argc, char *argv[])
if(!session_name)
session_name = PACKAGE_NAME;
+ // Load session settings.
+ {
+ const gchar * session_settings_file_name = NULL;
+ size_t ix;
+
+ for(ix = 1; ix < argc; ix++)
+ {
+ if(argv[ix][0] != '-' && g_file_test(argv[ix],G_FILE_TEST_IS_REGULAR))
+ pw3270_session_config_load(argv[ix]);
+ }
+
+ pw3270_session_config_get();
+
+ }
+
rc = initialize();
if(!rc)
@@ -556,6 +572,7 @@ int main(int argc, char *argv[])
pw3270_stop_plugins(toplevel);
pw3270_unload_plugins();
+ pw3270_session_config_free();
}
diff --git a/src/pw3270/private.h b/src/pw3270/private.h
index 6c33ca4..5932c2b 100644
--- a/src/pw3270/private.h
+++ b/src/pw3270/private.h
@@ -68,7 +68,7 @@
/*--[ Global prototipes ]----------------------------------------------------------------------------*/
- #include "common/common.h"
+ #include "common.h"
G_GNUC_INTERNAL GtkWidget * create_main_window(const gchar *uri);
G_GNUC_INTERNAL void setup_font_list(GtkWidget *widget, GtkWidget *obj);
diff --git a/src/pw3270/tools.c b/src/pw3270/tools.c
index a281bbe..029e81d 100644
--- a/src/pw3270/tools.c
+++ b/src/pw3270/tools.c
@@ -75,23 +75,9 @@ int libpw3270_loaded(void)
int libpw3270_unloaded(void)
{
trace("%s",__FUNCTION__);
- configuration_deinit();
return 0;
}
-/*
-LIB3270_EXPORT gchar * pw3270_build_filename(GtkWidget *widget, const gchar *first_element, ...)
-{
- va_list args;
- gchar *path;
-
- va_start(args, first_element);
- path = filename_from_va(first_element,args);
- va_end(args);
- return path;
-}
-*/
-
LIB3270_EXPORT void pw3270_save_window_size(GtkWidget *widget, const gchar *name)
{
trace("%s",__FUNCTION__);
diff --git a/src/pw3270/uiparser/private.h b/src/pw3270/uiparser/private.h
index ab78839..453cbbc 100644
--- a/src/pw3270/uiparser/private.h
+++ b/src/pw3270/uiparser/private.h
@@ -31,7 +31,7 @@
#include
#include
- #include "../common/common.h"
+ #include "../common.h"
#include "parser.h"
#define ERROR_DOMAIN g_quark_from_static_string("uiparser")
diff --git a/src/pw3270/uiparser/testprogram.c b/src/pw3270/uiparser/testprogram.c
index 392f811..f1eefa4 100644
--- a/src/pw3270/uiparser/testprogram.c
+++ b/src/pw3270/uiparser/testprogram.c
@@ -1,6 +1,6 @@
#include
-#include "../common/common.h"
+#include "../common.h"
#include "parser.h"
/*--[ Globals ]--------------------------------------------------------------------------------------*/
@@ -90,7 +90,6 @@ int main (int argc, char *argv[])
GtkWidget * hbox;
gtk_init(&argc, &argv);
- configuration_init();
hbox = gtk_hbox_new(FALSE,5);
vbox = gtk_vbox_new(FALSE,5);
diff --git a/src/pw3270/window.c b/src/pw3270/window.c
index 16d27de..385e9c1 100644
--- a/src/pw3270/window.c
+++ b/src/pw3270/window.c
@@ -40,7 +40,7 @@
#include
#include
#include
-#include "common/common.h"
+#include "common.h"
/*--[ Widget definition ]----------------------------------------------------------------------------*/
@@ -163,8 +163,6 @@ static GtkWidget * trace_window = NULL;
}
#endif // GTK3
- configuration_init();
-
}
static void trace_on_file(G_GNUC_UNUSED H3270 *hSession, void * userdata, const char *fmt, va_list args)
@@ -420,7 +418,7 @@ static GtkWidget * trace_window = NULL;
#else
- v3270_to_key_file(widget, get_application_keyfile(), "terminal");
+ v3270_to_key_file(widget, pw3270_session_config_get(), "terminal");
#endif // _WIN32
diff --git a/src/pw3270/windows/config.c b/src/pw3270/windows/config.c
new file mode 100644
index 0000000..cf7f30a
--- /dev/null
+++ b/src/pw3270/windows/config.c
@@ -0,0 +1,939 @@
+/*
+ * "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 config.c e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
+ * licinio@bb.com.br (Licínio Luis Branco)
+ * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
+ *
+ */
+
+#ifdef _WIN32
+ #include
+#endif // _WIN32
+
+ #include "../pw3270/private.h"
+
+ #include "common.h"
+ #include
+ #include
+
+#ifdef _WIN32
+
+ #include
+
+ #ifndef KEY_WOW64_64KEY
+ #define KEY_WOW64_64KEY 0x0100
+ #endif // KEY_WOW64_64KEY
+
+ #ifndef KEY_WOW64_32KEY
+ #define KEY_WOW64_32KEY 0x0200
+ #endif // KEY_WOW64_64KEY
+
+#endif // _WIN32
+
+/*--[ Globals ]--------------------------------------------------------------------------------------*/
+
+#ifdef ENABLE_WINDOWS_REGISTRY
+
+ static const gchar * registry_path = "SOFTWARE";
+
+#else
+
+ static GKeyFile * program_config = NULL;
+
+#endif // ENABLE_WINDOWS_REGISTRY
+
+/*--[ Implement ]------------------------------------------------------------------------------------*/
+
+#ifdef ENABLE_WINDOWS_REGISTRY
+
+ enum REG_KEY
+ {
+ REG_KEY_USER,
+ REG_KEY_SYSTEM,
+ REG_KEY_INEXISTENT
+ };
+
+ static enum REG_KEY registry_query(const gchar *group, const gchar *key, HKEY *hKey)
+ {
+ static HKEY predefined[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
+ gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,g_get_application_name(),group);
+ int f;
+
+ for(f=0;fmessage);
+ g_error_free(error);
+ }
+
+ }
+
+ g_key_file_free(program_config);
+ program_config = NULL;
+
+#endif // ENABLE_WINDOWS_REGISTRY
+}
+
+gchar * build_data_filename(const gchar *first_element, ...)
+{
+ va_list args;
+ gchar *path;
+
+ va_start(args, first_element);
+ path = filename_from_va(first_element,args);
+ va_end(args);
+ return path;
+}
+
+gchar * filename_from_va(const gchar *first_element, va_list args)
+{
+ const gchar * appname[] = { g_get_application_name(), PACKAGE_NAME };
+ size_t p,f;
+
+ // Make base path
+ const gchar *element;
+ GString * result = g_string_new("");
+ for(element = first_element;element;element = va_arg(args, gchar *))
+ {
+ g_string_append_c(result,G_DIR_SEPARATOR);
+ g_string_append(result,element);
+ }
+
+ g_autofree gchar * suffix = g_string_free(result, FALSE);
+
+#if defined( ENABLE_WINDOWS_REGISTRY )
+ for(p=0;p