Commit 972dc709cc642ff543bc8cc6bb6cf9e72e1a2120
1 parent
07b92b46
Exists in
master
and in
5 other branches
Ajustando plugin rexx para o novo formato
Showing
4 changed files
with
15 additions
and
8 deletions
Show diff stats
src/include/pw3270/class.h
... | ... | @@ -130,6 +130,7 @@ |
130 | 130 | static session * start(const char *name = 0); |
131 | 131 | static session * create(const char *name = 0) throw (std::exception); |
132 | 132 | static session * create_local(H3270 *hSession) throw (std::exception); |
133 | + static session * create_local() throw (std::exception); | |
133 | 134 | |
134 | 135 | static session * get_default(void); |
135 | 136 | static bool has_default(void); |
... | ... | @@ -273,7 +274,6 @@ |
273 | 274 | static session * (*factory)(const char *name); |
274 | 275 | |
275 | 276 | static session * create_remote(const char *name) throw (std::exception); |
276 | - static session * create_local(void) throw (std::exception); | |
277 | 277 | |
278 | 278 | #ifdef HAVE_ICONV |
279 | 279 | iconv_t conv2Local; | ... | ... |
src/plugins/rx3270/pluginmain.cc
... | ... | @@ -395,10 +395,6 @@ extern "C" |
395 | 395 | |
396 | 396 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
397 | 397 | |
398 | - static session * factory(const char *name) | |
399 | - { | |
400 | - return session::create_local(lib3270_get_default_session_handle()); | |
401 | - } | |
402 | 398 | |
403 | 399 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) |
404 | 400 | { |
... | ... | @@ -407,7 +403,7 @@ extern "C" |
407 | 403 | g_mutex_init(&mutex); |
408 | 404 | #endif // GTK_CHECK_VERSION |
409 | 405 | |
410 | - rx3270_set_factory_method(factory); | |
406 | + rx3270_set_session(lib3270_get_default_session_handle()); | |
411 | 407 | |
412 | 408 | return 0; |
413 | 409 | } | ... | ... |
src/plugins/rx3270/rx3270.h
... | ... | @@ -151,7 +151,7 @@ |
151 | 151 | #endif |
152 | 152 | |
153 | 153 | LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option); |
154 | - LIB3270_EXPORT void rx3270_set_factory_method(PW3270_NAMESPACE::session * (*)(const char *)); | |
154 | + LIB3270_EXPORT void rx3270_set_session(H3270 *hSession); | |
155 | 155 | |
156 | 156 | #ifdef __cplusplus |
157 | 157 | } | ... | ... |
src/plugins/rx3270/rxapimain.cc
... | ... | @@ -47,10 +47,21 @@ |
47 | 47 | |
48 | 48 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
49 | 49 | |
50 | + static H3270 * default_session = NULL; | |
51 | + | |
50 | 52 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
51 | 53 | |
52 | -void rx3270_set_factory_method(PW3270_NAMESPACE::session * (* factory)(const char *)) | |
54 | +static PW3270_NAMESPACE::session * factory(const char *name) | |
55 | +{ | |
56 | + if(!default_session) | |
57 | + return PW3270_NAMESPACE::session::create_local(); | |
58 | + | |
59 | + return PW3270_NAMESPACE::session::create_local(default_session); | |
60 | +} | |
61 | + | |
62 | +void rx3270_set_session(H3270 *session) | |
53 | 63 | { |
64 | + default_session = session; | |
54 | 65 | PW3270_NAMESPACE::session::set_plugin(factory); |
55 | 66 | } |
56 | 67 | ... | ... |