diff --git a/debian.rules b/debian.rules index c179720..6040f21 100644 --- a/debian.rules +++ b/debian.rules @@ -29,8 +29,6 @@ build-stamp: ./configure --prefix=/usr rm -f debian/*.install make Release - mv debian/dbus3270.install debian/pw3270-plugin-dbus.install - mv debian/oxt.install debian/libreoffice-extension-pw3270.install # --- end custom part for compiling touch build-stamp diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h index 2d3d2ca..2e0ceb0 100644 --- a/src/include/pw3270/ipcpackets.h +++ b/src/include/pw3270/ipcpackets.h @@ -52,7 +52,8 @@ HLLAPI_PACKET_IS_READY, HLLAPI_PACKET_SET_TOGGLE, HLLAPI_PACKET_FIELD_START, HLLAPI_PACKET_FIELD_LEN, - HLLAPI_PACKET_NEXT_UNPROTECTED, + HLLAPI_PACKET_NEXT_UNPROTECTED, + HLLAPI_PACKET_QUIT, HLLAPI_PACKET_INVALID diff --git a/src/plugins/hllapi/pluginmain.c b/src/plugins/hllapi/pluginmain.c index 87ee6c2..eefb3eb 100644 --- a/src/plugins/hllapi/pluginmain.c +++ b/src/plugins/hllapi/pluginmain.c @@ -299,6 +299,11 @@ ((struct hllapi_packet_addr *) source->buffer)->addr)); break; + case HLLAPI_PACKET_QUIT: + gtk_main_quit(); + send_result(source,0); + break; + default: send_result(source, EINVAL); g_message("Invalid remote request (id=%d)",source->buffer[0]); diff --git a/src/plugins/rx3270/local.cc b/src/plugins/rx3270/local.cc index 16b02d0..ee8f337 100644 --- a/src/plugins/rx3270/local.cc +++ b/src/plugins/rx3270/local.cc @@ -90,6 +90,8 @@ int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); + int quit(void); + private: const char * (*_get_version)(void); @@ -588,3 +590,8 @@ int dynamic::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mes } return -1; } + +int dynamic::quit(void) +{ + return EINVAL; +} diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc index 825ae94..33a2dbc 100644 --- a/src/plugins/rx3270/pluginmain.cc +++ b/src/plugins/rx3270/pluginmain.cc @@ -119,6 +119,8 @@ int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); + int quit(void); + protected: private: @@ -570,3 +572,9 @@ char * plugin::file_chooser_dialog(GtkFileChooserAction action, const char *titl { return pw3270_file_chooser(action, script_name ? script_name : "rexx", title, filename, extension); } + +int plugin::quit(void) +{ + gtk_main_quit(); + return 0; +} diff --git a/src/plugins/rx3270/remote.cc b/src/plugins/rx3270/remote.cc index 024a188..b0bfa5b 100644 --- a/src/plugins/rx3270/remote.cc +++ b/src/plugins/rx3270/remote.cc @@ -86,6 +86,8 @@ char * get_clipboard(void); int set_clipboard(const char *text); + int quit(void); + private: #if defined(WIN32) @@ -1215,3 +1217,28 @@ char * remote::get_clipboard(void) return NULL; } + +int remote::quit(void) +{ +#if defined(WIN32) + + if(hPipe != INVALID_HANDLE_VALUE) + { + static const struct hllapi_packet_query query = { HLLAPI_PACKET_QUIT }; + struct hllapi_packet_result response; + DWORD cbSize = sizeof(query); + TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL); + return (int) response.rc; + } + + return (int) -1; + +#elif defined(HAVE_DBUS) + + return query_intval("quit"); + +#endif + + return -1; + +} diff --git a/src/plugins/rx3270/rx3270.cc b/src/plugins/rx3270/rx3270.cc index c8104b2..16bc2b3 100644 --- a/src/plugins/rx3270/rx3270.cc +++ b/src/plugins/rx3270/rx3270.cc @@ -50,7 +50,7 @@ /*--[ Globals ]--------------------------------------------------------------------------------------*/ - static rx3270 * defSession = NULL; + static rx3270 * defSession = NULL; static rx3270 * (*factory)(const char *type) = factory_default; /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -116,7 +116,7 @@ char * rx3270::get_revision(void) return strdup(PACKAGE_REVISION); } -rx3270 * rx3270::get_default(void) +rx3270 * rx3270::get_default() { if(defSession) return defSession; diff --git a/src/plugins/rx3270/rx3270.h b/src/plugins/rx3270/rx3270.h index 7dbe917..6862404 100644 --- a/src/plugins/rx3270/rx3270.h +++ b/src/plugins/rx3270/rx3270.h @@ -83,6 +83,7 @@ REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsTerminalReady); REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); + REXX_TYPED_ROUTINE_PROTOTYPE(rx3270CloseApplication); REXX_METHOD_PROTOTYPE(rx3270_method_version); REXX_METHOD_PROTOTYPE(rx3270_method_revision); @@ -202,6 +203,8 @@ virtual char * get_clipboard(void); virtual int set_clipboard(const char *text); + virtual int quit(void) = 0; + // Dialogs virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); virtual char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); diff --git a/src/plugins/rx3270/rxapimain.cc b/src/plugins/rx3270/rxapimain.cc index 938298b..2c9c27a 100644 --- a/src/plugins/rx3270/rxapimain.cc +++ b/src/plugins/rx3270/rxapimain.cc @@ -112,6 +112,8 @@ RexxRoutineEntry rx3270_functions[] = REXX_TYPED_ROUTINE(rx3270IsTerminalReady, rx3270IsTerminalReady), REXX_TYPED_ROUTINE(rx3270queryStringAt, rx3270queryStringAt), REXX_TYPED_ROUTINE(rx3270SetStringAt, rx3270SetStringAt), + REXX_TYPED_ROUTINE(rx3270CloseApplication, rx3270CloseApplication), + // rx3270Popup diff --git a/src/plugins/rx3270/typed_routines.cc b/src/plugins/rx3270/typed_routines.cc index acef1bf..b345b3b 100644 --- a/src/plugins/rx3270/typed_routines.cc +++ b/src/plugins/rx3270/typed_routines.cc @@ -200,3 +200,8 @@ RexxRoutine3(int, rx3270SetStringAt, int, row, int, col, CSTRING, text) return rc; } +RexxRoutine0(int, rx3270CloseApplication) +{ + rx3270 * session = rx3270::get_default(); + return session->quit(); +} -- libgit2 0.21.2