Commit 8568180de00a46c3a29f894520568285c934daff
1 parent
afab33cf
Exists in
master
and in
5 other branches
Incluindo método para encerrar a aplicação
Showing
10 changed files
with
61 additions
and
5 deletions
Show diff stats
debian.rules
| @@ -29,8 +29,6 @@ build-stamp: | @@ -29,8 +29,6 @@ build-stamp: | ||
| 29 | ./configure --prefix=/usr | 29 | ./configure --prefix=/usr |
| 30 | rm -f debian/*.install | 30 | rm -f debian/*.install |
| 31 | make Release | 31 | make Release |
| 32 | - mv debian/dbus3270.install debian/pw3270-plugin-dbus.install | ||
| 33 | - mv debian/oxt.install debian/libreoffice-extension-pw3270.install | ||
| 34 | # --- end custom part for compiling | 32 | # --- end custom part for compiling |
| 35 | 33 | ||
| 36 | touch build-stamp | 34 | touch build-stamp |
src/include/pw3270/ipcpackets.h
| @@ -52,7 +52,8 @@ | @@ -52,7 +52,8 @@ | ||
| 52 | HLLAPI_PACKET_IS_READY, HLLAPI_PACKET_SET_TOGGLE, | 52 | HLLAPI_PACKET_IS_READY, HLLAPI_PACKET_SET_TOGGLE, |
| 53 | HLLAPI_PACKET_FIELD_START, | 53 | HLLAPI_PACKET_FIELD_START, |
| 54 | HLLAPI_PACKET_FIELD_LEN, | 54 | HLLAPI_PACKET_FIELD_LEN, |
| 55 | - HLLAPI_PACKET_NEXT_UNPROTECTED, | 55 | + HLLAPI_PACKET_NEXT_UNPROTECTED, |
| 56 | + HLLAPI_PACKET_QUIT, | ||
| 56 | 57 | ||
| 57 | HLLAPI_PACKET_INVALID | 58 | HLLAPI_PACKET_INVALID |
| 58 | 59 |
src/plugins/hllapi/pluginmain.c
| @@ -299,6 +299,11 @@ | @@ -299,6 +299,11 @@ | ||
| 299 | ((struct hllapi_packet_addr *) source->buffer)->addr)); | 299 | ((struct hllapi_packet_addr *) source->buffer)->addr)); |
| 300 | break; | 300 | break; |
| 301 | 301 | ||
| 302 | + case HLLAPI_PACKET_QUIT: | ||
| 303 | + gtk_main_quit(); | ||
| 304 | + send_result(source,0); | ||
| 305 | + break; | ||
| 306 | + | ||
| 302 | default: | 307 | default: |
| 303 | send_result(source, EINVAL); | 308 | send_result(source, EINVAL); |
| 304 | g_message("Invalid remote request (id=%d)",source->buffer[0]); | 309 | g_message("Invalid remote request (id=%d)",source->buffer[0]); |
src/plugins/rx3270/local.cc
| @@ -90,6 +90,8 @@ | @@ -90,6 +90,8 @@ | ||
| 90 | 90 | ||
| 91 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); | 91 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 92 | 92 | ||
| 93 | + int quit(void); | ||
| 94 | + | ||
| 93 | private: | 95 | private: |
| 94 | 96 | ||
| 95 | const char * (*_get_version)(void); | 97 | const char * (*_get_version)(void); |
| @@ -588,3 +590,8 @@ int dynamic::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mes | @@ -588,3 +590,8 @@ int dynamic::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mes | ||
| 588 | } | 590 | } |
| 589 | return -1; | 591 | return -1; |
| 590 | } | 592 | } |
| 593 | + | ||
| 594 | +int dynamic::quit(void) | ||
| 595 | +{ | ||
| 596 | + return EINVAL; | ||
| 597 | +} |
src/plugins/rx3270/pluginmain.cc
| @@ -119,6 +119,8 @@ | @@ -119,6 +119,8 @@ | ||
| 119 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); | 119 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 120 | char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | 120 | char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); |
| 121 | 121 | ||
| 122 | + int quit(void); | ||
| 123 | + | ||
| 122 | protected: | 124 | protected: |
| 123 | 125 | ||
| 124 | private: | 126 | private: |
| @@ -570,3 +572,9 @@ char * plugin::file_chooser_dialog(GtkFileChooserAction action, const char *titl | @@ -570,3 +572,9 @@ char * plugin::file_chooser_dialog(GtkFileChooserAction action, const char *titl | ||
| 570 | { | 572 | { |
| 571 | return pw3270_file_chooser(action, script_name ? script_name : "rexx", title, filename, extension); | 573 | return pw3270_file_chooser(action, script_name ? script_name : "rexx", title, filename, extension); |
| 572 | } | 574 | } |
| 575 | + | ||
| 576 | +int plugin::quit(void) | ||
| 577 | +{ | ||
| 578 | + gtk_main_quit(); | ||
| 579 | + return 0; | ||
| 580 | +} |
src/plugins/rx3270/remote.cc
| @@ -86,6 +86,8 @@ | @@ -86,6 +86,8 @@ | ||
| 86 | char * get_clipboard(void); | 86 | char * get_clipboard(void); |
| 87 | int set_clipboard(const char *text); | 87 | int set_clipboard(const char *text); |
| 88 | 88 | ||
| 89 | + int quit(void); | ||
| 90 | + | ||
| 89 | private: | 91 | private: |
| 90 | #if defined(WIN32) | 92 | #if defined(WIN32) |
| 91 | 93 | ||
| @@ -1215,3 +1217,28 @@ char * remote::get_clipboard(void) | @@ -1215,3 +1217,28 @@ char * remote::get_clipboard(void) | ||
| 1215 | 1217 | ||
| 1216 | return NULL; | 1218 | return NULL; |
| 1217 | } | 1219 | } |
| 1220 | + | ||
| 1221 | +int remote::quit(void) | ||
| 1222 | +{ | ||
| 1223 | +#if defined(WIN32) | ||
| 1224 | + | ||
| 1225 | + if(hPipe != INVALID_HANDLE_VALUE) | ||
| 1226 | + { | ||
| 1227 | + static const struct hllapi_packet_query query = { HLLAPI_PACKET_QUIT }; | ||
| 1228 | + struct hllapi_packet_result response; | ||
| 1229 | + DWORD cbSize = sizeof(query); | ||
| 1230 | + TransactNamedPipe(hPipe,(LPVOID) &query, cbSize, &response, sizeof(response), &cbSize,NULL); | ||
| 1231 | + return (int) response.rc; | ||
| 1232 | + } | ||
| 1233 | + | ||
| 1234 | + return (int) -1; | ||
| 1235 | + | ||
| 1236 | +#elif defined(HAVE_DBUS) | ||
| 1237 | + | ||
| 1238 | + return query_intval("quit"); | ||
| 1239 | + | ||
| 1240 | +#endif | ||
| 1241 | + | ||
| 1242 | + return -1; | ||
| 1243 | + | ||
| 1244 | +} |
src/plugins/rx3270/rx3270.cc
| @@ -50,7 +50,7 @@ | @@ -50,7 +50,7 @@ | ||
| 50 | 50 | ||
| 51 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 51 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 52 | 52 | ||
| 53 | - static rx3270 * defSession = NULL; | 53 | + static rx3270 * defSession = NULL; |
| 54 | static rx3270 * (*factory)(const char *type) = factory_default; | 54 | static rx3270 * (*factory)(const char *type) = factory_default; |
| 55 | 55 | ||
| 56 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 56 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| @@ -116,7 +116,7 @@ char * rx3270::get_revision(void) | @@ -116,7 +116,7 @@ char * rx3270::get_revision(void) | ||
| 116 | return strdup(PACKAGE_REVISION); | 116 | return strdup(PACKAGE_REVISION); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | -rx3270 * rx3270::get_default(void) | 119 | +rx3270 * rx3270::get_default() |
| 120 | { | 120 | { |
| 121 | if(defSession) | 121 | if(defSession) |
| 122 | return defSession; | 122 | return defSession; |
src/plugins/rx3270/rx3270.h
| @@ -83,6 +83,7 @@ | @@ -83,6 +83,7 @@ | ||
| 83 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsTerminalReady); | 83 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsTerminalReady); |
| 84 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); | 84 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); |
| 85 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); | 85 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); |
| 86 | + REXX_TYPED_ROUTINE_PROTOTYPE(rx3270CloseApplication); | ||
| 86 | 87 | ||
| 87 | REXX_METHOD_PROTOTYPE(rx3270_method_version); | 88 | REXX_METHOD_PROTOTYPE(rx3270_method_version); |
| 88 | REXX_METHOD_PROTOTYPE(rx3270_method_revision); | 89 | REXX_METHOD_PROTOTYPE(rx3270_method_revision); |
| @@ -202,6 +203,8 @@ | @@ -202,6 +203,8 @@ | ||
| 202 | virtual char * get_clipboard(void); | 203 | virtual char * get_clipboard(void); |
| 203 | virtual int set_clipboard(const char *text); | 204 | virtual int set_clipboard(const char *text); |
| 204 | 205 | ||
| 206 | + virtual int quit(void) = 0; | ||
| 207 | + | ||
| 205 | // Dialogs | 208 | // Dialogs |
| 206 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); | 209 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 207 | virtual char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); | 210 | virtual char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); |
src/plugins/rx3270/rxapimain.cc
| @@ -112,6 +112,8 @@ RexxRoutineEntry rx3270_functions[] = | @@ -112,6 +112,8 @@ RexxRoutineEntry rx3270_functions[] = | ||
| 112 | REXX_TYPED_ROUTINE(rx3270IsTerminalReady, rx3270IsTerminalReady), | 112 | REXX_TYPED_ROUTINE(rx3270IsTerminalReady, rx3270IsTerminalReady), |
| 113 | REXX_TYPED_ROUTINE(rx3270queryStringAt, rx3270queryStringAt), | 113 | REXX_TYPED_ROUTINE(rx3270queryStringAt, rx3270queryStringAt), |
| 114 | REXX_TYPED_ROUTINE(rx3270SetStringAt, rx3270SetStringAt), | 114 | REXX_TYPED_ROUTINE(rx3270SetStringAt, rx3270SetStringAt), |
| 115 | + REXX_TYPED_ROUTINE(rx3270CloseApplication, rx3270CloseApplication), | ||
| 116 | + | ||
| 115 | 117 | ||
| 116 | // rx3270Popup | 118 | // rx3270Popup |
| 117 | 119 |
src/plugins/rx3270/typed_routines.cc
| @@ -200,3 +200,8 @@ RexxRoutine3(int, rx3270SetStringAt, int, row, int, col, CSTRING, text) | @@ -200,3 +200,8 @@ RexxRoutine3(int, rx3270SetStringAt, int, row, int, col, CSTRING, text) | ||
| 200 | return rc; | 200 | return rc; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | +RexxRoutine0(int, rx3270CloseApplication) | ||
| 204 | +{ | ||
| 205 | + rx3270 * session = rx3270::get_default(); | ||
| 206 | + return session->quit(); | ||
| 207 | +} |