aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/save-calendar/Makefile.am1
-rw-r--r--plugins/save-calendar/csv-format.c11
-rw-r--r--plugins/save-calendar/format-handler.h3
-rw-r--r--plugins/save-calendar/ical-format.c11
-rw-r--r--plugins/save-calendar/org-gnome-save-calendar.eplug.xml50
-rw-r--r--plugins/save-calendar/rdf-format.c11
-rw-r--r--plugins/save-calendar/save-calendar.c163
7 files changed, 196 insertions, 54 deletions
diff --git a/plugins/save-calendar/Makefile.am b/plugins/save-calendar/Makefile.am
index 1ed1654350..7149e789bc 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 04168695d9..7a4e856d68 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 f9e15dc771..7b5bf286a7 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 3b54176284..7888ecc4c1 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 57138294cf..a293c33c60 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 ff68dfcfe4..8734e17710 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 0959555db4..7c41a74089 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;
}