Commit f2cb8889abeb77db5fa0d27505db60198cac1c88
1 parent
0d4cada2
Exists in
master
and in
5 other branches
Incluindo suporte à chamada de ações pelo nome (para uso em scripts)
Showing
17 changed files
with
154 additions
and
106 deletions
Show diff stats
pw3270.cbp
@@ -193,6 +193,9 @@ | @@ -193,6 +193,9 @@ | ||
193 | <Unit filename="src/lib3270/3270ds.h" /> | 193 | <Unit filename="src/lib3270/3270ds.h" /> |
194 | <Unit filename="src/lib3270/Makefile.in" /> | 194 | <Unit filename="src/lib3270/Makefile.in" /> |
195 | <Unit filename="src/lib3270/X11keysym.h" /> | 195 | <Unit filename="src/lib3270/X11keysym.h" /> |
196 | + <Unit filename="src/lib3270/actions.c"> | ||
197 | + <Option compilerVar="CC" /> | ||
198 | + </Unit> | ||
196 | <Unit filename="src/lib3270/ansi.c"> | 199 | <Unit filename="src/lib3270/ansi.c"> |
197 | <Option compilerVar="CC" /> | 200 | <Option compilerVar="CC" /> |
198 | </Unit> | 201 | </Unit> |
src/classlib/local.cc
@@ -158,6 +158,7 @@ | @@ -158,6 +158,7 @@ | ||
158 | int (*_erase_eof)(H3270 *hSession); | 158 | int (*_erase_eof)(H3270 *hSession); |
159 | int (*_erase_eol)(H3270 *hSession); | 159 | int (*_erase_eol)(H3270 *hSession); |
160 | int (*_erase_input)(H3270 *hSession); | 160 | int (*_erase_input)(H3270 *hSession); |
161 | + int (*_action)(H3270 *hSession, const char *name); | ||
161 | 162 | ||
162 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); | 163 | const char * (*_ebc2asc)(H3270 *hSession, unsigned char *buffer, int sz); |
163 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); | 164 | const char * (*_asc2ebc)(H3270 *hSession, unsigned char *buffer, int sz); |
@@ -223,6 +224,7 @@ | @@ -223,6 +224,7 @@ | ||
223 | { (void **) & _ebc2asc, "lib3270_ebc2asc" }, | 224 | { (void **) & _ebc2asc, "lib3270_ebc2asc" }, |
224 | { (void **) & _asc2ebc, "lib3270_asc2ebc" }, | 225 | { (void **) & _asc2ebc, "lib3270_asc2ebc" }, |
225 | 226 | ||
227 | + { (void **) & _action, "lib3270_action" }, | ||
226 | }; | 228 | }; |
227 | 229 | ||
228 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) | 230 | for(unsigned int f = 0; f < (sizeof (call) / sizeof ((call)[0]));f++) |
@@ -468,6 +470,11 @@ | @@ -468,6 +470,11 @@ | ||
468 | return _ebc2asc(hSession,str,sz); | 470 | return _ebc2asc(hSession,str,sz); |
469 | } | 471 | } |
470 | 472 | ||
473 | + int action(const char *name) | ||
474 | + { | ||
475 | + return _action(hSession,name); | ||
476 | + } | ||
477 | + | ||
471 | }; | 478 | }; |
472 | 479 | ||
473 | session * session::create_local(void) throw (std::exception) | 480 | session * session::create_local(void) throw (std::exception) |
src/classlib/remote.cc
@@ -1156,6 +1156,33 @@ | @@ -1156,6 +1156,33 @@ | ||
1156 | 1156 | ||
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | + int action(const char *str) | ||
1160 | + { | ||
1161 | + | ||
1162 | +#if defined(WIN32) | ||
1163 | + | ||
1164 | + size_t len = strlen(str); | ||
1165 | + struct hllapi_packet_text * query; | ||
1166 | + size_t cbSize = sizeof(struct hllapi_packet_text)+len; | ||
1167 | + | ||
1168 | + query = (struct hllapi_packet_text *) malloc(cbSize); | ||
1169 | + query->packet_id = HLLAPI_PACKET_ACTION; | ||
1170 | + strcpy(query->text,str); | ||
1171 | + | ||
1172 | + return query_intval((void *) query, cbSize, true); | ||
1173 | + | ||
1174 | +#elif defined(HAVE_DBUS) | ||
1175 | + | ||
1176 | + return query_intval("action", DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID); | ||
1177 | +#else | ||
1178 | + | ||
1179 | + return -1; | ||
1180 | + | ||
1181 | +#endif | ||
1182 | + | ||
1183 | + } | ||
1184 | + | ||
1185 | + | ||
1159 | int get_field_start(int baddr) | 1186 | int get_field_start(int baddr) |
1160 | { | 1187 | { |
1161 | #if defined(WIN32) | 1188 | #if defined(WIN32) |
src/include/lib3270.h
@@ -1028,6 +1028,9 @@ | @@ -1028,6 +1028,9 @@ | ||
1028 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr); | 1028 | LIB3270_EXPORT int lib3270_is_protected(H3270 *h, unsigned int baddr); |
1029 | LIB3270_EXPORT int lib3270_is_protected_at(H3270 *h, unsigned int row, unsigned int col); | 1029 | LIB3270_EXPORT int lib3270_is_protected_at(H3270 *h, unsigned int row, unsigned int col); |
1030 | 1030 | ||
1031 | + LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); | ||
1032 | + | ||
1033 | + | ||
1031 | /** | 1034 | /** |
1032 | * Alloc/Realloc memory buffer. | 1035 | * Alloc/Realloc memory buffer. |
1033 | * | 1036 | * |
src/include/pw3270/class.h
src/include/pw3270/ipcpackets.h
@@ -61,6 +61,7 @@ | @@ -61,6 +61,7 @@ | ||
61 | HLLAPI_PACKET_IS_PROTECTED, | 61 | HLLAPI_PACKET_IS_PROTECTED, |
62 | HLLAPI_PACKET_IS_PROTECTED_AT, | 62 | HLLAPI_PACKET_IS_PROTECTED_AT, |
63 | HLLAPI_PACKET_QUIT, | 63 | HLLAPI_PACKET_QUIT, |
64 | + HLLAPI_PACKET_ACTION, | ||
64 | 65 | ||
65 | HLLAPI_PACKET_SET_HOST_CHARSET, | 66 | HLLAPI_PACKET_SET_HOST_CHARSET, |
66 | HLLAPI_PACKET_GET_HOST_CHARSET, | 67 | HLLAPI_PACKET_GET_HOST_CHARSET, |
src/java/actions.cc
@@ -147,3 +147,25 @@ JNIEXPORT jint JNICALL Java_pw3270_terminal_print(JNIEnv *env, jobject obj) { | @@ -147,3 +147,25 @@ JNIEXPORT jint JNICALL Java_pw3270_terminal_print(JNIEnv *env, jobject obj) { | ||
147 | return rc; | 147 | return rc; |
148 | 148 | ||
149 | } | 149 | } |
150 | + | ||
151 | +JNIEXPORT jint JNICALL Java_pw3270_terminal_action(JNIEnv *env, jobject obj, jstring j_name) { | ||
152 | + | ||
153 | + jint rc = -1; | ||
154 | + const char * name = env->GetStringUTFChars(j_name, 0); | ||
155 | + | ||
156 | + try { | ||
157 | + | ||
158 | + rc = java::getHandle(env,obj)->action(name); | ||
159 | + | ||
160 | + } catch(std::exception &e) { | ||
161 | + | ||
162 | + env->ReleaseStringUTFChars( j_name, name); | ||
163 | + env->ThrowNew(env->FindClass("java/lang/Exception"), e.what()); | ||
164 | + return -1; | ||
165 | + | ||
166 | + } | ||
167 | + | ||
168 | + env->ReleaseStringUTFChars( j_name, name); | ||
169 | + return rc; | ||
170 | + | ||
171 | +} |
src/java/plugin.cc
src/java/terminal.java
@@ -350,6 +350,16 @@ public class terminal | @@ -350,6 +350,16 @@ public class terminal | ||
350 | public native int popup_dialog(int id, String title, String message, String secondary); | 350 | public native int popup_dialog(int id, String title, String message, String secondary); |
351 | 351 | ||
352 | /** | 352 | /** |
353 | + * Launch a lib3270 action by name. | ||
354 | + * | ||
355 | + * @param name Name of the action to fire. | ||
356 | + * | ||
357 | + * @return Return code of the action call. | ||
358 | + * | ||
359 | + */ | ||
360 | + public native int action(String name); | ||
361 | + | ||
362 | + /** | ||
353 | * File selection dialog. | 363 | * File selection dialog. |
354 | * | 364 | * |
355 | * @param action Dialog action. | 365 | * @param action Dialog action. |
src/lib3270/actions.c
@@ -18,122 +18,67 @@ | @@ -18,122 +18,67 @@ | ||
18 | * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple |
19 | * Place, Suite 330, Boston, MA, 02111-1307, USA | 19 | * Place, Suite 330, Boston, MA, 02111-1307, USA |
20 | * | 20 | * |
21 | - * Este programa está nomeado como actions.c e possui 877 linhas de código. | 21 | + * Este programa está nomeado como actions.c e possui - linhas de código. |
22 | * | 22 | * |
23 | * Contatos: | 23 | * Contatos: |
24 | * | 24 | * |
25 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | 25 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) |
26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
27 | - * licinio@bb.com.br (Licínio Luis Branco) | ||
28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | ||
29 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | ||
30 | * | 27 | * |
31 | */ | 28 | */ |
32 | 29 | ||
33 | -/* | ||
34 | - * actions.c | ||
35 | - * The X actions table and action debugging code. | ||
36 | - */ | ||
37 | - | ||
38 | #include "globals.h" | 30 | #include "globals.h" |
39 | -#include "appres.h" | 31 | +#include <lib3270/trace.h> |
40 | 32 | ||
41 | -#include "actionsc.h" | ||
42 | -#include "hostc.h" | ||
43 | -#include "kybdc.h" | ||
44 | -#include "popupsc.h" | ||
45 | -#include "printc.h" | ||
46 | -#include "resources.h" | ||
47 | -#include "togglesc.h" | ||
48 | -#include "trace_dsc.h" | ||
49 | -#include "utilc.h" | ||
50 | -#include "xioc.h" | 33 | +/*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
51 | 34 | ||
52 | -#if defined(X3270_FT) /*[*/ | ||
53 | -#include "ftc.h" | ||
54 | -#endif /*]*/ | ||
55 | -// #if defined(X3270_DISPLAY) | ||
56 | -// #include "keypadc.h" | ||
57 | -//#endif | ||
58 | -#if defined(X3270_DISPLAY) || defined(C3270) || defined(WC3270) /*[*/ | ||
59 | -#include "screenc.h" | ||
60 | -#endif /*]*/ | 35 | +/*---[ Statics ]--------------------------------------------------------------------------------------------------------------*/ |
61 | 36 | ||
62 | -#error Deprecated | 37 | +/*---[ Implement ]------------------------------------------------------------------------------------------------------------*/ |
63 | 38 | ||
64 | -/* | 39 | +/** |
40 | + * @brief Launch an action by name. | ||
41 | + * | ||
42 | + */ | ||
43 | +LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) | ||
44 | +{ | ||
45 | + #undef DECLARE_LIB3270_ACTION | ||
46 | + #undef DECLARE_LIB3270_CLEAR_SELECTION_ACTION | ||
47 | + #undef DECLARE_LIB3270_KEY_ACTION | ||
48 | + #undef DECLARE_LIB3270_CURSOR_ACTION | ||
49 | + #undef DECLARE_LIB3270_FKEY_ACTION | ||
65 | 50 | ||
66 | -#if defined(X3270_DISPLAY) | ||
67 | -#include <X11/keysym.h> | 51 | + #define DECLARE_LIB3270_ACTION( name ) { #name, lib3270_ ## name }, |
52 | + #define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name ) { #name, lib3270_ ## name }, | ||
53 | + #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name }, | ||
54 | + #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name }, | ||
55 | + #define DECLARE_LIB3270_FKEY_ACTION( name ) // name | ||
68 | 56 | ||
69 | -#define MODMAP_SIZE 8 | ||
70 | -#define MAP_SIZE 13 | ||
71 | -#define MAX_MODS_PER 4 | ||
72 | -static struct { | ||
73 | - const char *name[MAX_MODS_PER]; | ||
74 | - unsigned int mask; | ||
75 | - Boolean is_meta; | ||
76 | -} skeymask[MAP_SIZE] = { | ||
77 | - { { "Shift" }, ShiftMask, False }, | ||
78 | - { { (char *)NULL } //, LockMask, False }, | ||
79 | - { { "Ctrl" }, ControlMask, False }, | ||
80 | - { { CN }, Mod1Mask, False }, | ||
81 | - { { CN }, Mod2Mask, False }, | ||
82 | - { { CN }, Mod3Mask, False }, | ||
83 | - { { CN }, Mod4Mask, False }, | ||
84 | - { { CN }, Mod5Mask, False }, | ||
85 | - { { "Button1" }, Button1Mask, False }, | ||
86 | - { { "Button2" }, Button2Mask, False }, | ||
87 | - { { "Button3" }, Button3Mask, False }, | ||
88 | - { { "Button4" }, Button4Mask, False }, | ||
89 | - { { "Button5" }, Button5Mask, False } | ||
90 | -}; | ||
91 | -static Boolean know_mods = False; | ||
92 | -#endif */ | 57 | + static const struct _action |
58 | + { | ||
59 | + const char * name; | ||
60 | + int (*call)(H3270 *h); | ||
61 | + } action[] = | ||
62 | + { | ||
63 | + #include <lib3270/action_table.h> | ||
64 | + }; | ||
93 | 65 | ||
94 | -/* Actions that are aliases for other actions. */ | ||
95 | -/* | ||
96 | -static char *aliased_actions[] = { | ||
97 | - "Close", "HardPrint", "Open", NULL | ||
98 | -}; | ||
99 | -*/ | 66 | + size_t f; |
100 | 67 | ||
101 | -/* | ||
102 | -enum iaction ia_cause; | ||
103 | -const char *ia_name[] = { | ||
104 | - "String", "Paste", "Screen redraw", "Keypad", "Default", "Key", | ||
105 | - "Macro", "Script", "Peek", "Typeahead", "File transfer", "Command", | ||
106 | - "Keymap", "Idle" | ||
107 | -}; | ||
108 | -*/ | 68 | + CHECK_SESSION_HANDLE(hSession); |
109 | 69 | ||
110 | -/* | ||
111 | - * Return a name for an action. | ||
112 | - */ /* | ||
113 | -const char * action_name(XtActionProc action) | ||
114 | -{ | ||
115 | - // TODO (perry#1#): Remove all calls to action_name; move all action processing to main program. | ||
116 | - return "Action"; | ||
117 | -} | ||
118 | -*/ | ||
119 | -/* | ||
120 | - * Check the number of argument to an action, and possibly pop up a usage | ||
121 | - * message. | ||
122 | - * | ||
123 | - * Returns 0 if the argument count is correct, -1 otherwise. | ||
124 | - */ /* | ||
125 | -int | ||
126 | -check_usage(XtActionProc action, Cardinal nargs, Cardinal nargs_min, | ||
127 | - Cardinal nargs_max) | ||
128 | -{ | ||
129 | - if (nargs >= nargs_min && nargs <= nargs_max) | ||
130 | - return 0; | ||
131 | - if (nargs_min == nargs_max) | ||
132 | - popup_an_error("Action requires %d argument%s",action, nargs_min, nargs_min == 1 ? "" : "s"); | ||
133 | - else | ||
134 | - popup_an_error("Action requires %d or %d arguments",nargs_min, nargs_max); | ||
135 | -// cancel_if_idle_command(); | ||
136 | - return -1; | ||
137 | -} */ | 70 | + for(f=0; f< (sizeof(action)/sizeof(action[0])); f++) |
71 | + { | ||
72 | + if(!strcasecmp(name,action[f].name)) | ||
73 | + { | ||
74 | + lib3270_trace_event(hSession,"Action %s activated\n",name); | ||
75 | + return action[f].call(hSession); | ||
76 | + } | ||
77 | + | ||
78 | + } | ||
138 | 79 | ||
80 | + lib3270_trace_event(hSession,"Unknown action %s\n",name); | ||
81 | + errno = ENOENT; | ||
82 | + return -1; | ||
139 | 83 | ||
84 | +} |
src/lib3270/sources.mak
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | TERMINAL_SOURCES = bounds.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ | 28 | TERMINAL_SOURCES = bounds.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ |
29 | host.c sf.c ansi.c resolver.c charset.c \ | 29 | host.c sf.c ansi.c resolver.c charset.c \ |
30 | version.c session.c state.c html.c trace_ds.c see.c \ | 30 | version.c session.c state.c html.c trace_ds.c see.c \ |
31 | - paste.c ssl.c | 31 | + paste.c ssl.c actions.c |
32 | 32 | ||
33 | # tables.c utf8.c | 33 | # tables.c utf8.c |
34 | 34 |
src/plugins/dbus3270/gobject.c
@@ -430,9 +430,14 @@ void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *cont | @@ -430,9 +430,14 @@ void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *cont | ||
430 | dbus_g_method_return(context,lib3270_get_is_protected_at(pw3270_dbus_get_session_handle(object),row,col)); | 430 | dbus_g_method_return(context,lib3270_get_is_protected_at(pw3270_dbus_get_session_handle(object),row,col)); |
431 | } | 431 | } |
432 | 432 | ||
433 | + void pw3270_dbus_action(PW3270Dbus *object, const gchar *text, DBusGMethodInvocation *context) | ||
434 | + { | ||
435 | + trace("%s object=%p context=%p",__FUNCTION__,object,context); | ||
436 | + dbus_g_method_return(context,lib3270_action(pw3270_dbus_get_session_handle(object),text)); | ||
437 | + } | ||
433 | 438 | ||
434 | -void pw3270_dbus_get_clipboard(PW3270Dbus *object, DBusGMethodInvocation *context) | ||
435 | -{ | 439 | + void pw3270_dbus_get_clipboard(PW3270Dbus *object, DBusGMethodInvocation *context) |
440 | + { | ||
436 | gchar *text; | 441 | gchar *text; |
437 | 442 | ||
438 | trace("%s object=%p context=%p",__FUNCTION__,object,context); | 443 | trace("%s object=%p context=%p",__FUNCTION__,object,context); |
src/plugins/dbus3270/pw3270dbus.xml
@@ -197,6 +197,12 @@ | @@ -197,6 +197,12 @@ | ||
197 | <arg type="s" name="to" direction="out" /> | 197 | <arg type="s" name="to" direction="out" /> |
198 | </method> | 198 | </method> |
199 | 199 | ||
200 | + <method name="action"> | ||
201 | + <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | ||
202 | + <arg type="s" name="name" direction="in" /> | ||
203 | + <arg type="i" name="result" direction="out" /> | ||
204 | + </method> | ||
205 | + | ||
200 | <method name="filetransfer"> | 206 | <method name="filetransfer"> |
201 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> | 207 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/> |
202 | <arg type="s" name="local" direction="in" /> | 208 | <arg type="s" name="local" direction="in" /> |
src/plugins/dbus3270/service.h
@@ -90,13 +90,15 @@ | @@ -90,13 +90,15 @@ | ||
90 | void pw3270_dbus_get_field_length(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context); | 90 | void pw3270_dbus_get_field_length(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context); |
91 | void pw3270_dbus_get_next_unprotected(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context); | 91 | void pw3270_dbus_get_next_unprotected(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context); |
92 | 92 | ||
93 | - void pw3270_dbus_get_is_protected(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context); | 93 | + void pw3270_dbus_get_is_protected(PW3270Dbus *object, int baddr, DBusGMethodInvocation *context); |
94 | void pw3270_dbus_get_is_protected_at(PW3270Dbus *object, int row, int col, DBusGMethodInvocation *context); | 94 | void pw3270_dbus_get_is_protected_at(PW3270Dbus *object, int row, int col, DBusGMethodInvocation *context); |
95 | 95 | ||
96 | void pw3270_dbus_set_script(PW3270Dbus *object, const gchar *text, int mode, DBusGMethodInvocation *context); | 96 | void pw3270_dbus_set_script(PW3270Dbus *object, const gchar *text, int mode, DBusGMethodInvocation *context); |
97 | 97 | ||
98 | void pw3270_dbus_show_popup(PW3270Dbus *object, int id, const gchar *title, const gchar *msg, const gchar *text, DBusGMethodInvocation *context); | 98 | void pw3270_dbus_show_popup(PW3270Dbus *object, int id, const gchar *title, const gchar *msg, const gchar *text, DBusGMethodInvocation *context); |
99 | 99 | ||
100 | + void pw3270_dbus_action(PW3270Dbus *object, const gchar *text, DBusGMethodInvocation *context); | ||
101 | + | ||
100 | // Actions | 102 | // Actions |
101 | void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context); | 103 | void pw3270_dbus_enter(PW3270Dbus *object, DBusGMethodInvocation *context); |
102 | void pw3270_dbus_pf_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context); | 104 | void pw3270_dbus_pf_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context); |
src/plugins/hllapi/pluginmain.c
@@ -386,6 +386,12 @@ | @@ -386,6 +386,12 @@ | ||
386 | send_text(source,(char *) lib3270_get_host_charset(lib3270_get_default_session_handle())); | 386 | send_text(source,(char *) lib3270_get_host_charset(lib3270_get_default_session_handle())); |
387 | break; | 387 | break; |
388 | 388 | ||
389 | + case HLLAPI_PACKET_ACTION: | ||
390 | + send_result(source,lib3270_action(lib3270_get_default_session_handle(), | ||
391 | + (const char *) ((struct hllapi_packet_text *) source->buffer)->text); | ||
392 | + break; | ||
393 | + | ||
394 | + | ||
389 | default: | 395 | default: |
390 | send_result(source, EINVAL); | 396 | send_result(source, EINVAL); |
391 | g_message("Invalid remote request (id=%d)",source->buffer[0]); | 397 | g_message("Invalid remote request (id=%d)",source->buffer[0]); |
src/plugins/rx3270/pluginmain.cc
@@ -148,6 +148,7 @@ | @@ -148,6 +148,7 @@ | ||
148 | int file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096); | 148 | int file_transfer(LIB3270_FT_OPTION options, const gchar *local, const gchar *remote, int lrecl = 0, int blksize = 0, int primspace = 0, int secspace = 0, int dft = 4096); |
149 | 149 | ||
150 | int quit(void); | 150 | int quit(void); |
151 | + int action(const char *name); | ||
151 | 152 | ||
152 | protected: | 153 | protected: |
153 | 154 | ||
@@ -766,6 +767,11 @@ int plugin::quit(void) | @@ -766,6 +767,11 @@ int plugin::quit(void) | ||
766 | return 0; | 767 | return 0; |
767 | } | 768 | } |
768 | 769 | ||
770 | +int plugin::action(const char *name) | ||
771 | +{ | ||
772 | + return lib3270_action(hSession,name); | ||
773 | +} | ||
774 | + | ||
769 | int plugin::set_host_charset(const char *charset) | 775 | int plugin::set_host_charset(const char *charset) |
770 | { | 776 | { |
771 | return lib3270_set_host_charset(hSession,charset); | 777 | return lib3270_set_host_charset(hSession,charset); |
src/pw3270/actions.c
@@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
57 | 57 | ||
58 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 58 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
59 | 59 | ||
60 | -static void lib3270_action(GtkAction *action, GtkWidget *widget) | 60 | +static void do_lib3270_action(GtkAction *action, GtkWidget *widget) |
61 | { | 61 | { |
62 | int (*call)(H3270 *h) = (int (*)(H3270 *h)) g_object_get_data(G_OBJECT(action),"lib3270_call"); | 62 | int (*call)(H3270 *h) = (int (*)(H3270 *h)) g_object_get_data(G_OBJECT(action),"lib3270_call"); |
63 | 63 | ||
@@ -270,7 +270,7 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const | @@ -270,7 +270,7 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const | ||
270 | if(!g_ascii_strcasecmp(name,lib3270_entry[f].name)) | 270 | if(!g_ascii_strcasecmp(name,lib3270_entry[f].name)) |
271 | { | 271 | { |
272 | g_object_set_data(G_OBJECT(action),"lib3270_call",lib3270_entry[f].call); | 272 | g_object_set_data(G_OBJECT(action),"lib3270_call",lib3270_entry[f].call); |
273 | - g_signal_connect(action,"activate",G_CALLBACK(lib3270_action),widget); | 273 | + g_signal_connect(action,"activate",G_CALLBACK(do_lib3270_action),widget); |
274 | return; | 274 | return; |
275 | } | 275 | } |
276 | } | 276 | } |
@@ -834,7 +834,7 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash | @@ -834,7 +834,7 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash | ||
834 | case ACTION_TYPE_LIB3270: | 834 | case ACTION_TYPE_LIB3270: |
835 | action = new_action(nm,names,values); | 835 | action = new_action(nm,names,values); |
836 | g_object_set_data(G_OBJECT(action),"lib3270_call",callback[id]); | 836 | g_object_set_data(G_OBJECT(action),"lib3270_call",callback[id]); |
837 | - g_signal_connect(action,"activate",G_CALLBACK(lib3270_action),widget); | 837 | + g_signal_connect(action,"activate",G_CALLBACK(do_lib3270_action),widget); |
838 | break; | 838 | break; |
839 | 839 | ||
840 | case ACTION_TYPE_STRING: | 840 | case ACTION_TYPE_STRING: |