Commit 7c0d24793762cc5836d44c4569ae3920601a0568
1 parent
65a98c0e
Exists in
master
and in
1 other branch
Working on IPC plugin for windows.
Showing
7 changed files
with
33 additions
and
12 deletions
Show diff stats
pw3270-plugin-ipc.cbp
| @@ -90,14 +90,15 @@ | @@ -90,14 +90,15 @@ | ||
| 90 | <Unit filename="src/core/windows/pipesource.c"> | 90 | <Unit filename="src/core/windows/pipesource.c"> |
| 91 | <Option compilerVar="CC" /> | 91 | <Option compilerVar="CC" /> |
| 92 | </Unit> | 92 | </Unit> |
| 93 | - <Unit filename="src/core/windows/resources.rc" /> | 93 | + <Unit filename="src/core/windows/resources.rc"> |
| 94 | + <Option compilerVar="WINDRES" /> | ||
| 95 | + </Unit> | ||
| 94 | <Unit filename="src/core/windows/start.c"> | 96 | <Unit filename="src/core/windows/start.c"> |
| 95 | <Option compilerVar="CC" /> | 97 | <Option compilerVar="CC" /> |
| 96 | </Unit> | 98 | </Unit> |
| 97 | <Unit filename="src/include/config.h" /> | 99 | <Unit filename="src/include/config.h" /> |
| 98 | <Unit filename="src/include/config.h.in" /> | 100 | <Unit filename="src/include/config.h.in" /> |
| 99 | <Unit filename="src/include/lib3270/ipc.h" /> | 101 | <Unit filename="src/include/lib3270/ipc.h" /> |
| 100 | - <Unit filename="src/linux/gobject.h" /> | ||
| 101 | <Unit filename="src/plugin/plugin.c"> | 102 | <Unit filename="src/plugin/plugin.c"> |
| 102 | <Option compilerVar="CC" /> | 103 | <Option compilerVar="CC" /> |
| 103 | </Unit> | 104 | </Unit> |
src/core/linux/gobject.c
| @@ -40,13 +40,18 @@ | @@ -40,13 +40,18 @@ | ||
| 40 | #include <dbus/dbus-glib.h> | 40 | #include <dbus/dbus-glib.h> |
| 41 | #include <dbus/dbus-glib-bindings.h> | 41 | #include <dbus/dbus-glib-bindings.h> |
| 42 | 42 | ||
| 43 | +/*--[ Widget definition ]----------------------------------------------------------------------------*/ | ||
| 44 | + | ||
| 43 | G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT) | 45 | G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT) |
| 44 | 46 | ||
| 47 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
| 48 | + | ||
| 45 | static void ipc3270_finalize(GObject *object) { | 49 | static void ipc3270_finalize(GObject *object) { |
| 46 | 50 | ||
| 51 | + debug("ipc3270::%s(%p)",__FUNCTION__,object); | ||
| 52 | + | ||
| 47 | ipc3270 * ipc = IPC3270(object); | 53 | ipc3270 * ipc = IPC3270(object); |
| 48 | 54 | ||
| 49 | - debug("%s",__FUNCTION__); | ||
| 50 | if(ipc->id) { | 55 | if(ipc->id) { |
| 51 | g_dbus_connection_unregister_object(ipc->connection,ipc->id); | 56 | g_dbus_connection_unregister_object(ipc->connection,ipc->id); |
| 52 | } | 57 | } |
src/core/linux/gobject.h
| @@ -66,12 +66,6 @@ | @@ -66,12 +66,6 @@ | ||
| 66 | GObjectClass parent; | 66 | GObjectClass parent; |
| 67 | }; | 67 | }; |
| 68 | 68 | ||
| 69 | - /* | ||
| 70 | - 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); | ||
| 71 | - 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); | ||
| 72 | - 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); | ||
| 73 | - */ | ||
| 74 | - | ||
| 75 | G_END_DECLS | 69 | G_END_DECLS |
| 76 | 70 | ||
| 77 | #endif // LINUX_GOBJECT_H_INCLUDED | 71 | #endif // LINUX_GOBJECT_H_INCLUDED |
src/core/windows/gobject.c
| @@ -31,12 +31,26 @@ | @@ -31,12 +31,26 @@ | ||
| 31 | #include <lib3270.h> | 31 | #include <lib3270.h> |
| 32 | #include <lib3270/actions.h> | 32 | #include <lib3270/actions.h> |
| 33 | #include <lib3270/properties.h> | 33 | #include <lib3270/properties.h> |
| 34 | +#include <lib3270/ipc.h> | ||
| 35 | + | ||
| 36 | +/*--[ Widget definition ]----------------------------------------------------------------------------*/ | ||
| 34 | 37 | ||
| 35 | G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT) | 38 | G_DEFINE_TYPE(ipc3270, ipc3270, G_TYPE_OBJECT) |
| 36 | 39 | ||
| 40 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
| 41 | + | ||
| 37 | static void ipc3270_finalize(GObject *object) { | 42 | static void ipc3270_finalize(GObject *object) { |
| 38 | 43 | ||
| 39 | - // ipc3270 * ipc = IPC3270(object); | 44 | + debug("ipc3270::%s(%p)",__FUNCTION__,object); |
| 45 | + | ||
| 46 | + ipc3270 * ipc = IPC3270(object); | ||
| 47 | + | ||
| 48 | + if(ipc->source) | ||
| 49 | + { | ||
| 50 | + g_source_destroy((GSource *) ipc->source); | ||
| 51 | + ipc->source = NULL; | ||
| 52 | + } | ||
| 53 | + | ||
| 40 | G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object); | 54 | G_OBJECT_CLASS(ipc3270_parent_class)->finalize(object); |
| 41 | 55 | ||
| 42 | } | 56 | } |
| @@ -54,7 +68,7 @@ static void ipc3270_class_init(ipc3270Class *klass) { | @@ -54,7 +68,7 @@ static void ipc3270_class_init(ipc3270Class *klass) { | ||
| 54 | 68 | ||
| 55 | static void ipc3270_init(ipc3270 *object) { | 69 | static void ipc3270_init(ipc3270 *object) { |
| 56 | 70 | ||
| 57 | - debug("%s",__FUNCTION__); | 71 | + debug("%s(%p)",__FUNCTION__,object); |
| 58 | object->error_domain = g_quark_from_static_string(PACKAGE_NAME); | 72 | object->error_domain = g_quark_from_static_string(PACKAGE_NAME); |
| 59 | 73 | ||
| 60 | } | 74 | } |
src/core/windows/gobject.h
| @@ -78,6 +78,7 @@ | @@ -78,6 +78,7 @@ | ||
| 78 | } IPC3270_PIPE_SOURCE; | 78 | } IPC3270_PIPE_SOURCE; |
| 79 | 79 | ||
| 80 | struct _ipc3270 { | 80 | struct _ipc3270 { |
| 81 | + GObject parent; | ||
| 81 | H3270 * hSession; | 82 | H3270 * hSession; |
| 82 | IPC3270_PIPE_SOURCE * source; | 83 | IPC3270_PIPE_SOURCE * source; |
| 83 | GQuark error_domain; | 84 | GQuark error_domain; |
src/core/windows/start.c
| @@ -31,11 +31,14 @@ | @@ -31,11 +31,14 @@ | ||
| 31 | #include <lib3270.h> | 31 | #include <lib3270.h> |
| 32 | #include <lib3270/actions.h> | 32 | #include <lib3270/actions.h> |
| 33 | #include <lib3270/properties.h> | 33 | #include <lib3270/properties.h> |
| 34 | +#include <lib3270/ipc.h> | ||
| 34 | 35 | ||
| 35 | void ipc3270_export_object(GObject *object, const char *name, GError **error) { | 36 | void ipc3270_export_object(GObject *object, const char *name, GError **error) { |
| 36 | 37 | ||
| 37 | char id; | 38 | char id; |
| 38 | 39 | ||
| 40 | + debug("%s object=%p name=%s type=%p",__FUNCTION__,object,name,ipc3270_get_type()); | ||
| 41 | + | ||
| 39 | ipc3270 * ipc = IPC3270(object); | 42 | ipc3270 * ipc = IPC3270(object); |
| 40 | 43 | ||
| 41 | for(id='A';id < 'Z';id++) { | 44 | for(id='A';id < 'Z';id++) { |
src/plugin/plugin.c
| @@ -46,19 +46,22 @@ | @@ -46,19 +46,22 @@ | ||
| 46 | #include <lib3270/ipc.h> | 46 | #include <lib3270/ipc.h> |
| 47 | 47 | ||
| 48 | int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) { | 48 | int pw3270_plugin_stop(GtkWidget *window, GtkWidget *terminal) { |
| 49 | + debug("%s(%p)",__FUNCTION__,g_object_get_data(G_OBJECT(terminal),"ipc-object-info")); | ||
| 49 | g_object_set_data(G_OBJECT(terminal), "ipc-object-info", NULL); | 50 | g_object_set_data(G_OBJECT(terminal), "ipc-object-info", NULL); |
| 51 | + return 0; | ||
| 50 | } | 52 | } |
| 51 | 53 | ||
| 52 | int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) { | 54 | int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) { |
| 53 | 55 | ||
| 54 | // Creates IPC, associate it with the terminal window | 56 | // Creates IPC, associate it with the terminal window |
| 55 | - GObject * ipc = ipc3270_new(); | 57 | + GObject * ipc = ipc3270_new(); |
| 56 | g_object_set_data_full(G_OBJECT(terminal), "ipc-object-info", ipc, g_object_unref); | 58 | g_object_set_data_full(G_OBJECT(terminal), "ipc-object-info", ipc, g_object_unref); |
| 57 | 59 | ||
| 58 | debug("Name: \"%s\"",gtk_widget_get_name(window)); | 60 | debug("Name: \"%s\"",gtk_widget_get_name(window)); |
| 59 | 61 | ||
| 60 | // Set session handle, this starts the IPC communication. | 62 | // Set session handle, this starts the IPC communication. |
| 61 | GError * error = NULL; | 63 | GError * error = NULL; |
| 64 | + | ||
| 62 | ipc3270_set_session(ipc,v3270_get_session(terminal)); | 65 | ipc3270_set_session(ipc,v3270_get_session(terminal)); |
| 63 | ipc3270_export_object(ipc,gtk_widget_get_name(window),&error); | 66 | ipc3270_export_object(ipc,gtk_widget_get_name(window),&error); |
| 64 | 67 |