Commit 7c0d24793762cc5836d44c4569ae3920601a0568

Authored by Perry Werneck
1 parent 65a98c0e
Exists in master and in 1 other branch develop

Working on IPC plugin for windows.

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