Commit 2535b69d700647bb43cc981729b49e031f11529b
1 parent
05b2041e
Exists in
master
and in
5 other branches
Incluindo opção para definir manualmente o caminho dos plugins
Showing
3 changed files
with
19 additions
and
11 deletions
Show diff stats
src/include/pw3270/plugin.h
@@ -47,8 +47,8 @@ | @@ -47,8 +47,8 @@ | ||
47 | LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window); | 47 | LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window); |
48 | 48 | ||
49 | // plugins | 49 | // plugins |
50 | - LIB3270_EXPORT void pw3270_init_plugins(void); | ||
51 | - LIB3270_EXPORT void pw3270_deinit_plugins(void); | 50 | + LIB3270_EXPORT void pw3270_load_plugins(const gchar *path); |
51 | + LIB3270_EXPORT void pw3270_unload_plugins(void); | ||
52 | 52 | ||
53 | LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget); | 53 | LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget); |
54 | LIB3270_EXPORT void pw3270_stop_plugins(GtkWidget *widget); | 54 | LIB3270_EXPORT void pw3270_stop_plugins(GtkWidget *widget); |
src/pw3270/main.c
@@ -52,17 +52,18 @@ | @@ -52,17 +52,18 @@ | ||
52 | 52 | ||
53 | /*--[ Statics ]--------------------------------------------------------------------------------------*/ | 53 | /*--[ Statics ]--------------------------------------------------------------------------------------*/ |
54 | 54 | ||
55 | - static GtkWidget * toplevel = NULL; | ||
56 | - static GtkWidget * trace_window = NULL; | ||
57 | - static unsigned int syscolors = 16; | ||
58 | - static unsigned int timer = 0; | 55 | + static GtkWidget * toplevel = NULL; |
56 | + static GtkWidget * trace_window = NULL; | ||
57 | + static unsigned int syscolors = 16; | ||
58 | + static unsigned int timer = 0; | ||
59 | static const gchar * systype = NULL; | 59 | static const gchar * systype = NULL; |
60 | static const gchar * toggleset = NULL; | 60 | static const gchar * toggleset = NULL; |
61 | static const gchar * togglereset = NULL; | 61 | static const gchar * togglereset = NULL; |
62 | - static const gchar * logfile = NULL; | 62 | + static const gchar * logfile = NULL; |
63 | static const gchar * tracefile = NULL; | 63 | static const gchar * tracefile = NULL; |
64 | static const gchar * charset = NULL; | 64 | static const gchar * charset = NULL; |
65 | static const gchar * model = NULL; | 65 | static const gchar * model = NULL; |
66 | + static const gchar * pluginpath = NULL; | ||
66 | 67 | ||
67 | #ifdef HAVE_GTKMAC | 68 | #ifdef HAVE_GTKMAC |
68 | GtkOSXApplication * osxapp = NULL; | 69 | GtkOSXApplication * osxapp = NULL; |
@@ -410,6 +411,7 @@ int main(int argc, char *argv[]) | @@ -410,6 +411,7 @@ int main(int argc, char *argv[]) | ||
410 | { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, | 411 | { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, |
411 | { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, | 412 | { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, |
412 | { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, | 413 | { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, |
414 | + { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, | ||
413 | 415 | ||
414 | #if defined( HAVE_SYSLOG ) | 416 | #if defined( HAVE_SYSLOG ) |
415 | { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, | 417 | { "syslog", 'l', 0, G_OPTION_ARG_NONE, &log_to_syslog, N_( "Send messages to syslog" ), NULL }, |
@@ -522,7 +524,7 @@ int main(int argc, char *argv[]) | @@ -522,7 +524,7 @@ int main(int argc, char *argv[]) | ||
522 | gtk_settings_set_string_property(settings,"gtk-menu-bar-accel","Menu",""); | 524 | gtk_settings_set_string_property(settings,"gtk-menu-bar-accel","Menu",""); |
523 | } | 525 | } |
524 | 526 | ||
525 | - pw3270_init_plugins(); | 527 | + pw3270_load_plugins(pluginpath); |
526 | toplevel = pw3270_new(host,systype,syscolors); | 528 | toplevel = pw3270_new(host,systype,syscolors); |
527 | pw3270_set_session_name(toplevel,session_name); | 529 | pw3270_set_session_name(toplevel,session_name); |
528 | 530 | ||
@@ -579,7 +581,7 @@ int main(int argc, char *argv[]) | @@ -579,7 +581,7 @@ int main(int argc, char *argv[]) | ||
579 | gtk_widget_destroy(trace_window); | 581 | gtk_widget_destroy(trace_window); |
580 | 582 | ||
581 | pw3270_stop_plugins(toplevel); | 583 | pw3270_stop_plugins(toplevel); |
582 | - pw3270_deinit_plugins(); | 584 | + pw3270_unload_plugins(); |
583 | 585 | ||
584 | } | 586 | } |
585 | 587 |
src/pw3270/plugin.c
@@ -159,8 +159,14 @@ | @@ -159,8 +159,14 @@ | ||
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | - LIB3270_EXPORT void pw3270_init_plugins(void) | 162 | + LIB3270_EXPORT void pw3270_load_plugins(const gchar *p) |
163 | { | 163 | { |
164 | + if(p) | ||
165 | + { | ||
166 | + load(p); | ||
167 | + return; | ||
168 | + } | ||
169 | + | ||
164 | #if defined( DEBUG ) | 170 | #if defined( DEBUG ) |
165 | 171 | ||
166 | gchar * dir = g_get_current_dir(); | 172 | gchar * dir = g_get_current_dir(); |
@@ -244,7 +250,7 @@ | @@ -244,7 +250,7 @@ | ||
244 | 250 | ||
245 | } | 251 | } |
246 | 252 | ||
247 | - LIB3270_EXPORT void pw3270_deinit_plugins(void) | 253 | + LIB3270_EXPORT void pw3270_unload_plugins(void) |
248 | { | 254 | { |
249 | int f; | 255 | int f; |
250 | 256 |