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,6 +130,7 @@ | ||
130 | static session * start(const char *name = 0); | 130 | static session * start(const char *name = 0); |
131 | static session * create(const char *name = 0) throw (std::exception); | 131 | static session * create(const char *name = 0) throw (std::exception); |
132 | static session * create_local(H3270 *hSession) throw (std::exception); | 132 | static session * create_local(H3270 *hSession) throw (std::exception); |
133 | + static session * create_local() throw (std::exception); | ||
133 | 134 | ||
134 | static session * get_default(void); | 135 | static session * get_default(void); |
135 | static bool has_default(void); | 136 | static bool has_default(void); |
@@ -273,7 +274,6 @@ | @@ -273,7 +274,6 @@ | ||
273 | static session * (*factory)(const char *name); | 274 | static session * (*factory)(const char *name); |
274 | 275 | ||
275 | static session * create_remote(const char *name) throw (std::exception); | 276 | static session * create_remote(const char *name) throw (std::exception); |
276 | - static session * create_local(void) throw (std::exception); | ||
277 | 277 | ||
278 | #ifdef HAVE_ICONV | 278 | #ifdef HAVE_ICONV |
279 | iconv_t conv2Local; | 279 | iconv_t conv2Local; |
src/plugins/rx3270/pluginmain.cc
@@ -395,10 +395,6 @@ extern "C" | @@ -395,10 +395,6 @@ extern "C" | ||
395 | 395 | ||
396 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 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 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) | 399 | LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window, GtkWidget *terminal) |
404 | { | 400 | { |
@@ -407,7 +403,7 @@ extern "C" | @@ -407,7 +403,7 @@ extern "C" | ||
407 | g_mutex_init(&mutex); | 403 | g_mutex_init(&mutex); |
408 | #endif // GTK_CHECK_VERSION | 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 | return 0; | 408 | return 0; |
413 | } | 409 | } |
src/plugins/rx3270/rx3270.h
@@ -151,7 +151,7 @@ | @@ -151,7 +151,7 @@ | ||
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | LIB3270_EXPORT void rx3270_set_package_option(RexxOption *option); | 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 | #ifdef __cplusplus | 156 | #ifdef __cplusplus |
157 | } | 157 | } |
src/plugins/rx3270/rxapimain.cc
@@ -47,10 +47,21 @@ | @@ -47,10 +47,21 @@ | ||
47 | 47 | ||
48 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | 48 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
49 | 49 | ||
50 | + static H3270 * default_session = NULL; | ||
51 | + | ||
50 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 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 | PW3270_NAMESPACE::session::set_plugin(factory); | 65 | PW3270_NAMESPACE::session::set_plugin(factory); |
55 | } | 66 | } |
56 | 67 |