Commit 2c256cf74d283a99591e54b4aa530c0c7d3dd81d
1 parent
251421de
Exists in
master
and in
1 other branch
Fixing bugs in the IPC plugin.
Showing
5 changed files
with
43 additions
and
5 deletions
Show diff stats
server/src/core/linux/start.c
| ... | ... | @@ -50,9 +50,12 @@ static void |
| 50 | 50 | GDBusMethodInvocation *invocation, |
| 51 | 51 | gpointer user_data) { |
| 52 | 52 | |
| 53 | - g_autoptr (GError) error = NULL; | |
| 53 | + g_autoptr (GError) error = NULL; | |
| 54 | + GVariant * rc; | |
| 54 | 55 | |
| 55 | - GVariant * rc = ipc3270_method_call(G_OBJECT(user_data), method_name, parameters, &error); | |
| 56 | + debug("%s(%s,%s)",__FUNCTION__,interface_name,object_path); | |
| 57 | + | |
| 58 | + rc = ipc3270_method_call(G_OBJECT(user_data), method_name, parameters, &error); | |
| 56 | 59 | |
| 57 | 60 | if(error) { |
| 58 | 61 | |
| ... | ... | @@ -90,6 +93,7 @@ static GVariant * |
| 90 | 93 | gpointer user_data) |
| 91 | 94 | { |
| 92 | 95 | |
| 96 | + debug("%s(%s)",__FUNCTION__,property_name); | |
| 93 | 97 | return ipc3270_get_property(G_OBJECT(user_data), property_name, error); |
| 94 | 98 | |
| 95 | 99 | } |
| ... | ... | @@ -106,6 +110,7 @@ static gboolean |
| 106 | 110 | gpointer user_data) |
| 107 | 111 | { |
| 108 | 112 | |
| 113 | + debug("%s(%s)",__FUNCTION__,property_name); | |
| 109 | 114 | return ipc3270_set_property(G_OBJECT(user_data), property_name, value, error); |
| 110 | 115 | |
| 111 | 116 | } | ... | ... |
server/src/core/methods.c
| ... | ... | @@ -139,6 +139,37 @@ GVariant * ipc3270_method_call(GObject *object, const gchar *method_name, GVaria |
| 139 | 139 | } |
| 140 | 140 | return g_variant_new_int32((gint) lib3270_wait_for_ready(hSession,timeout)); |
| 141 | 141 | } |
| 142 | + else if(!g_ascii_strcasecmp(method_name,"connect")) | |
| 143 | + { | |
| 144 | + gchar *text = NULL; | |
| 145 | + g_variant_get(parameters, "(&s)", &text); | |
| 146 | + | |
| 147 | + g_autofree gchar * converted = ipc3270_convert_output_string(object, text, error); | |
| 148 | + if(lib3270_connect_url(hSession,converted,0)) | |
| 149 | + { | |
| 150 | + // Failed! | |
| 151 | + ipc3270_set_error(object,errno,error); | |
| 152 | + return NULL; | |
| 153 | + } | |
| 154 | + | |
| 155 | + // Suceeded | |
| 156 | + return g_variant_new_int32(0); | |
| 157 | + | |
| 158 | + } | |
| 159 | + else if(!g_ascii_strcasecmp(method_name,"disconnect")) | |
| 160 | + { | |
| 161 | + if(lib3270_disconnect(hSession)) | |
| 162 | + { | |
| 163 | + // Failed! | |
| 164 | + ipc3270_set_error(object,errno,error); | |
| 165 | + return NULL; | |
| 166 | + } | |
| 167 | + | |
| 168 | + // Suceeded | |
| 169 | + return g_variant_new_int32(0); | |
| 170 | + } | |
| 171 | + | |
| 172 | + | |
| 142 | 173 | |
| 143 | 174 | // Check action table. |
| 144 | 175 | const LIB3270_ACTION_ENTRY * actions = lib3270_get_action_table(); | ... | ... |
server/src/core/setproperties.c
| ... | ... | @@ -109,7 +109,7 @@ gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVari |
| 109 | 109 | if(uintprop[ix].set && !g_ascii_strcasecmp(uintprop[ix].name, property_name)) { |
| 110 | 110 | |
| 111 | 111 | // Found it! |
| 112 | - if(uintprop[ix].set(hSession, (unsigned int) g_variant_get_uint32(value) ? 1 : 0)) { | |
| 112 | + if(uintprop[ix].set(hSession, (unsigned int) g_variant_get_uint32(value))) { | |
| 113 | 113 | |
| 114 | 114 | // Erro! |
| 115 | 115 | g_set_error_literal( |
| ... | ... | @@ -122,6 +122,7 @@ gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVari |
| 122 | 122 | return FALSE; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | +// g_message("%s=%u",property_name,uintprop[ix].get(hSession)); | |
| 125 | 126 | return TRUE; |
| 126 | 127 | |
| 127 | 128 | } | ... | ... |
server/src/core/windows/pipesource.c
| ... | ... | @@ -116,6 +116,7 @@ static void process_input(IPC3270_PIPE_SOURCE *source, DWORD cbRead) { |
| 116 | 116 | |
| 117 | 117 | case 2: // setProperty |
| 118 | 118 | ipc3270_set_property(source->object, request_name, parameters, &error); |
| 119 | + response = g_variant_new_int32(0); | |
| 119 | 120 | break; |
| 120 | 121 | |
| 121 | 122 | case 3: // method | ... | ... |
server/src/plugin/plugin.c
| ... | ... | @@ -57,13 +57,13 @@ |
| 57 | 57 | GObject * ipc = ipc3270_new(); |
| 58 | 58 | g_object_set_data_full(G_OBJECT(terminal), "ipc-object-info", ipc, g_object_unref); |
| 59 | 59 | |
| 60 | - debug("Name: \"%s\"",gtk_widget_get_name(window)); | |
| 60 | + debug("Name: \"%s\"",v3270_get_session_name(window)); | |
| 61 | 61 | |
| 62 | 62 | // Set session handle, this starts the IPC communication. |
| 63 | 63 | GError * error = NULL; |
| 64 | 64 | |
| 65 | 65 | ipc3270_set_session(ipc,v3270_get_session(terminal)); |
| 66 | - ipc3270_export_object(ipc,gtk_widget_get_name(window),&error); | |
| 66 | + ipc3270_export_object(ipc,v3270_get_session_name(terminal),&error); | |
| 67 | 67 | |
| 68 | 68 | if(error) { |
| 69 | 69 | ... | ... |