From 5abb8018c3c526ea3b646308213b98c1ebec5868 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Mon, 8 Apr 2013 12:20:19 +0000 Subject: [PATCH] Corrigindo problemas na implementação de "actions" em plugins --- pw3270.cbp | 1 + src/include/pw3270/plugin.h | 16 ++++++++++------ src/plugins/dbus3270/main.c | 4 ++-- src/plugins/rx3270/pluginmain.cc | 14 ++++++++++++++ src/pw3270/main.c | 7 ++++--- src/pw3270/plugin.c | 64 +++++++++++++++++++++++++++++++++++++++++----------------------- ui/rexx.xml | 41 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 113 insertions(+), 34 deletions(-) create mode 100644 ui/rexx.xml diff --git a/pw3270.cbp b/pw3270.cbp index d9c71c0..d2863ab 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -432,6 +432,7 @@ + diff --git a/src/include/pw3270/plugin.h b/src/include/pw3270/plugin.h index 8fe3fdb..5e0abb5 100644 --- a/src/include/pw3270/plugin.h +++ b/src/include/pw3270/plugin.h @@ -40,15 +40,19 @@ extern "C" { #endif - LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window); - LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window); + LIB3270_EXPORT int pw3270_plugin_init(void); + LIB3270_EXPORT int pw3270_plugin_deinit(void); - LIB3270_EXPORT void pw3270_plugin_start(GtkWidget *window); - LIB3270_EXPORT void pw3270_plugin_stop(GtkWidget *window); + LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window); + LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window); // plugins - LIB3270_EXPORT void pw3270_init_plugins(GtkWidget *widget); - LIB3270_EXPORT void pw3270_deinit_plugins(GtkWidget *widget); + LIB3270_EXPORT void pw3270_init_plugins(void); + LIB3270_EXPORT void pw3270_deinit_plugins(void); + + LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget); + LIB3270_EXPORT void pw3270_stop_plugins(GtkWidget *widget); + LIB3270_EXPORT int pw3270_setup_plugin_action(GtkAction *action, GtkWidget *widget, const gchar *name); #ifdef __cplusplus diff --git a/src/plugins/dbus3270/main.c b/src/plugins/dbus3270/main.c index f3e0f81..c366d85 100644 --- a/src/plugins/dbus3270/main.c +++ b/src/plugins/dbus3270/main.c @@ -51,7 +51,7 @@ /*---[ Implement ]-------------------------------------------------------------------------------*/ - LIB3270_EXPORT int pw3270_plugin_init(GtkWidget *window) + LIB3270_EXPORT int pw3270_plugin_start(GtkWidget *window) { GError * error = NULL; @@ -143,7 +143,7 @@ return 0; } - LIB3270_EXPORT int pw3270_plugin_deinit(GtkWidget *window) + LIB3270_EXPORT int pw3270_plugin_stop(GtkWidget *window) { if(service_name) { diff --git a/src/plugins/rx3270/pluginmain.cc b/src/plugins/rx3270/pluginmain.cc index 4dbc536..b03861a 100644 --- a/src/plugins/rx3270/pluginmain.cc +++ b/src/plugins/rx3270/pluginmain.cc @@ -30,6 +30,7 @@ #include "rx3270.h" #include #include + #include #include #include @@ -198,3 +199,16 @@ { return lib3270_get_text(hSession,baddr,len); } + +extern "C" +{ + + LIB3270_EXPORT void pw3270_action_rexx_activated(GtkAction *action, GtkWidget *widget) + { + lib3270_trace_event(v3270_get_session(widget),"Action %s activated on widget %p",gtk_action_get_name(action),widget); + + + + } + +} diff --git a/src/pw3270/main.c b/src/pw3270/main.c index ed18047..ea08ccb 100644 --- a/src/pw3270/main.c +++ b/src/pw3270/main.c @@ -414,6 +414,7 @@ int main(int argc, char *argv[]) gtk_settings_set_string_property(settings,"gtk-menu-bar-accel","Menu",""); } + pw3270_init_plugins(); toplevel = pw3270_new(host,systype,syscolors); pw3270_set_session_name(toplevel,session_name); @@ -441,7 +442,6 @@ int main(int argc, char *argv[]) } - toplevel_setup(GTK_WINDOW(toplevel)); if(pw3270_get_toggle(toplevel,LIB3270_TOGGLE_FULL_SCREEN)) @@ -449,7 +449,7 @@ int main(int argc, char *argv[]) else pw3270_restore_window(toplevel,"toplevel"); - pw3270_init_plugins(toplevel); + pw3270_start_plugins(toplevel); gtk_window_present(GTK_WINDOW(toplevel)); #ifdef HAVE_GTKMAC @@ -458,7 +458,8 @@ int main(int argc, char *argv[]) gtk_main(); - pw3270_deinit_plugins(toplevel); + pw3270_stop_plugins(toplevel); + pw3270_deinit_plugins(); } diff --git a/src/pw3270/plugin.c b/src/pw3270/plugin.c index 4b6ad1b..91736f9 100644 --- a/src/pw3270/plugin.c +++ b/src/pw3270/plugin.c @@ -39,7 +39,7 @@ /*--[ Implement ]------------------------------------------------------------------------------------*/ - static void load(const gchar *path, GtkWidget *widget) + static void load(const gchar *path) { GDir * dir; const gchar * name; @@ -85,11 +85,11 @@ } else { - int (*init)(GtkWidget *); + int (*init)(); if(g_module_symbol(handle, "pw3270_plugin_init", (gpointer) &init)) { - if(init(widget)) + if(init()) { // Plugin init fails g_module_close(handle); @@ -104,7 +104,6 @@ else { // No plugin init warn and save it anyway - g_warning("No pw3270_plugin_init() method in %s",filename); lst = g_list_append(lst,handle); } } @@ -121,7 +120,7 @@ if(lst) { - // At least one plugin was loaded, save handle, start it + // At least one plugin was loaded, save handle GList *l = g_list_first(lst); int f; @@ -131,22 +130,15 @@ for(f=0;fdata; - l = g_list_next(l); - - if(g_module_symbol(hPlugin[f], "pw3270_plugin_start", (gpointer) &start)) - start(widget); } - g_list_free(lst); } } - LIB3270_EXPORT void pw3270_init_plugins(GtkWidget *widget) + LIB3270_EXPORT void pw3270_init_plugins(void) { #if defined( DEBUG ) @@ -165,12 +157,12 @@ if(!g_file_test(path,G_FILE_TEST_IS_DIR)) { g_free(path); - path = pw3270_build_filename(widget,"plugins",NULL); + path = pw3270_build_filename(NULL,"plugins",NULL); trace("%s using [%s]",__FUNCTION__,path); } } - load(path,widget); + load(path); g_free(path); g_free(dir); @@ -203,29 +195,48 @@ #endif } - LIB3270_EXPORT void pw3270_deinit_plugins(GtkWidget *widget) + LIB3270_EXPORT void pw3270_start_plugins(GtkWidget *widget) { - int f; + int f; - if(!hPlugin) - return; + for(f=0;f + + Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + Free Software Foundation. + + Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + obter mais detalhes. + + Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple + Place, Suite 330, Boston, MA, 02111-1307, USA + + Contatos: + + perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + licinio@bb.com.br (Licínio Luis Branco) + kraucer@bb.com.br (Kraucer Fernandes Mazuco) + +------------------------------------------------------------------------------> + + + + + + + + + + + + -- libgit2 0.21.2