[evolution] Get the "save-calendar" plugin working.



commit 643db1689446521b73c589ef61c82c9536f24f46
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Sep 3 13:27:31 2009 -0400

    Get the "save-calendar" plugin working.
    
    Based on initial work by Milan Crha.

 configure.ac                                       |    3 +-
 plugins/save-calendar/Makefile.am                  |    1 +
 plugins/save-calendar/csv-format.c                 |   11 +-
 plugins/save-calendar/format-handler.h             |    3 +-
 plugins/save-calendar/ical-format.c                |   11 +-
 .../org-gnome-save-calendar.eplug.xml              |   50 ++++--
 plugins/save-calendar/rdf-format.c                 |   11 +-
 plugins/save-calendar/save-calendar.c              |  163 ++++++++++++++++++--
 shell/Makefile.am                                  |    2 +-
 shell/e-shell-view.c                               |   33 ----
 shell/e-shell-window.c                             |    7 +
 ui/evolution-calendars.ui                          |    1 +
 ui/evolution-memos.ui                              |    1 +
 ui/evolution-tasks.ui                              |    1 +
 14 files changed, 208 insertions(+), 90 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a74bc51..5225e7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1807,7 +1807,7 @@ plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS"
 all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments"
 
 dnl Temporary KILL-BONOBO hack
-enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import sa-junk-plugin startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup publish-calendar"
+enable_plugins="attachment-reminder addressbook-file audio-inline backup-restore bbdb bogo-junk-plugin caldav calendar-file calendar-http calendar-weather default-mailer default-source email-custom-header external-editor face google-account-setup hula-account-setup imap-features itip-formatter mail-notification mail-to-task mark-all-read plugin-manager prefer-plain profiler pst-import publish-calendar sa-junk-plugin save-calendar startup-wizard subject-thread templates $TNEF_ATTACHMENTS vcard-inline webdav-account-setup"
 
 dnl PLUGINS NOT BUILDING YET
 dnl ------------------------
@@ -1815,7 +1815,6 @@ dnl exchange-operations
 dnl groupwise-features
 dnl ipod-sync
 dnl mailing-list-actions
-dnl save-calendar
 
 case x"$enable_plugins" in
 xno)
diff --git a/plugins/save-calendar/Makefile.am b/plugins/save-calendar/Makefile.am
index 1ed1654..7149e78 100644
--- a/plugins/save-calendar/Makefile.am
+++ b/plugins/save-calendar/Makefile.am
@@ -18,6 +18,7 @@ liborg_gnome_save_calendar_la_SOURCES = \
 liborg_gnome_save_calendar_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
 liborg_gnome_save_calendar_la_LIBADD =	\
 	$(top_builddir)/e-util/libeutil.la	\
+	$(top_builddir)/shell/libeshell.la	\
 	$(EVOLUTION_CALENDAR_LIBS)
 
 EXTRA_DIST = org-gnome-save-calendar.eplug.xml
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index 0416869..7a4e856 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -32,7 +32,6 @@
 #include <libedataserverui/e-source-selector.h>
 #include <libecal/e-cal.h>
 #include "calendar/common/authentication.h"
-#include <calendar/gui/e-cal-popup.h>
 #include <string.h>
 
 #include "e-util/e-error.h"
@@ -298,7 +297,7 @@ userstring_to_systemstring (const gchar *userstring)
 }
 
 static void
-do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri)
+do_save_calendar_csv (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri)
 {
 
 	/*
@@ -323,12 +322,12 @@ do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
 	if (!dest_uri)
 		return;
 
-	primary_source = e_source_selector_peek_primary_selection (target->selector);
+	primary_source = e_source_selector_peek_primary_selection (selector);
 
 	/* open source client */
 	source_client = auth_new_cal_from_source (primary_source, type);
 	if (!e_cal_open (source_client, TRUE, &error)) {
-		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error);
+		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error);
 		g_object_unref (source_client);
 		g_error_free (error);
 		return;
@@ -344,7 +343,7 @@ do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
 	config->quote = userstring_to_systemstring (tmp?tmp:"\"");
 	config->header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (d->header_check));
 
-	stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target->selector))), dest_uri, &error);
+	stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error);
 
 	if (stream && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) {
 
@@ -509,7 +508,7 @@ do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
 	g_free (config);
 
 	if (error) {
-		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error);
+		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error);
 		g_error_free (error);
 	}
 
diff --git a/plugins/save-calendar/format-handler.h b/plugins/save-calendar/format-handler.h
index f9e15dc..7b5bf28 100644
--- a/plugins/save-calendar/format-handler.h
+++ b/plugins/save-calendar/format-handler.h
@@ -30,7 +30,6 @@
 #include <libedataserver/e-source.h>
 #include <libedataserverui/e-source-selector.h>
 #include <libecal/e-cal.h>
-#include <calendar/gui/e-cal-popup.h>
 
 typedef struct _FormatHandler FormatHandler;
 
@@ -43,7 +42,7 @@ struct _FormatHandler
 
 	gpointer data;
 
-	void (*save) (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri);
+	void (*save) (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri);
 };
 
 FormatHandler *csv_format_handler_new (void);
diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c
index 3b54176..7888ecc 100644
--- a/plugins/save-calendar/ical-format.c
+++ b/plugins/save-calendar/ical-format.c
@@ -31,7 +31,6 @@
 #include <libedataserverui/e-source-selector.h>
 #include <libecal/e-cal.h>
 #include <libecal/e-cal-util.h>
-#include <calendar/gui/e-cal-popup.h>
 #include <calendar/common/authentication.h>
 #include <string.h>
 
@@ -84,7 +83,7 @@ append_tz_to_comp (gpointer key, gpointer value, icalcomponent *toplevel)
 }
 
 static void
-do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri)
+do_save_calendar_ical (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri)
 {
 	ESource *primary_source;
 	ECal *source_client;
@@ -92,7 +91,7 @@ do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSourc
 	GList *objects;
 	icalcomponent *top_level = NULL;
 
-	primary_source = e_source_selector_peek_primary_selection (target->selector);
+	primary_source = e_source_selector_peek_primary_selection (selector);
 
 	if (!dest_uri)
 		return;
@@ -100,7 +99,7 @@ do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSourc
 	/* open source client */
 	source_client = (ECal*) auth_new_cal_from_source (primary_source, type);
 	if (!e_cal_open (source_client, TRUE, &error)) {
-		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error->message);
+		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error->message);
 		g_object_unref (source_client);
 		g_error_free (error);
 		return;
@@ -133,7 +132,7 @@ do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSourc
 		tdata.zones = NULL;
 
 		/* save the file */
-		stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target->selector))), dest_uri, &error);
+		stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error);
 
 		if (stream) {
 			gchar *ical_str = icalcomponent_as_ical_string_r (top_level);
@@ -147,7 +146,7 @@ do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSourc
 	}
 
 	if (error) {
-		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error->message);
+		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error->message);
 		g_error_free (error);
 	}
 
diff --git a/plugins/save-calendar/org-gnome-save-calendar.eplug.xml b/plugins/save-calendar/org-gnome-save-calendar.eplug.xml
index 5713829..a293c33 100644
--- a/plugins/save-calendar/org-gnome-save-calendar.eplug.xml
+++ b/plugins/save-calendar/org-gnome-save-calendar.eplug.xml
@@ -1,23 +1,37 @@
 <?xml version="1.0"?>
 <e-plugin-list>
-    <e-plugin id="org.gnome.evolution.save_calendar" type="shlib" 
-	_name="Save Selected"
-	    location="@PLUGINDIR@/liborg-gnome-save-calendar SOEXT@"> 
-	    <author name="Rodrigo Moya" email="rodrigo novell com"/>
-		<_description>Save a calendar or task list to disk.</_description>
-	
-		<hook class="org.gnome.evolution.calendar.popup:1.0">
-			<menu id="org.gnome.evolution.tasks.source.popup" target="source">
-				<item type="item" path="14.save_tasks" _label="_Save to Disk" icon="document-save" activate="org_gnome_save_tasks"/>
-			</menu>
+  <e-plugin id="org.gnome.evolution.save_calendar" type="shlib" _name="Save Selected" location="@PLUGINDIR@/liborg-gnome-save-calendar SOEXT@">
+    <author name="Rodrigo Moya" email="rodrigo novell com"/>
+    <_description>Save a calendar or task list to disk.</_description>
 
-			<menu id="org.gnome.evolution.calendar.source.popup" target="source">
-				<item type="item" path="14.save_calendar" _label="_Save to Disk" icon="document-save" activate="org_gnome_save_calendar"/>
-			</menu>
+    <hook class="org.gnome.evolution.ui:1.0">
+      <ui-manager id="org.gnome.evolution.calendars"
+                  callback="calendar_save_as_init">
+        <popup name="calendar-popup">
+          <placeholder name="calendar-popup-actions">
+            <menuitem action="calendar-save-as"/>
+          </placeholder>
+        </popup>
+      </ui-manager>
 
-			<menu id="org.gnome.evolution.memos.source.popup" target="source">
-				<item type="item" path="14.save_memos" _label="_Save to Disk" icon="document-save" activate="org_gnome_save_memos"/>
-			</menu>
-		</hook>
-	</e-plugin>
+      <ui-manager id="org.gnome.evolution.memos"
+                  callback="memo_list_save_as_init">
+        <popup name="memo-list-popup">
+          <placeholder name="memo-list-popup-actions">
+            <menuitem action="memo-list-save-as"/>
+          </placeholder>
+        </popup>
+      </ui-manager>
+
+      <ui-manager id="org.gnome.evolution.tasks"
+                  callback="task_list_save_as_init">
+        <popup name="task-list-popup">
+          <placeholder name="task-list-popup-actions">
+            <menuitem action="task-list-save-as"/>
+          </placeholder>
+        </popup>
+      </ui-manager>
+    </hook>
+
+  </e-plugin>
 </e-plugin-list>
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index ff68dfc..8734e17 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -29,7 +29,6 @@
 #include <libedataserver/e-source.h>
 #include <libedataserverui/e-source-selector.h>
 #include <libecal/e-cal.h>
-#include <calendar/gui/e-cal-popup.h>
 #include <libecal/e-cal-time-util.h>
 #include <libedataserver/e-data-server-util.h>
 #include <libxml/xmlmemory.h>
@@ -172,7 +171,7 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value)
 }
 
 static void
-do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri)
+do_save_calendar_rdf (FormatHandler *handler, ESourceSelector *selector, ECalSourceType type, gchar *dest_uri)
 {
 
 	/*
@@ -194,18 +193,18 @@ do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
 	if (!dest_uri)
 		return;
 
-	primary_source = e_source_selector_peek_primary_selection (target->selector);
+	primary_source = e_source_selector_peek_primary_selection (selector);
 
 	/* open source client */
 	source_client = auth_new_cal_from_source (primary_source, type);
 	if (!e_cal_open (source_client, TRUE, &error)) {
-		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error);
+		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error);
 		g_object_unref (source_client);
 		g_error_free (error);
 		return;
 	}
 
-	stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target->selector))), dest_uri, &error);
+	stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (selector))), dest_uri, &error);
 
 	if (stream && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) {
 		xmlBufferPtr buffer=xmlBufferCreate();
@@ -357,7 +356,7 @@ do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource
 	g_object_unref (source_client);
 
 	if (error) {
-		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error);
+		display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (selector)), error);
 		g_error_free (error);
 	}
 
diff --git a/plugins/save-calendar/save-calendar.c b/plugins/save-calendar/save-calendar.c
index 0959555..7c41a74 100644
--- a/plugins/save-calendar/save-calendar.c
+++ b/plugins/save-calendar/save-calendar.c
@@ -33,12 +33,23 @@
 #include <libedataserver/e-source.h>
 #include <libedataserverui/e-source-selector.h>
 #include <libecal/e-cal.h>
-#include <calendar/gui/e-cal-popup.h>
 #include <e-util/e-error.h>
 #include <string.h>
 
+#include <shell/e-shell-sidebar.h>
+#include <shell/e-shell-view.h>
+#include <shell/e-shell-window.h>
+
 #include "format-handler.h"
 
+/* Plugin entry points */
+gboolean	calendar_save_as_init		(GtkUIManager *ui_manager,
+						 EShellView *shell_view);
+gboolean	memo_list_save_as_init		(GtkUIManager *ui_manager,
+						 EShellView *shell_view);
+gboolean	task_list_save_as_init		(GtkUIManager *ui_manager,
+						 EShellView *shell_view);
+
 enum {  /* GtkComboBox enum */
 	DEST_NAME_COLUMN,
 	DEST_HANDLER,
@@ -46,10 +57,6 @@ enum {  /* GtkComboBox enum */
 
 };
 
-void org_gnome_save_calendar (EPlugin *ep, ECalPopupTargetSource *target);
-void org_gnome_save_tasks (EPlugin *ep, ECalPopupTargetSource *target);
-void org_gnome_save_memos (EPlugin *ep, ECalPopupTargetSource *target);
-
 static void
 extra_widget_foreach_hide (GtkWidget *widget, gpointer data)
 {
@@ -95,7 +102,7 @@ format_handlers_foreach_free (gpointer data, gpointer user_data)
 }
 
 static void
-ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type)
+ask_destination_and_save (ESourceSelector *selector, ECalSourceType type)
 {
 	FormatHandler *handler = NULL;
 
@@ -197,7 +204,7 @@ ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSource
 			dest_uri = temp;
 		}
 
-		handler->save (handler, ep, target, type, dest_uri);
+		handler->save (handler, selector, type, dest_uri);
 	}
 
 	/* Free the handlers */
@@ -258,20 +265,144 @@ open_for_writing (GtkWindow *parent, const gchar *uri, GError **error)
 	return NULL;
 }
 
-void
-org_gnome_save_calendar (EPlugin *ep, ECalPopupTargetSource *target)
+static void
+save_general (EShellView *shell_view,
+              ECalSourceType type)
+{
+	EShellSidebar *shell_sidebar;
+	ESourceSelector *selector = NULL;
+
+	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+	g_object_get (shell_sidebar, "selector", &selector, NULL);
+	g_return_if_fail (selector != NULL);
+
+	ask_destination_and_save (selector, type);
+
+	g_object_unref (selector);
+}
+
+static void
+action_calendar_save_as_cb (GtkAction *action,
+                            EShellView *shell_view)
+{
+	save_general (shell_view, E_CAL_SOURCE_TYPE_EVENT);
+}
+
+static void
+action_memo_list_save_as_cb (GtkAction *action,
+                             EShellView *shell_view)
+{
+	save_general (shell_view, E_CAL_SOURCE_TYPE_JOURNAL);
+}
+
+static void
+action_task_list_save_as_cb (GtkAction *action,
+                             EShellView *shell_view)
+{
+	save_general (shell_view, E_CAL_SOURCE_TYPE_TODO);
+}
+
+gboolean
+calendar_save_as_init (GtkUIManager *ui_manager,
+                       EShellView *shell_view)
 {
-	ask_destination_and_save (ep, target, E_CAL_SOURCE_TYPE_EVENT);
+	EShell *shell;
+	EShellSettings *shell_settings;
+	EShellWindow *shell_window;
+	GtkActionGroup *action_group;
+	GtkAction *action;
+	const gchar *tooltip;
+	const gchar *stock_id;
+	const gchar *name;
+
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	name = "calendar-save-as";
+	tooltip = _("Save the selected calendar to disk");
+	stock_id = GTK_STOCK_SAVE_AS;
+	action = gtk_action_new (name, NULL, tooltip, stock_id);
+
+	name = "lockdown-save-to-disk";
+	action_group = e_shell_window_get_action_group (shell_window, name);
+	gtk_action_group_add_action (action_group, action);
+
+	g_signal_connect (
+		action, "activate",
+		G_CALLBACK (action_calendar_save_as_cb), shell_view);
+
+	g_object_unref (action);
+
+	return TRUE;
 }
 
-void
-org_gnome_save_tasks (EPlugin *ep, ECalPopupTargetSource *target)
+gboolean
+memo_list_save_as_init (GtkUIManager *ui_manager,
+                        EShellView *shell_view)
 {
-	ask_destination_and_save (ep, target, E_CAL_SOURCE_TYPE_TODO);
+	EShell *shell;
+	EShellSettings *shell_settings;
+	EShellWindow *shell_window;
+	GtkActionGroup *action_group;
+	GtkAction *action;
+	const gchar *tooltip;
+	const gchar *stock_id;
+	const gchar *name;
+
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	name = "memo-list-save-as";
+	tooltip = _("Save the selected memo list to disk");
+	stock_id = GTK_STOCK_SAVE_AS;
+	action = gtk_action_new (name, NULL, tooltip, stock_id);
+
+	name = "lockdown-save-to-disk";
+	action_group = e_shell_window_get_action_group (shell_window, name);
+	gtk_action_group_add_action (action_group, action);
+
+	g_signal_connect (
+		action, "activate",
+		G_CALLBACK (action_memo_list_save_as_cb), shell_view);
+
+	g_object_unref (action);
+
+	return TRUE;
 }
 
-void
-org_gnome_save_memos (EPlugin *ep, ECalPopupTargetSource *target)
+gboolean
+task_list_save_as_init (GtkUIManager *ui_manager,
+                        EShellView *shell_view)
 {
-	ask_destination_and_save (ep, target, E_CAL_SOURCE_TYPE_JOURNAL);
+	EShell *shell;
+	EShellSettings *shell_settings;
+	EShellWindow *shell_window;
+	GtkActionGroup *action_group;
+	GtkAction *action;
+	const gchar *tooltip;
+	const gchar *stock_id;
+	const gchar *name;
+
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	shell = e_shell_window_get_shell (shell_window);
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	name = "task-list-save-as";
+	tooltip = _("Save the selected task list to disk");
+	stock_id = GTK_STOCK_SAVE_AS;
+	action = gtk_action_new (name, NULL, tooltip, stock_id);
+
+	name = "lockdown-save-to-disk";
+	action_group = e_shell_window_get_action_group (shell_window, name);
+	gtk_action_group_add_action (action_group, action);
+
+	g_signal_connect (
+		action, "activate",
+		G_CALLBACK (action_task_list_save_as_cb), shell_view);
+
+	g_object_unref (action);
+
+	return TRUE;
 }
diff --git a/shell/Makefile.am b/shell/Makefile.am
index a17c11a..7358a14 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -57,6 +57,7 @@ eshellinclude_HEADERS = 			\
 	e-shell-taskbar.h			\
 	e-shell-view.h				\
 	e-shell-window.h			\
+	e-shell-window-actions.h		\
 	es-event.h
 
 libeshell_la_SOURCES =				\
@@ -78,7 +79,6 @@ libeshell_la_SOURCES =				\
 	e-shell-importer.h			\
 	e-shell-migrate.c			\
 	e-shell-migrate.h			\
-	e-shell-window-actions.h		\
 	e-shell-window-actions.c		\
 	es-event.c
 
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index ff54c59..ccd5de6 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -189,31 +189,6 @@ shell_view_state_timeout_cb (EShellView *shell_view)
 	return FALSE;
 }
 
-static gboolean
-shell_view_register_ui_manager (EShellView *shell_view)
-{
-	EShellViewClass *shell_view_class;
-	EShellWindow *shell_window;
-	GtkUIManager *ui_manager;
-	const gchar *id;
-
-	/* This is a one-time, post-construction idle callback. */
-
-	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
-	shell_window = e_shell_view_get_shell_window (shell_view);
-	ui_manager = e_shell_window_get_ui_manager (shell_window);
-	id = shell_view_class->ui_manager_id;
-
-	e_plugin_ui_register_manager (ui_manager, id, shell_view);
-
-	if (e_shell_view_is_active (shell_view)) {
-		e_plugin_ui_enable_manager (ui_manager, id);
-		e_shell_view_update_actions (shell_view);
-	}
-
-	return FALSE;
-}
-
 static void
 shell_view_emit_toggled (EShellView *shell_view)
 {
@@ -427,14 +402,6 @@ shell_view_constructed (GObject *object)
 	shell_view = E_SHELL_VIEW (object);
 	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
 
-	/* Defer EPluginUI registration to an idle callback to give the
-	 * shell view subclass a chance to register its own actions and
-	 * action groups.  Registration will immediately load EPlugins
-	 * that specify the shell view's GtkUIManager ID, and their
-	 * initialization routines may require those actions or action
-	 * groups that have not yet been added. */
-	g_idle_add ((GSourceFunc) shell_view_register_ui_manager, shell_view);
-
 	shell_view_load_state (shell_view);
 
 	/* Invoke factory methods. */
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 6b43877..a6ac570 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -42,10 +42,12 @@ shell_window_new_view (EShellBackend *shell_backend,
 {
 	GHashTable *loaded_views;
 	EShellView *shell_view;
+	GtkUIManager *ui_manager;
 	GtkNotebook *notebook;
 	GtkAction *action;
 	GtkWidget *widget;
 	const gchar *name;
+	const gchar *id;
 	gint page_num;
 	GType type;
 
@@ -71,6 +73,11 @@ shell_window_new_view (EShellBackend *shell_backend,
 	loaded_views = shell_window->priv->loaded_views;
 	g_hash_table_insert (loaded_views, g_strdup (name), shell_view);
 
+	/* Register the GtkUIManager ID for the shell view. */
+	id = E_SHELL_VIEW_GET_CLASS (shell_view)->ui_manager_id;
+	ui_manager = e_shell_window_get_ui_manager (shell_window);
+	e_plugin_ui_register_manager (ui_manager, id, shell_view);
+
 	/* Add pages to the various shell window notebooks. */
 
 	/* We can't determine the shell view's page number until after the
diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui
index 267d6f0..2954649 100644
--- a/ui/evolution-calendars.ui
+++ b/ui/evolution-calendars.ui
@@ -53,6 +53,7 @@
     <separator/>
     <menuitem action='calendar-popup-delete'/>
     <menuitem action='calendar-popup-select-one'/>
+    <placeholder name='calendar-popup-actions'/>
     <separator/>
     <menuitem action='calendar-popup-properties'/>
   </popup>
diff --git a/ui/evolution-memos.ui b/ui/evolution-memos.ui
index f4d4129..3afcd80 100644
--- a/ui/evolution-memos.ui
+++ b/ui/evolution-memos.ui
@@ -62,6 +62,7 @@
     <separator/>
     <menuitem action='memo-list-popup-delete'/>
     <menuitem action='memo-list-popup-select-one'/>
+    <placeholder name='memo-list-popup-actions'/>
     <separator/>
     <menuitem action='memo-list-popup-properties'/>
   </popup>
diff --git a/ui/evolution-tasks.ui b/ui/evolution-tasks.ui
index e8d6f76..8a17fd3 100644
--- a/ui/evolution-tasks.ui
+++ b/ui/evolution-tasks.ui
@@ -73,6 +73,7 @@
     <separator/>
     <menuitem action='task-list-popup-delete'/>
     <menuitem action='task-list-popup-select-one'/>
+    <placeholder name='task-list-popup-actions'/>
     <separator/>
     <menuitem action='task-list-popup-properties'/>
   </popup>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]