diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-03-16 00:11:26 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-16 00:14:36 +0800 |
commit | 04305b8fa35d87d97e48b11f93d24604cef5155d (patch) | |
tree | 5bb4922a88238522039431aa4d3583777d1f3466 /e-util | |
parent | 2971ce413ce9f91ac768d53487c47056b2f5710f (diff) | |
download | gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.tar gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.tar.gz gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.tar.bz2 gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.tar.lz gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.tar.xz gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.tar.zst gsoc2013-evolution-04305b8fa35d87d97e48b11f93d24604cef5155d.zip |
Revert some bad assumptions I made in EPluginUI.
We can't require the use of EUIManager everywhere because we don't
control all the UI manager instances -- the most compelling example
being the composer, whose UI manager comes from GtkhtmlEditor.
Instead, EPluginUI will check the instance type and pick an appropriate
"load_from_string" function.
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-alert.h | 2 | ||||
-rw-r--r-- | e-util/e-plugin-ui.c | 37 | ||||
-rw-r--r-- | e-util/e-plugin-ui.h | 9 |
3 files changed, 25 insertions, 23 deletions
diff --git a/e-util/e-alert.h b/e-util/e-alert.h index d0a4a0b502..66a0cb9c23 100644 --- a/e-util/e-alert.h +++ b/e-util/e-alert.h @@ -97,7 +97,7 @@ struct _EAlertClass GType e_alert_get_type (void); -EAlert *e_alert_new(const gchar *tag, ...); +EAlert *e_alert_new(const gchar *tag, ...) G_GNUC_NULL_TERMINATED; EAlert *e_alert_new_valist(const gchar *tag, va_list ap); EAlert *e_alert_new_array(const gchar *tag, GPtrArray *args); diff --git a/e-util/e-plugin-ui.c b/e-util/e-plugin-ui.c index 9a9a4f23ed..999b1e82d2 100644 --- a/e-util/e-plugin-ui.c +++ b/e-util/e-plugin-ui.c @@ -167,7 +167,7 @@ static gpointer parent_class; static void plugin_ui_hook_unregister_manager (EPluginUIHook *hook, - EUIManager *ui_manager) + GtkUIManager *ui_manager) { GHashTable *registry; @@ -178,7 +178,7 @@ plugin_ui_hook_unregister_manager (EPluginUIHook *hook, static void plugin_ui_hook_register_manager (EPluginUIHook *hook, - EUIManager *ui_manager, + GtkUIManager *ui_manager, const gchar *id, gpointer user_data) { @@ -229,7 +229,7 @@ plugin_ui_hook_register_manager (EPluginUIHook *hook, static guint plugin_ui_hook_merge_ui (EPluginUIHook *hook, - EUIManager *ui_manager, + GtkUIManager *ui_manager, const gchar *id) { GHashTable *hash_table; @@ -241,8 +241,12 @@ plugin_ui_hook_merge_ui (EPluginUIHook *hook, ui_definition = g_hash_table_lookup (hash_table, id); g_return_val_if_fail (ui_definition != NULL, 0); - merge_id = e_ui_manager_add_ui_from_string ( - ui_manager, ui_definition, &error); + if (E_IS_UI_MANAGER (ui_manager)) + merge_id = e_ui_manager_add_ui_from_string ( + E_UI_MANAGER (ui_manager), ui_definition, &error); + else + merge_id = gtk_ui_manager_add_ui_from_string ( + ui_manager, ui_definition, -1, &error); if (error != NULL) { g_warning ("%s", error->message); @@ -254,7 +258,7 @@ plugin_ui_hook_merge_ui (EPluginUIHook *hook, static void plugin_ui_enable_manager (EPluginUIHook *hook, - EUIManager *ui_manager, + GtkUIManager *ui_manager, const gchar *id) { GHashTable *hash_table; @@ -302,7 +306,7 @@ plugin_ui_enable_manager (EPluginUIHook *hook, static void plugin_ui_disable_manager (EPluginUIHook *hook, - EUIManager *ui_manager, + GtkUIManager *ui_manager, const gchar *id, gboolean remove) { @@ -338,8 +342,7 @@ plugin_ui_disable_manager (EPluginUIHook *hook, /* Merge ID could be 0 if the plugin is disabled. */ if (merge_id > 0) - gtk_ui_manager_remove_ui ( - GTK_UI_MANAGER (ui_manager), merge_id); + gtk_ui_manager_remove_ui (ui_manager, merge_id); if (remove) g_hash_table_remove (hash_table, id); @@ -361,7 +364,7 @@ plugin_ui_enable_hook (EPluginUIHook *hook) g_hash_table_iter_init (&iter, hash_table); while (g_hash_table_iter_next (&iter, &key, NULL)) { - EUIManager *ui_manager = key; + GtkUIManager *ui_manager = key; plugin_ui_enable_manager (hook, ui_manager, NULL); } } @@ -379,7 +382,7 @@ plugin_ui_disable_hook (EPluginUIHook *hook) g_hash_table_iter_init (&iter, hash_table); while (g_hash_table_iter_next (&iter, &key, NULL)) { - EUIManager *ui_manager = key; + GtkUIManager *ui_manager = key; plugin_ui_disable_manager (hook, ui_manager, NULL, FALSE); } } @@ -549,13 +552,13 @@ e_plugin_ui_hook_get_type (void) } void -e_plugin_ui_register_manager (EUIManager *ui_manager, +e_plugin_ui_register_manager (GtkUIManager *ui_manager, const gchar *id, gpointer user_data) { GSList *plugin_list; - g_return_if_fail (E_IS_UI_MANAGER (ui_manager)); + g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager)); g_return_if_fail (id != NULL); /* Loop over all installed plugins. */ @@ -589,12 +592,12 @@ e_plugin_ui_register_manager (EUIManager *ui_manager, } void -e_plugin_ui_enable_manager (EUIManager *ui_manager, +e_plugin_ui_enable_manager (GtkUIManager *ui_manager, const gchar *id) { GSList *plugin_list; - g_return_if_fail (E_IS_UI_MANAGER (ui_manager)); + g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager)); g_return_if_fail (id != NULL); /* Loop over all installed plugins. */ @@ -618,12 +621,12 @@ e_plugin_ui_enable_manager (EUIManager *ui_manager, } void -e_plugin_ui_disable_manager (EUIManager *ui_manager, +e_plugin_ui_disable_manager (GtkUIManager *ui_manager, const gchar *id) { GSList *plugin_list; - g_return_if_fail (E_IS_UI_MANAGER (ui_manager)); + g_return_if_fail (GTK_IS_UI_MANAGER (ui_manager)); g_return_if_fail (id != NULL); /* Loop over all installed plugins. */ diff --git a/e-util/e-plugin-ui.h b/e-util/e-plugin-ui.h index e0cbb32f2d..e59b5f5222 100644 --- a/e-util/e-plugin-ui.h +++ b/e-util/e-plugin-ui.h @@ -20,7 +20,6 @@ #include <gtk/gtk.h> -#include <e-util/e-ui-manager.h> #include <e-util/e-plugin.h> /* Standard GObject macros */ @@ -59,17 +58,17 @@ struct _EPluginUIHookClass { /* Plugins with "org.gnome.evolution.ui" hooks should define a * function named e_plugin_ui_init() having this signature. */ -typedef gboolean (*EPluginUIInitFunc) (EUIManager *ui_manager, +typedef gboolean (*EPluginUIInitFunc) (GtkUIManager *ui_manager, gpointer user_data); GType e_plugin_ui_hook_get_type (void); -void e_plugin_ui_register_manager (EUIManager *ui_manager, +void e_plugin_ui_register_manager (GtkUIManager *ui_manager, const gchar *id, gpointer user_data); -void e_plugin_ui_enable_manager (EUIManager *ui_manager, +void e_plugin_ui_enable_manager (GtkUIManager *ui_manager, const gchar *id); -void e_plugin_ui_disable_manager (EUIManager *ui_manager, +void e_plugin_ui_disable_manager (GtkUIManager *ui_manager, const gchar *id); G_END_DECLS |