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 | 29 | ./configure --prefix=/usr |
| 30 | 30 | rm -f debian/*.install |
| 31 | 31 | make Release |
| 32 | - mv debian/dbus3270.install debian/pw3270-plugin-dbus.install | |
| 33 | - mv debian/oxt.install debian/libreoffice-extension-pw3270.install | |
| 34 | 32 | # --- end custom part for compiling |
| 35 | 33 | |
| 36 | 34 | touch build-stamp | ... | ... |
src/include/pw3270/ipcpackets.h
src/plugins/hllapi/pluginmain.c
| ... | ... | @@ -299,6 +299,11 @@ |
| 299 | 299 | ((struct hllapi_packet_addr *) source->buffer)->addr)); |
| 300 | 300 | break; |
| 301 | 301 | |
| 302 | + case HLLAPI_PACKET_QUIT: | |
| 303 | + gtk_main_quit(); | |
| 304 | + send_result(source,0); | |
| 305 | + break; | |
| 306 | + | |
| 302 | 307 | default: |
| 303 | 308 | send_result(source, EINVAL); |
| 304 | 309 | g_message("Invalid remote request (id=%d)",source->buffer[0]); | ... | ... |
src/plugins/rx3270/local.cc
| ... | ... | @@ -90,6 +90,8 @@ |
| 90 | 90 | |
| 91 | 91 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 92 | 92 | |
| 93 | + int quit(void); | |
| 94 | + | |
| 93 | 95 | private: |
| 94 | 96 | |
| 95 | 97 | const char * (*_get_version)(void); |
| ... | ... | @@ -588,3 +590,8 @@ int dynamic::popup_dialog(LIB3270_NOTIFY id , const char *title, const char *mes |
| 588 | 590 | } |
| 589 | 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 | 119 | int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 120 | 120 | char * file_chooser_dialog(GtkFileChooserAction action, const char *title, const char *extension, const char *filename); |
| 121 | 121 | |
| 122 | + int quit(void); | |
| 123 | + | |
| 122 | 124 | protected: |
| 123 | 125 | |
| 124 | 126 | private: |
| ... | ... | @@ -570,3 +572,9 @@ char * plugin::file_chooser_dialog(GtkFileChooserAction action, const char *titl |
| 570 | 572 | { |
| 571 | 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 | 86 | char * get_clipboard(void); |
| 87 | 87 | int set_clipboard(const char *text); |
| 88 | 88 | |
| 89 | + int quit(void); | |
| 90 | + | |
| 89 | 91 | private: |
| 90 | 92 | #if defined(WIN32) |
| 91 | 93 | |
| ... | ... | @@ -1215,3 +1217,28 @@ char * remote::get_clipboard(void) |
| 1215 | 1217 | |
| 1216 | 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 | 50 | |
| 51 | 51 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 52 | 52 | |
| 53 | - static rx3270 * defSession = NULL; | |
| 53 | + static rx3270 * defSession = NULL; | |
| 54 | 54 | static rx3270 * (*factory)(const char *type) = factory_default; |
| 55 | 55 | |
| 56 | 56 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| ... | ... | @@ -116,7 +116,7 @@ char * rx3270::get_revision(void) |
| 116 | 116 | return strdup(PACKAGE_REVISION); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -rx3270 * rx3270::get_default(void) | |
| 119 | +rx3270 * rx3270::get_default() | |
| 120 | 120 | { |
| 121 | 121 | if(defSession) |
| 122 | 122 | return defSession; | ... | ... |
src/plugins/rx3270/rx3270.h
| ... | ... | @@ -83,6 +83,7 @@ |
| 83 | 83 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270IsTerminalReady); |
| 84 | 84 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270queryStringAt); |
| 85 | 85 | REXX_TYPED_ROUTINE_PROTOTYPE(rx3270SetStringAt); |
| 86 | + REXX_TYPED_ROUTINE_PROTOTYPE(rx3270CloseApplication); | |
| 86 | 87 | |
| 87 | 88 | REXX_METHOD_PROTOTYPE(rx3270_method_version); |
| 88 | 89 | REXX_METHOD_PROTOTYPE(rx3270_method_revision); |
| ... | ... | @@ -202,6 +203,8 @@ |
| 202 | 203 | virtual char * get_clipboard(void); |
| 203 | 204 | virtual int set_clipboard(const char *text); |
| 204 | 205 | |
| 206 | + virtual int quit(void) = 0; | |
| 207 | + | |
| 205 | 208 | // Dialogs |
| 206 | 209 | virtual int popup_dialog(LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...); |
| 207 | 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 | 112 | REXX_TYPED_ROUTINE(rx3270IsTerminalReady, rx3270IsTerminalReady), |
| 113 | 113 | REXX_TYPED_ROUTINE(rx3270queryStringAt, rx3270queryStringAt), |
| 114 | 114 | REXX_TYPED_ROUTINE(rx3270SetStringAt, rx3270SetStringAt), |
| 115 | + REXX_TYPED_ROUTINE(rx3270CloseApplication, rx3270CloseApplication), | |
| 116 | + | |
| 115 | 117 | |
| 116 | 118 | // rx3270Popup |
| 117 | 119 | ... | ... |
src/plugins/rx3270/typed_routines.cc