diff --git a/src/include/pw3270/application.h b/src/include/pw3270/application.h index 134ba17..0fdecd3 100644 --- a/src/include/pw3270/application.h +++ b/src/include/pw3270/application.h @@ -73,6 +73,10 @@ // Plugins void pw3270_application_plugin_foreach(GApplication *app, GFunc func, gpointer user_data); + + /// @brief Call plugin method. + void pw3270_application_plugin_call(GApplication *app, const gchar *method, gpointer user_data); + GSList * pw3270_application_get_plugins(GApplication *app); // Tools diff --git a/src/objects/application/actions/about.c b/src/objects/application/actions/about.c index 3ab0bdb..c50a809 100644 --- a/src/objects/application/actions/about.c +++ b/src/objects/application/actions/about.c @@ -33,22 +33,6 @@ static GtkWidget * factory(PW3270Action G_GNUC_UNUSED(*action), GtkApplication G_GNUC_UNUSED(*application)) { - /* - static const gchar *license = - N_( "This program is free software; you can redistribute it and/or " - "modify it under the terms of the GNU General Public License as " - "published by the Free Software Foundation; either version 2 of the " - "License, or (at your option) any later version.\n\n" - "This program is distributed in the hope that it will be useful, " - "but WITHOUT ANY WARRANTY; without even the implied warranty of " - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " - "GNU General Public License for more details.\n\n" - "You should have received a copy of the GNU General Public License " - "along with this program; if not, write to the Free Software " - "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 " - "USA" ); - */ - GtkAboutDialog * dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); // Get application logo @@ -126,7 +110,6 @@ gtk_about_dialog_add_credit_section(dialog, _("Apple version"), apple); gtk_about_dialog_add_credit_section (dialog, _("Contributors"), contributors); - gtk_about_dialog_add_credit_section(dialog, _("Based on X3270 from"), references); } @@ -141,7 +124,6 @@ gtk_about_dialog_set_website(dialog,"https://portal.softwarepublico.gov.br/social/pw3270/"); gtk_about_dialog_set_website_label(dialog,_( "Brazilian Public Software Portal" )); -// gtk_about_dialog_set_authors(dialog,authors); gtk_about_dialog_set_translator_credits(dialog,_("translator-credits")); gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); @@ -149,6 +131,13 @@ g_signal_connect(dialog,"response",G_CALLBACK(gtk_widget_destroy),NULL); gtk_widget_show_all(GTK_WIDGET(dialog)); + // Call plugins + pw3270_application_plugin_call( + g_application_get_default(), + "pw3270_plugin_set_about_dialog", + dialog + ); + return GTK_WIDGET(dialog); } diff --git a/src/objects/application/actions/preferences.c b/src/objects/application/actions/preferences.c index 56c388c..556d5a0 100644 --- a/src/objects/application/actions/preferences.c +++ b/src/objects/application/actions/preferences.c @@ -55,6 +55,12 @@ gtk_container_add(GTK_CONTAINER(dialog),pages[ix]); } + pw3270_application_plugin_call( + G_APPLICATION(application), + "pw3270_plugin_set_application_preferences", + dialog + ); + gtk_widget_show_all(dialog); return dialog; diff --git a/src/objects/application/actions/window.c b/src/objects/application/actions/window.c index 6a32e5c..9e23b81 100644 --- a/src/objects/application/actions/window.c +++ b/src/objects/application/actions/window.c @@ -69,7 +69,7 @@ return G_ACTION(action); } - static void new_tab_activated(GAction *action, GVariant *parameter, GtkApplication *application) { + static void new_tab_activated(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkApplication *application) { debug("%s",__FUNCTION__); pw3270_application_window_new_tab(GTK_WIDGET(gtk_application_get_active_window(GTK_APPLICATION(application))), NULL); diff --git a/src/objects/application/application.c b/src/objects/application/application.c index 9cb29ad..efae5c3 100644 --- a/src/objects/application/application.c +++ b/src/objects/application/application.c @@ -466,6 +466,33 @@ } + void pw3270_application_plugin_foreach(GApplication *app, GFunc func, gpointer user_data) { + + g_return_if_fail(PW3270_IS_APPLICATION(app)); + + GSList * item; + for(item = PW3270_APPLICATION(app)->plugins; item; item = g_slist_next(item)) { + func(item->data,user_data); + } + + } + + void pw3270_application_plugin_call(GApplication *app, const gchar *method, gpointer user_data) { + + g_return_if_fail(PW3270_IS_APPLICATION(app)); + + int (*call)(GtkWidget *); + + GSList * item; + for(item = PW3270_APPLICATION(app)->plugins; item; item = g_slist_next(item)) { + if(g_module_symbol((GModule *) item->data, method, (gpointer *) &call)) { + call(user_data); + } + } + + } + + GSettings * pw3270_application_settings_new() { GSettings *settings = NULL; @@ -510,3 +537,4 @@ g_return_val_if_fail(PW3270_IS_APPLICATION(app),NULL); return PW3270_APPLICATION(app)->keypads; } + diff --git a/src/objects/settings/dialog.c b/src/objects/settings/dialog.c index 4562a59..5ac13d8 100644 --- a/src/objects/settings/dialog.c +++ b/src/objects/settings/dialog.c @@ -71,11 +71,6 @@ static void PW3270SettingsDialog_init(PW3270SettingsDialog *dialog) // Get use of header bar. g_object_get(gtk_settings_get_default(), "gtk-dialogs-use-header", &dialog->has_subtitle, NULL); - // https://developer.gnome.org/hig/stable/visual-layout.html.en - //gtk_box_set_spacing(GTK_BOX(content_area),18); - //gtk_container_set_border_width(GTK_CONTAINER(content_area),18); - -// gtk_window_set_deletable(GTK_WINDOW(dialog),FALSE); gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); gtk_dialog_add_buttons( diff --git a/src/objects/window/actions/sessionproperties.c b/src/objects/window/actions/sessionproperties.c index e701649..8aaab87 100644 --- a/src/objects/window/actions/sessionproperties.c +++ b/src/objects/window/actions/sessionproperties.c @@ -33,6 +33,7 @@ #include #include #include + #include static GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal); @@ -68,6 +69,12 @@ gtk_container_add(GTK_CONTAINER(dialog), elements[ix]); } + pw3270_application_plugin_call( + g_application_get_default(), + "pw3270_plugin_set_session_properties", + dialog + ); + // Setup dialog box gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal))); gtk_window_set_modal(GTK_WINDOW(dialog),TRUE); -- libgit2 0.21.2