From 7c0d24793762cc5836d44c4569ae3920601a0568 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 15 Feb 2019 07:25:30 -0200 Subject: [PATCH] Working on IPC plugin for windows. --- pw3270-plugin-ipc.cbp | 5 +++-- src/core/linux/gobject.c | 7 ++++++- src/core/linux/gobject.h | 6 ------ src/core/windows/gobject.c | 18 ++++++++++++++++-- src/core/windows/gobject.h | 1 + src/core/windows/start.c | 3 +++ src/plugin/plugin.c | 5 ++++- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/pw3270-plugin-ipc.cbp b/pw3270-plugin-ipc.cbp index f3ea695..8ff68d1 100644 --- a/pw3270-plugin-ipc.cbp +++ b/pw3270-plugin-ipc.cbp @@ -90,14 +90,15 @@ - + + - diff --git a/src/core/linux/gobject.c b/src/core/linux/gobject.c index c965f87..fefb188 100644 --- a/src/core/linux/gobject.c +++ b/src/core/linux/gobject.c @@ -40,13 +40,18 @@ #include #include +/*--[ Widget definition ]----------------------------------------------------------------------------*/ + G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT) +/*--[ Implement ]------------------------------------------------------------------------------------*/ + static void ipc3270_finalize(GObject *object) { + debug("ipc3270::%s(%p)",__FUNCTION__,object); + ipc3270 * ipc = IPC3270(object); - debug("%s",__FUNCTION__); if(ipc->id) { g_dbus_connection_unregister_object(ipc->connection,ipc->id); } diff --git a/src/core/linux/gobject.h b/src/core/linux/gobject.h index 0241533..989c481 100644 --- a/src/core/linux/gobject.h +++ b/src/core/linux/gobject.h @@ -66,12 +66,6 @@ GObjectClass parent; }; - /* - G_GNUC_INTERNAL void ipc3270_method_call (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data); - G_GNUC_INTERNAL gboolean ipc3270_set_property(GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer user_data); - G_GNUC_INTERNAL GVariant * ipc3270_get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data); - */ - G_END_DECLS #endif // LINUX_GOBJECT_H_INCLUDED diff --git a/src/core/windows/gobject.c b/src/core/windows/gobject.c index e01c6a1..b61ba93 100644 --- a/src/core/windows/gobject.c +++ b/src/core/windows/gobject.c @@ -31,12 +31,26 @@ #include #include #include +#include + +/*--[ Widget definition ]----------------------------------------------------------------------------*/ G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT) +/*--[ Implement ]------------------------------------------------------------------------------------*/ + static void ipc3270_finalize(GObject *object) { - // ipc3270 * ipc = IPC3270(object); + debug("ipc3270::%s(%p)",__FUNCTION__,object); + + ipc3270 * ipc = IPC3270(object); + + if(ipc->source) + { + g_source_destroy((GSource *) ipc->source); + ipc->source = NULL; + } + G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object); } @@ -54,7 +68,7 @@ static void ipc3270_class_init(ipc3270Class *klass) { static void ipc3270_init(ipc3270 *object) { - debug("%s",__FUNCTION__); + debug("%s(%p)",__FUNCTION__,object); object->error_domain = g_quark_from_static_string(PACKAGE_NAME); } diff --git a/src/core/windows/gobject.h b/src/core/windows/gobject.h index 0b3e1cc..4cda26e 100644 --- a/src/core/windows/gobject.h +++ b/src/core/windows/gobject.h @@ -78,6 +78,7 @@ } IPC3270_PIPE_SOURCE; struct _ipc3270 { + GObject parent; H3270 * hSession; IPC3270_PIPE_SOURCE * source; GQuark error_domain; diff --git a/src/core/windows/start.c b/src/core/windows/start.c index b6d2ab4..8a51d22 100644 --- a/src/core/windows/start.c +++ b/src/core/windows/start.c @@ -31,11 +31,14 @@ #include #include #include +#include void ipc3270_export_object(GObject *object, const char *name, GError **error) { char id; + debug("%s object=%p name=%s type=%p",__FUNCTION__,object,name,ipc3270_get_type()); + ipc3270 * ipc = IPC3270(object); for(id='A';id < 'Z';id++) { diff --git a/src/plugin/plugin.c b/src/plugin/plugin.c index 8dee804..f997363 100644 --- a/src/plugin/plugin.c +++ b/src/plugin/plugin.c @@ -46,19 +46,22 @@ #include int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) { + debug("%s(%p)",__FUNCTION__,g_object_get_data(G_OBJECT(terminal),"ipc-object-info")); g_object_set_data(G_OBJECT(terminal), "ipc-object-info", NULL); + return 0; } int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) { // Creates IPC, associate it with the terminal window - GObject * ipc = ipc3270_new(); + GObject * ipc = ipc3270_new(); g_object_set_data_full(G_OBJECT(terminal), "ipc-object-info", ipc, g_object_unref); debug("Name: \"%s\"",gtk_widget_get_name(window)); // Set session handle, this starts the IPC communication. GError * error = NULL; + ipc3270_set_session(ipc,v3270_get_session(terminal)); ipc3270_export_object(ipc,gtk_widget_get_name(window),&error); -- libgit2 0.21.2