From ebebd49fe2d00f529fd7473e7ff2dcf38e5964a8 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 20 Feb 2019 16:14:07 -0300 Subject: [PATCH] Refactoring HLLAPI linux plugin. --- .gitignore | 1 + Makefile.in | 28 +++++++++++++++++++++++----- configure.ac | 19 +++++++++++++++++++ pw3270dbus.xml | 251 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/dbus3270/pw3270dbus.xml | 251 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- src/plugin/linux/gobject.c | 7 ++++--- src/plugin/linux/main.c | 10 +++++----- src/plugin/linux/misc.c | 2 +- 8 files changed, 304 insertions(+), 265 deletions(-) create mode 100644 pw3270dbus.xml delete mode 100644 src/dbus3270/pw3270dbus.xml diff --git a/.gitignore b/.gitignore index c4fe5e1..f8cab25 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ stamp-h1 *.layout .bin .obj +dbus-glue.h diff --git a/Makefile.in b/Makefile.in index 6b8adb5..eabe099 100644 --- a/Makefile.in +++ b/Makefile.in @@ -50,6 +50,7 @@ XGETTEXT=@XGETTEXT@ MSGCAT=@MSGCAT@ WINDRES=@WINDRES@ AR=@AR@ +DBUSBINDINGTOOL=@DBUSBINDINGTOOL@ #---[ Paths ]---------------------------------------------------------------------------- @@ -79,7 +80,8 @@ BINRLS=$(BINDIR)/Release #---[ Rules ]---------------------------------------------------------------------------- DEPENDS= \ - Makefile + Makefile \ + @DEPENDS@ CFLAGS= \ @CFLAGS@ \ @@ -89,17 +91,30 @@ CFLAGS= \ @LIB3270_CFLAGS@ \ @V3270_CFLAGS@ \ @GTK_CFLAGS@ \ - @GLIB_CFLAGS@ + @GLIB_CFLAGS@ \ + @PW3270_CFLAGS@ GTK_LIBS=@GTK_LIBS@ V3270_LIBS=@V3270_LIBS@ GLIB_LIBS=@GLIB_LIBS@ +DBUS_LIBS=@DBUS_LIBS@ @GDBUS_LIBS@ LIBS= \ @LIBS@ \ @LIBICONV@ \ @INTL_LIBS@ \ - @LIB3270_LIBS@ + @LIB3270_LIBS@ \ + @PW3270_LIBS@ + +src/include/dbus-glue.h: \ + pw3270dbus.xml + + @echo $@ ... + @$(DBUSBINDINGTOOL) \ + --mode=glib-server \ + --output=$@ \ + --prefix=pw3270_dbus $^ + #---[ Debug Rules ]---------------------------------------------------------------------- @@ -191,7 +206,9 @@ $(BINRLS)/$(MODULE_NAME)@DLLEXT@: \ -L$(BINRLS) -l$(MODULE_NAME) \ $(V3270_LIBS) \ $(LIBS) \ - $(GTK_LIBS) + $(GTK_LIBS) \ + $(DBUS_LIBS) + $(BINRLS)/lib$(MODULE_NAME).a: \ $(foreach SRC, $(basename $(CORE_SOURCES)), $(OBJRLS)/$(SRC).o) @@ -278,7 +295,8 @@ $(BINDBG)/$(MODULE_NAME)@DLLEXT@: \ -L$(BINDBG) -lpw3270cpp \ $(V3270_LIBS) \ $(LIBS) \ - $(GTK_LIBS) + $(GTK_LIBS) \ + $(DBUS_LIBS) #---[ Clean Targets ]-------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 4798f94..25fccf4 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,7 @@ APP_RESOURCES="" APP_LDFLAGS="" DLL_LDFLAGS="-shared" STATIC_LDFLAGS="" +DEPENDS="" dnl --------------------------------------------------------------------------- dnl Check for OS specifics @@ -167,6 +168,15 @@ AC_SUBST(LIB3270_LIBS) AC_SUBST(LIB3270_CFLAGS) dnl --------------------------------------------------------------------------- +dnl Check for PW3270 +dnl --------------------------------------------------------------------------- + +PKG_CHECK_MODULES( [PW3270], [pw3270], AC_DEFINE(HAVE_PW3270), AC_MSG_ERROR([PW3270 not present.])) + +AC_SUBST(PW3270_LIBS) +AC_SUBST(PW3270_CFLAGS) + +dnl --------------------------------------------------------------------------- dnl Check for LIBV3270 dnl --------------------------------------------------------------------------- @@ -196,6 +206,8 @@ dnl --------------------------------------------------------------------------- dnl Check for D-Bus dnl --------------------------------------------------------------------------- +AC_PATH_TOOL([DBUSBINDINGTOOL],[dbus-binding-tool],[no]) + PKG_CHECK_MODULES( [DBUS], [dbus-1], app_cv_libdbus=yes, AC_MSG_NOTICE([ No DBUS support.]) ) AC_SUBST(DBUS_LIBS) AC_SUBST(DBUS_CFLAGS) @@ -204,6 +216,12 @@ PKG_CHECK_MODULES( [GDBUS], [dbus-glib-1], app_cv_dbus=yes, AC_MSG_NOTICE([No GD AC_SUBST(GDBUS_LIBS) AC_SUBST(GDBUS_CFLAGS) +if test "$app_cv_dbus" == "yes"; then + AC_DEFINE(HAVE_DBUS) + DEPENDS="$DEPENDS src/include/dbus-glue.h" +fi + + dnl --------------------------------------------------------------------------- dnl Check for pic dnl --------------------------------------------------------------------------- @@ -238,6 +256,7 @@ dnl --------------------------------------------------------------------------- dnl Configure which files to generate. dnl --------------------------------------------------------------------------- +AC_SUBST(DEPENDS) AC_CONFIG_FILES(Makefile) dnl --------------------------------------------------------------------------- diff --git a/pw3270dbus.xml b/pw3270dbus.xml new file mode 100644 index 0000000..aee27c0 --- /dev/null +++ b/pw3270dbus.xml @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dbus3270/pw3270dbus.xml b/src/dbus3270/pw3270dbus.xml deleted file mode 100644 index aee27c0..0000000 --- a/src/dbus3270/pw3270dbus.xml +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/plugin/linux/gobject.c b/src/plugin/linux/gobject.c index 1cd90a6..47e705f 100644 --- a/src/plugin/linux/gobject.c +++ b/src/plugin/linux/gobject.c @@ -68,7 +68,7 @@ static void pw3270_dbus_class_init(PW3270DbusClass *klass) object_class->finalize = pw3270_dbus_finalize; } -static void pw3270_dbus_init(PW3270Dbus *object) +static void pw3270_dbus_init(PW3270Dbus G_GNUC_UNUSED(*object)) { } @@ -199,6 +199,7 @@ int pw3270_dbus_check_valid_state(PW3270Dbus *object, DBusGMethodInvocation *con case LIB3270_MESSAGE_RESOLVING: case LIB3270_MESSAGE_CONNECTING: error = g_error_new(ERROR_DOMAIN,EINPROGRESS,_( "Connecting to host" )); + break; case LIB3270_MESSAGE_USER: error = g_error_new(ERROR_DOMAIN,-1,_( "Unexpected state %04d" ),state); @@ -512,7 +513,7 @@ void pw3270_dbus_set_clipboard(PW3270Dbus *object, const gchar *text, DBusGMetho dbus_g_method_return(context,0); } -void pw3270_dbus_set_script(PW3270Dbus *object, const gchar *text, int mode, DBusGMethodInvocation *context) +void pw3270_dbus_set_script(PW3270Dbus *object, const gchar G_GNUC_UNUSED(*text), int mode, DBusGMethodInvocation *context) { GtkWidget *widget = pw3270_get_terminal_widget(NULL); @@ -540,7 +541,7 @@ void pw3270_dbus_get_host_charset(PW3270Dbus *object, DBusGMethodInvocation *con dbus_g_method_return(context,lib3270_get_host_charset(pw3270_dbus_get_session_handle(object))); } -void pw3270_dbus_get_display_charset(PW3270Dbus *object, DBusGMethodInvocation *context) +void pw3270_dbus_get_display_charset(PW3270Dbus G_GNUC_UNUSED(*object), DBusGMethodInvocation *context) { // Allways return UTF-8 to avoid double conversion dbus_g_method_return(context,"UTF-8"); diff --git a/src/plugin/linux/main.c b/src/plugin/linux/main.c index 4f93f08..a8af3d8 100644 --- a/src/plugin/linux/main.c +++ b/src/plugin/linux/main.c @@ -40,7 +40,7 @@ #include #include "service.h" -//#include "dbus-glue.h" +#include "dbus-glue.h" #include @@ -53,7 +53,7 @@ /*---[ Implement ]-------------------------------------------------------------------------------*/ - LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) + LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget G_GNUC_UNUSED(*terminal)) { GError * error = NULL; guint result; @@ -144,7 +144,7 @@ return 0; } - LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) + LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget G_GNUC_UNUSED(*window), GtkWidget G_GNUC_UNUSED(*terminal)) { if(service_name) { @@ -156,13 +156,13 @@ return 0; } - void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context) + void pw3270_dbus_quit(PW3270Dbus G_GNUC_UNUSED(*object), DBusGMethodInvocation *context) { gtk_main_quit(); dbus_g_method_return(context,0); } - H3270 * pw3270_dbus_get_session_handle(PW3270Dbus *object) + H3270 * pw3270_dbus_get_session_handle(PW3270Dbus G_GNUC_UNUSED(*object)) { return lib3270_get_default_session_handle(); } diff --git a/src/plugin/linux/misc.c b/src/plugin/linux/misc.c index 0e73503..fb874ef 100644 --- a/src/plugin/linux/misc.c +++ b/src/plugin/linux/misc.c @@ -37,7 +37,7 @@ /*---[ Implement ]-------------------------------------------------------------------------------*/ -gpointer pw3270_dbus_register_object(DBusGConnection *connection,DBusGProxy *proxy,GType object_type,const DBusGObjectInfo *info,const gchar *path) +gpointer pw3270_dbus_register_object(DBusGConnection *connection,DBusGProxy G_GNUC_UNUSED(*proxy),GType object_type,const DBusGObjectInfo *info,const gchar *path) { GObject *object = g_object_new (object_type, NULL); dbus_g_object_type_install_info (object_type, info); -- libgit2 0.21.2