[evolution/express] Revert some bad assumptions I made in EPluginUI.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/express] Revert some bad assumptions I made in EPluginUI.
- Date: Thu, 18 Mar 2010 00:03:37 +0000 (UTC)
commit 5defa371e761a664d50de49ef788743da23d2ea5
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Mar 15 12:11:26 2010 -0400
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.
calendar/gui/dialogs/event-editor.c | 4 +-
calendar/gui/dialogs/memo-editor.c | 4 +-
calendar/gui/dialogs/task-editor.c | 4 +-
composer/e-msg-composer.c | 4 +-
e-util/e-alert.h | 2 +-
e-util/e-plugin-ui.c | 37 ++++++++++++++++++----------------
e-util/e-plugin-ui.h | 9 +++----
mail/e-mail-browser.c | 4 +-
shell/e-shell-view.c | 5 ++-
shell/e-shell-window-private.c | 5 +--
widgets/misc/e-web-view.c | 6 ++--
11 files changed, 43 insertions(+), 41 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 6e8b049..23256ad 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -507,8 +507,8 @@ event_editor_init (EventEditor *ee)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
id = "org.gnome.evolution.event-editor";
- e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, ee);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, ee);
+ e_plugin_ui_enable_manager (ui_manager, id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c
index 8e2a561..8e988c0 100644
--- a/calendar/gui/dialogs/memo-editor.c
+++ b/calendar/gui/dialogs/memo-editor.c
@@ -143,8 +143,8 @@ memo_editor_init (MemoEditor *me)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
id = "org.gnome.evolution.memo-editor";
- e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, me);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, me);
+ e_plugin_ui_enable_manager (ui_manager, id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index c7e0440..a3d4bae 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -365,8 +365,8 @@ task_editor_init (TaskEditor *te)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
id = "org.gnome.evolution.task-editor";
- e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, te);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, te);
+ e_plugin_ui_enable_manager (ui_manager, id);
if (error != NULL) {
g_critical ("%s: %s", G_STRFUNC, error->message);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index aa926b0..c212ea0 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1745,8 +1745,8 @@ msg_composer_constructed (GObject *object)
gtkhtml_editor_set_changed (editor, FALSE);
id = "org.gnome.evolution.composer";
- e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, composer);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, composer);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
static void
diff --git a/e-util/e-alert.h b/e-util/e-alert.h
index d0a4a0b..66a0cb9 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 9a9a4f2..999b1e8 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 e0cbb32..e59b5f5 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
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 5c36049..96f168f 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -580,8 +580,8 @@ mail_browser_constructed (GObject *object)
gconf_bridge_bind_property (bridge, key, object, "show-deleted");
id = "org.gnome.evolution.mail.browser";
- e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, object);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, object);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
static gboolean
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 33f7fe8..537024a 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -28,6 +28,7 @@
#include "e-util/e-util.h"
#include "e-util/e-file-utils.h"
#include "e-util/e-plugin-ui.h"
+#include "e-util/e-ui-manager.h"
#include "filter/e-rule-context.h"
#include "e-shell-window-actions.h"
@@ -596,10 +597,10 @@ shell_view_toggled (EShellView *shell_view)
if (view_is_active && priv->merge_id == 0) {
priv->merge_id = e_ui_manager_add_ui_from_file (
E_UI_MANAGER (ui_manager), basename);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_enable_manager (ui_manager, id);
} else if (!view_is_active && priv->merge_id != 0) {
- e_plugin_ui_disable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_disable_manager (ui_manager, id);
gtk_ui_manager_remove_ui (ui_manager, priv->merge_id);
priv->merge_id = 0;
}
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index e70e766..159a6b1 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -456,9 +456,8 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
shell_window_init_switcher_style (shell_window);
id = "org.gnome.evolution.shell";
- e_plugin_ui_register_manager (
- E_UI_MANAGER (ui_manager), id, shell_window);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, shell_window);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
void
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index 8744bef..ce41c32 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -1229,7 +1229,7 @@ web_view_init (EWebView *web_view)
web_view->priv = E_WEB_VIEW_GET_PRIVATE (web_view);
- ui_manager = e_ui_manager_new ();
+ ui_manager = gtk_ui_manager_new ();
web_view->priv->ui_manager = ui_manager;
g_signal_connect_swapped (
@@ -1331,8 +1331,8 @@ web_view_init (EWebView *web_view)
g_error ("%s", error->message);
id = "org.gnome.evolution.webview";
- e_plugin_ui_register_manager (E_UI_MANAGER (ui_manager), id, web_view);
- e_plugin_ui_enable_manager (E_UI_MANAGER (ui_manager), id);
+ e_plugin_ui_register_manager (ui_manager, id, web_view);
+ e_plugin_ui_enable_manager (ui_manager, id);
}
GType
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]