From 2535b69d700647bb43cc981729b49e031f11529b Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 21 Aug 2014 16:13:31 +0000 Subject: [PATCH] Incluindo opção para definir manualmente o caminho dos plugins --- src/include/pw3270/plugin.h | 4 ++-- src/pw3270/main.c | 16 +++++++++------- src/pw3270/plugin.c | 10 ++++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/include/pw3270/plugin.h b/src/include/pw3270/plugin.h index 5e0abb5..88d7021 100644 --- a/src/include/pw3270/plugin.h +++ b/src/include/pw3270/plugin.h @@ -47,8 +47,8 @@ LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window); // plugins - LIB3270_EXPORT void pw3270_init_plugins(void); - LIB3270_EXPORT void pw3270_deinit_plugins(void); + LIB3270_EXPORT void pw3270_load_plugins(const gchar *path); + LIB3270_EXPORT void pw3270_unload_plugins(void); LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget); LIB3270_EXPORT void pw3270_stop_plugins(GtkWidget *widget); diff --git a/src/pw3270/main.c b/src/pw3270/main.c index a4a603b..80cc411 100644 --- a/src/pw3270/main.c +++ b/src/pw3270/main.c @@ -52,17 +52,18 @@ /*--[ Statics ]--------------------------------------------------------------------------------------*/ - static GtkWidget * toplevel = NULL; - static GtkWidget * trace_window = NULL; - static unsigned int syscolors = 16; - static unsigned int timer = 0; + static GtkWidget * toplevel = NULL; + static GtkWidget * trace_window = NULL; + static unsigned int syscolors = 16; + static unsigned int timer = 0; static const gchar * systype = NULL; static const gchar * toggleset = NULL; static const gchar * togglereset = NULL; - static const gchar * logfile = NULL; + static const gchar * logfile = NULL; static const gchar * tracefile = NULL; static const gchar * charset = NULL; static const gchar * model = NULL; + static const gchar * pluginpath = NULL; #ifdef HAVE_GTKMAC GtkOSXApplication * osxapp = NULL; @@ -410,6 +411,7 @@ int main(int argc, char *argv[]) { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, + { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, #if defined( HAVE_SYSLOG ) { "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[]) gtk_settings_set_string_property(settings,"gtk-menu-bar-accel","Menu",""); } - pw3270_init_plugins(); + pw3270_load_plugins(pluginpath); toplevel = pw3270_new(host,systype,syscolors); pw3270_set_session_name(toplevel,session_name); @@ -579,7 +581,7 @@ int main(int argc, char *argv[]) gtk_widget_destroy(trace_window); pw3270_stop_plugins(toplevel); - pw3270_deinit_plugins(); + pw3270_unload_plugins(); } diff --git a/src/pw3270/plugin.c b/src/pw3270/plugin.c index 4e4aef0..3e4a83a 100644 --- a/src/pw3270/plugin.c +++ b/src/pw3270/plugin.c @@ -159,8 +159,14 @@ } - LIB3270_EXPORT void pw3270_init_plugins(void) + LIB3270_EXPORT void pw3270_load_plugins(const gchar *p) { + if(p) + { + load(p); + return; + } + #if defined( DEBUG ) gchar * dir = g_get_current_dir(); @@ -244,7 +250,7 @@ } - LIB3270_EXPORT void pw3270_deinit_plugins(void) + LIB3270_EXPORT void pw3270_unload_plugins(void) { int f; -- libgit2 0.21.2