diff options
author | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2007-07-26 19:28:11 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2007-07-26 19:28:11 +0800 |
commit | 81a1525568ec94fd82b55e2d74510ec8c8fcdb5f (patch) | |
tree | ae3e94018925c24f0995fa4367b1502fda15cb24 | |
parent | c1a6b6f8d3b5026a872c86c6ccc4a1b21efdc4e6 (diff) | |
download | gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.tar gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.tar.gz gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.tar.bz2 gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.tar.lz gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.tar.xz gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.tar.zst gsoc2013-evolution-81a1525568ec94fd82b55e2d74510ec8c8fcdb5f.zip |
Plugins should be configurable within the plugin-manager itself.
Fixes Preferences dialog bloating.
See bug #459522
svn path=/trunk/; revision=33847
-rw-r--r-- | e-util/ChangeLog | 9 | ||||
-rw-r--r-- | e-util/e-plugin.c | 34 | ||||
-rw-r--r-- | e-util/e-plugin.h | 3 | ||||
-rw-r--r-- | plugins/plugin-manager/ChangeLog | 8 | ||||
-rw-r--r-- | plugins/plugin-manager/plugin-manager.c | 39 |
5 files changed, 90 insertions, 3 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 96bcbc6320..b28edc8806 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,12 @@ +2007-07-26 Sankar P <psankar@novell.com> + + * e-plugin.c: (e_plugin_configure), (epl_configure), + (epl_class_init): + * e-plugin.h: + Plugins should be configurable within the plugin-manager itself. + Fixes Preferences dialog bloating. + See bug #459522 + 2007-07-06 Matthew Barnes <mbarnes@redhat.com> ** Fixes part of bug #446894 diff --git a/e-util/e-plugin.c b/e-util/e-plugin.c index cb0364d6be..28d6c962fa 100644 --- a/e-util/e-plugin.c +++ b/e-util/e-plugin.c @@ -682,6 +682,21 @@ e_plugin_enable(EPlugin *ep, int state) } /** +* e_plugin_configure: +* @ep: +* +* +**/ + +void +e_plugin_configure (EPlugin *ep) +{ + EPluginClass *ptr; + ptr = ((EPluginClass *)G_OBJECT_GET_CLASS(ep)); + ptr->configure (ep); +} + +/** * e_plugin_xml_prop: * @node: An XML node. * @id: The name of the property to retrieve. @@ -912,6 +927,24 @@ epl_construct(EPlugin *ep, xmlNodePtr root) } static void +epl_configure (EPlugin *ep) +{ + EPluginLibConfigureFunc configure; + + pd(printf ("\n epl_configure \n")); + + if (epl_loadmodule(ep) != 0) { + pd(printf ("\n epl_loadmodule \n")); + return; + } + + if (g_module_symbol(epl->module, "e_plugin_lib_configure", (void *)&configure)) { + pd(printf ("\n g_module_symbol is loaded\n")); + configure (epl); + } +} + +static void epl_enable(EPlugin *ep, int state) { EPluginLibEnableFunc enable; @@ -958,6 +991,7 @@ epl_class_init(EPluginClass *klass) klass->construct = epl_construct; klass->invoke = epl_invoke; klass->enable = epl_enable; + klass->configure = epl_configure; klass->type = "shlib"; } diff --git a/e-util/e-plugin.h b/e-util/e-plugin.h index e6f04504d9..eeda139878 100644 --- a/e-util/e-plugin.h +++ b/e-util/e-plugin.h @@ -85,6 +85,7 @@ struct _EPluginClass { int (*construct)(EPlugin *, xmlNodePtr root); void *(*invoke)(EPlugin *, const char *name, void *data); void (*enable)(EPlugin *, int state); + void (*configure)(EPlugin *); }; GType e_plugin_get_type(void); @@ -98,6 +99,7 @@ void e_plugin_register_type(GType type); void *e_plugin_invoke(EPlugin *ep, const char *name, void *data); void e_plugin_enable(EPlugin *eph, int state); +void e_plugin_configure (EPlugin *eph); /* static helpers */ /* maps prop or content to 'g memory' */ @@ -119,6 +121,7 @@ typedef void *(*EPluginLibFunc)(EPluginLib *ep, void *data); * initialised. In the future it may also be called when the plugin * is disabled. */ typedef int (*EPluginLibEnableFunc)(EPluginLib *ep, int enable); +typedef int (*EPluginLibConfigureFunc)(EPluginLib *ep); /** * struct _EPluginLib - diff --git a/plugins/plugin-manager/ChangeLog b/plugins/plugin-manager/ChangeLog index b4484ac22a..99c4d32087 100644 --- a/plugins/plugin-manager/ChangeLog +++ b/plugins/plugin-manager/ChangeLog @@ -1,3 +1,11 @@ +2007-07-26 Sankar P <psankar@novell.com> + + * plugin-manager.c: (eppm_response), + (org_gnome_plugin_manager_manage), (e_plugin_lib_configure): + Plugins should be configurable within the plugin-manager itself. + Fixes Preferences dialog bloating. + See bug #459522 + 2007-05-11 Sankar P <psankar@novell.com> * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> diff --git a/plugins/plugin-manager/plugin-manager.c b/plugins/plugin-manager/plugin-manager.c index 9e41716b52..10ad9072b4 100644 --- a/plugins/plugin-manager/plugin-manager.c +++ b/plugins/plugin-manager/plugin-manager.c @@ -32,6 +32,8 @@ #include "e-util/e-plugin.h" #include "shell/es-menu.h" +#define d(S) (S) + enum { LABEL_NAME, LABEL_AUTHOR, @@ -69,7 +71,10 @@ struct _Manager { /* for tracking if we're shown */ static GtkDialog *dialog; +const int RESPONSE_CONFIGURE = 1; + void org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t); +int e_plugin_lib_configure(EPluginLib *ep); static void eppm_set_label(GtkLabel *l, const char *v) @@ -176,8 +181,24 @@ eppm_free(void *data) static void eppm_response(GtkDialog *w, int button, Manager *m) { - gtk_widget_destroy((GtkWidget*)w); - dialog = NULL; + if (button == GTK_RESPONSE_CLOSE) { + gtk_widget_destroy((GtkWidget*)w); + dialog = NULL; + } else { + GtkTreeSelection *selection = NULL; + GtkTreeModel *model = NULL; + GtkTreeIter iter; + + selection = gtk_tree_view_get_selection(m->treeview); + if (gtk_tree_selection_get_selected(selection, &model, &iter)) { + EPlugin *ep = NULL; + + gtk_tree_model_get(model, &iter, COL_PLUGIN_DATA, &ep, -1); + + e_plugin_configure (ep); + } else + d(printf ("\n\a No Plugin is selected \n\a")); + } } void @@ -202,7 +223,9 @@ org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t) m->dialog = (GtkDialog *)gtk_dialog_new_with_buttons(_("Plugin Manager"), (GtkWindow *)gtk_widget_get_toplevel(t->target.widget), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_OK, NULL); + _("Configure"), RESPONSE_CONFIGURE, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, + NULL); gtk_window_set_default_size((GtkWindow *)m->dialog, 640, 400); g_object_set((GObject *)m->dialog, "has_separator", FALSE, NULL); @@ -334,6 +357,8 @@ org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t) int e_plugin_lib_enable(EPluginLib *ep, int enable); +int e_plugin_lib_configure(EPluginLib *ep); + int e_plugin_lib_enable(EPluginLib *ep, int enable) { @@ -345,3 +370,11 @@ e_plugin_lib_enable(EPluginLib *ep, int enable) return 0; } + +int +e_plugin_lib_configure(EPluginLib *ep) +{ + d(printf ("\n\a e_plugin_lib_configure in plugin-manager\n\a")); + /* Makes no sense as this plugin is never shown */ + return 0; +} |