evolution r37510 - in branches/kill-bonobo: . addressbook/gui/component calendar/gui calendar/modules composer mail plugins/import-ics-attachments



Author: mbarnes
Date: Fri Apr 10 11:05:55 2009
New Revision: 37510
URL: http://svn.gnome.org/viewvc/evolution?rev=37510&view=rev

Log:
Convert "import-ics-attachments" plugin to an EAttachmentHandler subclass.


Added:
   branches/kill-bonobo/calendar/gui/e-attachment-handler-calendar.c
   branches/kill-bonobo/calendar/gui/e-attachment-handler-calendar.h
Removed:
   branches/kill-bonobo/plugins/import-ics-attachments/
Modified:
   branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c
   branches/kill-bonobo/calendar/gui/Makefile.am
   branches/kill-bonobo/calendar/modules/e-cal-shell-module.c
   branches/kill-bonobo/composer/e-composer-private.c
   branches/kill-bonobo/composer/e-msg-composer.c
   branches/kill-bonobo/configure.in
   branches/kill-bonobo/mail/em-format-html-display.c
   branches/kill-bonobo/mail/em-popup.c
   branches/kill-bonobo/mail/em-popup.h

Modified: branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/eab-composer-util.c	Fri Apr 10 11:05:55 2009
@@ -117,7 +117,7 @@
 	GList *contacts, *iter;
 	gchar *data;
 
-	if (contacts == NULL)
+	if (destinations == NULL)
 		return;
 
 	composer = e_msg_composer_new ();

Modified: branches/kill-bonobo/calendar/gui/Makefile.am
==============================================================================
--- branches/kill-bonobo/calendar/gui/Makefile.am	(original)
+++ branches/kill-bonobo/calendar/gui/Makefile.am	Fri Apr 10 11:05:55 2009
@@ -50,6 +50,8 @@
 # 	gnome-cal.h
 
 libcal_gui_la_SOURCES =		\
+	e-attachment-handler-calendar.c		\
+	e-attachment-handler-calendar.h		\
  	e-calendar-view.c			\
  	e-calendar-view.h			\
  	e-calendar-table.c			\

Added: branches/kill-bonobo/calendar/gui/e-attachment-handler-calendar.c
==============================================================================
--- (empty file)
+++ branches/kill-bonobo/calendar/gui/e-attachment-handler-calendar.c	Fri Apr 10 11:05:55 2009
@@ -0,0 +1,516 @@
+/*
+ * e-attachment-handler-calendar.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>  
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-attachment-handler-calendar.h"
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include <libical/ical.h>
+#include <libecal/e-cal.h>
+#include <camel/camel-stream-mem.h>
+#include <libedataserverui/e-source-selector.h>
+
+#include "calendar/common/authentication.h"
+
+#define E_ATTACHMENT_HANDLER_CALENDAR_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), E_TYPE_ATTACHMENT_HANDLER_CALENDAR, EAttachmentHandlerCalendarPrivate))
+
+typedef struct _ImportContext ImportContext;
+
+struct _EAttachmentHandlerCalendarPrivate {
+	gint placeholder;
+};
+
+struct _ImportContext {
+	ECal *client;
+	icalcomponent *component;
+	ECalSourceType source_type;
+};
+
+static gpointer parent_class;
+
+static const gchar *ui =
+"<ui>"
+"  <popup name='context'>"
+"    <placeholder name='custom-actions'>"
+"      <menuitem action='import-to-calendar'/>"
+"      <menuitem action='import-to-tasks'/>"
+"    </placeholder>"
+"  </popup>"
+"</ui>";
+
+static icalcomponent *
+attachment_handler_get_component (EAttachment *attachment)
+{
+	CamelDataWrapper *wrapper;
+	CamelMimePart *mime_part;
+	CamelStream *stream;
+	GByteArray *buffer;
+	icalcomponent *component;
+	const gchar *key = "__icalcomponent__";
+
+	component = g_object_get_data (G_OBJECT (attachment), key);
+	if (component != NULL)
+		return component;
+
+	mime_part = e_attachment_get_mime_part (attachment);
+	if (!CAMEL_IS_MIME_PART (mime_part))
+		return NULL;
+
+	buffer = g_byte_array_new ();
+	stream = camel_stream_mem_new ();
+	camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), buffer);
+	wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+	camel_data_wrapper_decode_to_stream (wrapper, stream);
+	camel_object_unref (stream);
+
+	component = e_cal_util_parse_ics_string ((gchar *) buffer->data);
+
+	g_byte_array_free (buffer, TRUE);
+
+	if (component == NULL)
+		return NULL;
+
+	g_object_set_data_full (
+		G_OBJECT (attachment), key, component,
+		(GDestroyNotify) icalcomponent_free);
+
+	return component;
+}
+
+static gboolean
+attachment_handler_update_objects (ECal *client,
+                                   icalcomponent *component)
+{
+	icalcomponent_kind kind;
+	icalcomponent *vcalendar;
+	gboolean success;
+
+	kind = icalcomponent_isa (component);
+
+	switch (kind) {
+		case ICAL_VTODO_COMPONENT:
+		case ICAL_VEVENT_COMPONENT:
+			vcalendar = e_cal_util_new_top_level ();
+			if (icalcomponent_get_method (component) == ICAL_METHOD_CANCEL)
+				icalcomponent_set_method (vcalendar, ICAL_METHOD_CANCEL);
+			else
+				icalcomponent_set_method (vcalendar, ICAL_METHOD_PUBLISH);
+			icalcomponent_add_component (
+				vcalendar, icalcomponent_new_clone (component));
+			break;
+
+		case ICAL_VCALENDAR_COMPONENT:
+			vcalendar = icalcomponent_new_clone (component);
+			if (!icalcomponent_get_first_property (vcalendar, ICAL_METHOD_PROPERTY))
+				icalcomponent_set_method (vcalendar, ICAL_METHOD_PUBLISH);
+			break;
+
+		default:
+			return FALSE;
+	}
+
+	success = e_cal_receive_objects (client, vcalendar, NULL);
+
+	icalcomponent_free (vcalendar);
+
+	return success;
+}
+
+static void
+attachment_handler_import_event (ECal *client,
+                                 ECalendarStatus status,
+                                 EAttachment *attachment)
+{
+	icalcomponent *component;
+	icalcomponent *subcomponent;
+	icalcompiter iter;
+
+	/* FIXME Notify the user somehow. */
+	g_return_if_fail (status == E_CALENDAR_STATUS_OK);
+
+	component = attachment_handler_get_component (attachment);
+	g_return_if_fail (component != NULL);
+
+	iter = icalcomponent_begin_component (component, ICAL_ANY_COMPONENT);
+
+	while ((subcomponent = icalcompiter_deref (&iter)) != NULL) {
+		icalcomponent_kind kind;
+
+		kind = icalcomponent_isa (subcomponent);
+		icalcompiter_next (&iter);
+
+		if (kind == ICAL_VEVENT_COMPONENT)
+			continue;
+
+		if (kind == ICAL_VTIMEZONE_COMPONENT)
+			continue;
+
+		icalcomponent_remove_component (component, subcomponent);
+		icalcomponent_free (subcomponent);
+	}
+
+	/* XXX Do something with the return value. */
+	attachment_handler_update_objects (client, component);
+
+	g_object_unref (attachment);
+	g_object_unref (client);
+}
+
+static void
+attachment_handler_import_todo (ECal *client,
+                                ECalendarStatus status,
+                                EAttachment *attachment)
+{
+	icalcomponent *component;
+	icalcomponent *subcomponent;
+	icalcompiter iter;
+
+	/* FIXME Notify the user somehow. */
+	g_return_if_fail (status == E_CALENDAR_STATUS_OK);
+
+	component = attachment_handler_get_component (attachment);
+	g_return_if_fail (component != NULL);
+
+	iter = icalcomponent_begin_component (component, ICAL_ANY_COMPONENT);
+
+	while ((subcomponent = icalcompiter_deref (&iter)) != NULL) {
+		icalcomponent_kind kind;
+
+		kind = icalcomponent_isa (subcomponent);
+		icalcompiter_next (&iter);
+
+		if (kind == ICAL_VTODO_COMPONENT)
+			continue;
+
+		if (kind == ICAL_VTIMEZONE_COMPONENT)
+			continue;
+
+		icalcomponent_remove_component (component, subcomponent);
+		icalcomponent_free (subcomponent);
+	}
+
+	/* XXX Do something with the return value. */
+	attachment_handler_update_objects (client, component);
+
+	g_object_unref (attachment);
+	g_object_unref (client);
+}
+
+static void
+attachment_handler_row_activated_cb (GtkDialog *dialog)
+{
+	gtk_dialog_response (dialog, GTK_RESPONSE_OK);
+}
+
+static void
+attachment_handler_run_dialog (GtkWindow *parent,
+                               EAttachment *attachment,
+                               ECalSourceType source_type,
+                               const gchar *title)
+{
+	GtkWidget *dialog;
+	GtkWidget *container;
+	GtkWidget *widget;
+	GCallback callback;
+	ESourceSelector *selector;
+	ESourceList *source_list;
+	ESource *source;
+	ECal *client;
+	icalcomponent *component;
+	GError *error = NULL;
+
+	component = attachment_handler_get_component (attachment);
+	g_return_if_fail (component != NULL);
+
+	e_cal_get_sources (&source_list, source_type, &error);
+	if (error != NULL) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+		return;
+	}
+
+	source = e_source_list_peek_source_any (source_list);
+	g_return_if_fail (source != NULL);
+
+	dialog = gtk_dialog_new_with_buttons (
+		title, parent, GTK_DIALOG_DESTROY_WITH_PARENT,
+		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
+
+	widget = gtk_button_new_with_mnemonic (_("I_mport"));
+	gtk_button_set_image (
+		GTK_BUTTON (widget), gtk_image_new_from_icon_name (
+		"stock_mail-import", GTK_ICON_SIZE_MENU));
+	gtk_dialog_add_action_widget (
+		GTK_DIALOG (dialog), widget, GTK_RESPONSE_OK);
+	gtk_widget_show (widget);
+
+	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+	gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
+
+	container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	widget = gtk_scrolled_window_new (NULL, NULL);
+	gtk_scrolled_window_set_policy (
+		GTK_SCROLLED_WINDOW (widget),
+		GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (
+		GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	gtk_widget_show (widget);
+
+	container = widget;
+
+	widget = e_source_selector_new (source_list);
+	selector = E_SOURCE_SELECTOR (widget);
+	e_source_selector_set_primary_selection (selector, source);
+	e_source_selector_show_selection (selector, FALSE);
+	gtk_container_add (GTK_CONTAINER (container), widget);
+	gtk_widget_show (widget);
+
+	g_signal_connect_swapped (
+		widget, "row-activated",
+		G_CALLBACK (attachment_handler_row_activated_cb), dialog);
+
+	if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
+		goto exit;
+
+	source = e_source_selector_peek_primary_selection (selector);
+	if (source == NULL)
+		goto exit;
+
+	client = auth_new_cal_from_source (source, source_type);
+	if (client == NULL)
+		goto exit;
+
+	if (source_type == E_CAL_SOURCE_TYPE_EVENT)
+		callback = G_CALLBACK (attachment_handler_import_event);
+	else if (source_type == E_CAL_SOURCE_TYPE_TODO)
+		callback = G_CALLBACK (attachment_handler_import_todo);
+	else
+		goto exit;
+
+	g_object_ref (attachment);
+	g_signal_connect (client, "cal-opened", callback, attachment);
+	e_cal_open_async (client, FALSE);
+
+exit:
+	gtk_widget_destroy (dialog);
+}
+
+static void
+attachment_handler_import_to_calendar (GtkAction *action,
+                                       EAttachmentHandler *handler)
+{
+	EAttachment *attachment;
+	EAttachmentView *view;
+	GList *selected;
+	gpointer parent;
+
+	view = e_attachment_handler_get_view (handler);
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (view));
+	parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+	g_return_if_fail (g_list_length (selected) == 1);
+	attachment = E_ATTACHMENT (selected->data);
+
+	attachment_handler_run_dialog (
+		parent, attachment,
+		E_CAL_SOURCE_TYPE_EVENT,
+		_("Select a Calendar"));
+
+	g_object_unref (attachment);
+	g_list_free (selected);
+}
+
+static void
+attachment_handler_import_to_tasks (GtkAction *action,
+                                    EAttachmentHandler *handler)
+{
+	EAttachment *attachment;
+	EAttachmentView *view;
+	GList *selected;
+	gpointer parent;
+
+	view = e_attachment_handler_get_view (handler);
+
+	parent = gtk_widget_get_toplevel (GTK_WIDGET (view));
+	parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+	g_return_if_fail (g_list_length (selected) == 1);
+	attachment = E_ATTACHMENT (selected->data);
+
+	attachment_handler_run_dialog (
+		parent, attachment,
+		E_CAL_SOURCE_TYPE_TODO,
+		_("Select a Task List"));
+
+	g_object_unref (attachment);
+	g_list_free (selected);
+}
+
+static GtkActionEntry standard_entries[] = {
+
+	{ "import-to-calendar",
+	  "stock_mail-import",
+	  N_("I_mport to Calendar"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (attachment_handler_import_to_calendar) },
+
+	{ "import-to-tasks",
+	  "stock_mail-import",
+	  N_("I_mport to Tasks"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (attachment_handler_import_to_tasks) }
+};
+
+static void
+attachment_handler_calendar_update_actions (EAttachmentView *view)
+{
+	EAttachment *attachment;
+	GtkAction *action;
+	GList *selected;
+	icalcomponent *component;
+	icalcomponent *subcomponent;
+	icalcomponent_kind kind;
+	gboolean is_vevent = FALSE;
+	gboolean is_vtodo = FALSE;
+
+	selected = e_attachment_view_get_selected_attachments (view);
+
+	if (g_list_length (selected) != 1)
+		goto exit;
+
+	attachment = E_ATTACHMENT (selected->data);
+	component = attachment_handler_get_component (attachment);
+
+	if (component == NULL)
+		goto exit;
+
+	subcomponent = icalcomponent_get_inner (component);
+
+	if (subcomponent == NULL)
+		goto exit;
+
+	kind = icalcomponent_isa (subcomponent);
+	is_vevent = (kind == ICAL_VEVENT_COMPONENT);
+	is_vtodo = (kind == ICAL_VTODO_COMPONENT);
+
+exit:
+	action = e_attachment_view_get_action (view, "import-to-calendar");
+	gtk_action_set_visible (action, is_vevent);
+
+	action = e_attachment_view_get_action (view, "import-to-tasks");
+	gtk_action_set_visible (action, is_vtodo);
+
+	g_list_foreach (selected, (GFunc) g_object_unref, NULL);
+	g_list_free (selected);
+}
+
+static void
+attachment_handler_calendar_constructed (GObject *object)
+{
+	EAttachmentHandler *handler;
+	EAttachmentView *view;
+	GtkActionGroup *action_group;
+	GtkUIManager *ui_manager;
+	const gchar *domain = GETTEXT_PACKAGE;
+	GError *error = NULL;
+
+	handler = E_ATTACHMENT_HANDLER (object);
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (parent_class)->constructed (object);
+
+	view = e_attachment_handler_get_view (handler);
+	ui_manager = e_attachment_view_get_ui_manager (view);
+
+	action_group = gtk_action_group_new ("calendar");
+	gtk_action_group_set_translation_domain (action_group, domain);
+	gtk_action_group_add_actions (
+		action_group, standard_entries,
+		G_N_ELEMENTS (standard_entries), handler);
+	gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+	g_object_unref (action_group);
+
+	gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
+
+	if (error != NULL) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+	}
+
+	g_signal_connect (
+		view, "update_actions",
+		G_CALLBACK (attachment_handler_calendar_update_actions),
+		NULL);
+}
+
+static void
+attachment_handler_calendar_class_init (EAttachmentHandlerCalendarClass *class)
+{
+	GObjectClass *object_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (EAttachmentHandlerCalendarPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->constructed = attachment_handler_calendar_constructed;
+}
+
+static void
+attachment_handler_calendar_init (EAttachmentHandlerCalendar *handler)
+{
+	handler->priv = E_ATTACHMENT_HANDLER_CALENDAR_GET_PRIVATE (handler);
+}
+
+GType
+e_attachment_handler_calendar_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo type_info = {
+			sizeof (EAttachmentHandlerCalendarClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) attachment_handler_calendar_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL,  /* class_data */
+			sizeof (EAttachmentHandlerCalendar),
+			0,     /* n_preallocs */
+			(GInstanceInitFunc) attachment_handler_calendar_init,
+			NULL   /* value_table */
+		};
+
+		type = g_type_register_static (
+			E_TYPE_ATTACHMENT_HANDLER,
+			"EAttachmentHandlerCalendar", &type_info, 0);
+	}
+
+	return type;
+}

Added: branches/kill-bonobo/calendar/gui/e-attachment-handler-calendar.h
==============================================================================
--- (empty file)
+++ branches/kill-bonobo/calendar/gui/e-attachment-handler-calendar.h	Fri Apr 10 11:05:55 2009
@@ -0,0 +1,65 @@
+/*
+ * e-attachment-handler-calendar.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>  
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_ATTACHMENT_HANDLER_CALENDAR_H
+#define E_ATTACHMENT_HANDLER_CALENDAR_H
+
+#include <widgets/misc/e-attachment-handler.h>
+
+/* Standard GObject macros */
+#define E_TYPE_ATTACHMENT_HANDLER_CALENDAR \
+	(e_attachment_handler_calendar_get_type ())
+#define E_ATTACHMENT_HANDLER_CALENDAR(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_ATTACHMENT_HANDLER_CALENDAR, EAttachmentHandlerCalendar))
+#define E_ATTACHMENT_HANDLER_CALENDAR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_ATTACHMENT_HANDLER_CALENDAR, EAttachmentHandlerCalendarClass))
+#define E_IS_ATTACHMENT_HANDLER_CALENDAR(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_ATTACHMENT_HANDLER_CALENDAR))
+#define E_IS_ATTACHMENT_HANDLER_CALENDAR_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_ATTACHMENT_HANDLER_CALENDAR))
+#define E_ATTACHMENT_HANDLER_CALENDAR_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_ATTACHMENT_HANDLER_CALENDAR, EAttachmentHandlerCalendarClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EAttachmentHandlerCalendar EAttachmentHandlerCalendar;
+typedef struct _EAttachmentHandlerCalendarClass EAttachmentHandlerCalendarClass;
+typedef struct _EAttachmentHandlerCalendarPrivate EAttachmentHandlerCalendarPrivate;
+
+struct _EAttachmentHandlerCalendar {
+	EAttachmentHandler parent;
+	EAttachmentHandlerCalendarPrivate *priv;
+};
+
+struct _EAttachmentHandlerCalendarClass {
+	EAttachmentHandlerClass parent_class;
+};
+
+GType		e_attachment_handler_calendar_get_type	(void);
+
+G_END_DECLS
+
+#endif /* E_ATTACHMENT_HANDLER_CALENDAR_H */

Modified: branches/kill-bonobo/calendar/modules/e-cal-shell-module.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-cal-shell-module.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-cal-shell-module.c	Fri Apr 10 11:05:55 2009
@@ -36,6 +36,7 @@
 #include "calendar/common/authentication.h"
 #include "calendar/gui/calendar-config.h"
 #include "calendar/gui/comp-util.h"
+#include "calendar/gui/e-attachment-handler-calendar.h"
 #include "calendar/gui/e-cal-config.h"
 #include "calendar/gui/e-cal-event.h"
 #include "calendar/gui/dialogs/cal-prefs-dialog.h"
@@ -541,4 +542,6 @@
 	cal_shell_module_init_hooks ();
 	cal_shell_module_init_importers ();
 	cal_shell_module_init_preferences (shell);
+
+	e_attachment_handler_calendar_get_type ();
 }

Modified: branches/kill-bonobo/composer/e-composer-private.c
==============================================================================
--- branches/kill-bonobo/composer/e-composer-private.c	(original)
+++ branches/kill-bonobo/composer/e-composer-private.c	Fri Apr 10 11:05:55 2009
@@ -152,7 +152,6 @@
 	/* Construct the attachment paned. */
 
 	widget = e_attachment_paned_new ();
-	/*gtk_container_set_border_width (GTK_CONTAINER (widget), 6);*/
 	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 	priv->attachment_paned = g_object_ref (widget);
 	gtk_widget_show (widget);

Modified: branches/kill-bonobo/composer/e-msg-composer.c
==============================================================================
--- branches/kill-bonobo/composer/e-msg-composer.c	(original)
+++ branches/kill-bonobo/composer/e-msg-composer.c	Fri Apr 10 11:05:55 2009
@@ -3419,7 +3419,10 @@
 				   !g_ascii_strcasecmp (header, "attachment")) {
 				EAttachment *attachment;
 
-				attachment = e_attachment_new_for_uri (content);
+				if (g_ascii_strncasecmp (content, "file:", 5) == 0)
+					attachment = e_attachment_new_for_uri (content);
+				else
+					attachment = e_attachment_new_for_path (content);
 				e_attachment_store_add_attachment (store, attachment);
 				e_attachment_load_async (
 					attachment, (GAsyncReadyCallback)

Modified: branches/kill-bonobo/configure.in
==============================================================================
--- branches/kill-bonobo/configure.in	(original)
+++ branches/kill-bonobo/configure.in	Fri Apr 10 11:05:55 2009
@@ -1780,7 +1780,7 @@
 plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN " 
 all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono"
 
-plugins_standard_always="bbdb subject-thread save-calendar copy-tool mail-to-task audio-inline mailing-list-actions default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates pst-import vcard-inline"
+plugins_standard_always="bbdb subject-thread save-calendar copy-tool mail-to-task audio-inline mailing-list-actions default-mailer prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates pst-import vcard-inline"
 
 plugins_standard="$plugins_standard_always"
 all_plugins_standard="$plugins_standard"
@@ -1802,7 +1802,6 @@
 dnl face
 dnl folder-unsubscribe
 dnl groupwise-features
-dnl import-ics-attachments
 dnl ipod-sync
 dnl itip-formatter
 dnl mailing-list-actions
@@ -2122,7 +2121,6 @@
 plugins/groupwise-features/Makefile
 plugins/hula-account-setup/Makefile
 plugins/imap-features/Makefile
-plugins/import-ics-attachments/Makefile
 plugins/ipod-sync/Makefile
 plugins/itip-formatter/Makefile
 plugins/mail-notification/Makefile

Modified: branches/kill-bonobo/mail/em-format-html-display.c
==============================================================================
--- branches/kill-bonobo/mail/em-format-html-display.c	(original)
+++ branches/kill-bonobo/mail/em-format-html-display.c	Fri Apr 10 11:05:55 2009
@@ -462,7 +462,7 @@
 		info->encrypt = emf->valid->encrypt.status;
 	}
 
-	camel_stream_write_string(
+	camel_stream_write_string (
 		stream, EM_FORMAT_HTML_VPAD
 		"<table cellspacing=0 cellpadding=0><tr><td>"
 		"<table width=10 cellspacing=0 cellpadding=0>"
@@ -1202,14 +1202,6 @@
 {
 	EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh;
 	struct _attach_puri *info;
-	GtkWidget *hbox, *w, *button, *mainbox;
-	char *simple_type;
-	GtkTargetEntry drag_types[] = {
-		{ NULL, 0, 0 },
-		{ "text/uri-list", 0, 1 },
-	};
-	AtkObject *a11y;
-
 	EAttachmentView *view;
 	EAttachmentStore *store;
 	EAttachment *attachment;
@@ -1259,39 +1251,6 @@
 		widget, "notify::expanded",
 		G_CALLBACK (efhd_attachment_button_expanded), info);
 
-#if 0
-	/* FIXME: offline parts, just get icon */
-	if (camel_content_type_is(((CamelDataWrapper *)pobject->part)->mime_type, "image", "*")) {
-		EMFormatHTMLJob *job;
-		GdkPixbuf *mini;
-		char *key;
-
-		key = pobject->classid;
-		mini = em_icon_stream_get_image(key, 24, 24);
-		if (mini) {
-			d(printf("got image from cache '%s'\n", key));
-			gtk_image_set_from_pixbuf((GtkImage *)w, mini);
-			g_object_unref(mini);
-		} else {
-			d(printf("need to create icon image '%s'\n", key));
-			job = em_format_html_job_new(efh, efhd_write_icon_job, pobject);
-			job->stream = (CamelStream *)em_icon_stream_new((GtkImage *)w, key, 24, 24, FALSE);
-			em_format_html_job_queue(efh, job);
-		}
-	}
-
-	drag_types[0].target = simple_type;
-	gtk_drag_source_set(button, GDK_BUTTON1_MASK, drag_types, sizeof(drag_types)/sizeof(drag_types[0]), GDK_ACTION_COPY);
-	g_signal_connect(button, "drag-data-get", G_CALLBACK(efhd_drag_data_get), pobject);
-	g_signal_connect (button, "drag-data-delete", G_CALLBACK(efhd_drag_data_delete), pobject);
-	g_free(simple_type);
-
-	g_signal_connect(button, "button_press_event", G_CALLBACK(efhd_attachment_popup), info);
-	g_signal_connect(button, "popup_menu", G_CALLBACK(efhd_attachment_popup_menu), info);
-	g_signal_connect(button, "clicked", G_CALLBACK(efhd_attachment_popup_menu), info);
-	gtk_box_pack_start((GtkBox *)mainbox, button, TRUE, TRUE, 0);
-#endif
-
 	return TRUE;
 }
 
@@ -1356,11 +1315,8 @@
                       CamelMimePart *part,
                       const EMFormatHandler *info)
 {
-	EMFormatHTMLDisplayPrivate *priv;
 	const char *classid = "attachment-bar";
 
-	priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (emf);
-
 	em_format_html_add_pobject (
 		EM_FORMAT_HTML (emf),
 		sizeof (EMFormatHTMLPObject),

Modified: branches/kill-bonobo/mail/em-popup.c
==============================================================================
--- branches/kill-bonobo/mail/em-popup.c	(original)
+++ branches/kill-bonobo/mail/em-popup.c	Fri Apr 10 11:05:55 2009
@@ -98,12 +98,6 @@
 
 		g_free(s->uri);
 		break; }
-	case EM_POPUP_TARGET_ATTACHMENTS: {
-		EMPopupTargetAttachments *s = (EMPopupTargetAttachments *)t;
-
-		g_slist_foreach(s->attachments, (GFunc)g_object_unref, NULL);
-		g_slist_free(s->attachments);
-		break; }
 	}
 
 	((EPopupClass *)emp_parent)->target_free(ep, t);
@@ -434,21 +428,11 @@
 	{ NULL }
 };
 
-static const EPopupHookTargetMask emph_attachments_masks[] = {
-	{ "one", EM_POPUP_ATTACHMENTS_ONE },
-	{ "many", EM_POPUP_ATTACHMENTS_MANY },
-	{ "multiple", EM_POPUP_ATTACHMENTS_MULTIPLE },
-	{ "image", EM_POPUP_ATTACHMENTS_IMAGE },
-	{ "message", EM_POPUP_ATTACHMENTS_MESSAGE },
-	{ NULL }
-};
-
 static const EPopupHookTargetMap emph_targets[] = {
 	{ "select", EM_POPUP_TARGET_SELECT, emph_select_masks },
 	{ "uri", EM_POPUP_TARGET_URI, emph_uri_masks },
 	{ "part", EM_POPUP_TARGET_PART, emph_part_masks },
 	{ "folder", EM_POPUP_TARGET_FOLDER, emph_folder_masks },
-	{ "attachments", EM_POPUP_TARGET_ATTACHMENTS, emph_attachments_masks },
 	{ NULL }
 };
 

Modified: branches/kill-bonobo/mail/em-popup.h
==============================================================================
--- branches/kill-bonobo/mail/em-popup.h	(original)
+++ branches/kill-bonobo/mail/em-popup.h	Fri Apr 10 11:05:55 2009
@@ -43,7 +43,6 @@
  * @EM_POPUP_TARGET_URI: A URI.
  * @EM_POPUP_TARGET_PART: A CamelMimePart message part.
  * @EM_POPUP_TARGET_FOLDER: A folder URI.
- * @EM_POPUP_TARGET_ATTACHMENTS: A list of attachments.
  *
  * Defines the value of the targetid for all EMPopup target types.
  **/
@@ -52,7 +51,6 @@
 	EM_POPUP_TARGET_URI,
 	EM_POPUP_TARGET_PART,
 	EM_POPUP_TARGET_FOLDER,
-	EM_POPUP_TARGET_ATTACHMENTS,
 };
 
 /**
@@ -158,26 +156,10 @@
 	EM_POPUP_FOLDER_NONSTATIC = 1<<6, /* Except static folders like Outbox.*/
 };
 
-/**
- * enum _em_popup_target_attachments_t - EMPopupTargetAttachments qualifiers.
- *
- * @EM_POPUP_ATTACHMENTS_ONE: There is one and only one attachment selected.
- * @EM_POPUP_ATTACHMENTS_MANY: There is one or more attachments selected.
- *
- **/
-enum _em_popup_target_attachments_t {
-	EM_POPUP_ATTACHMENTS_ONE = 1<<0, /* only 1 selected */
-	EM_POPUP_ATTACHMENTS_MANY = 1<<1, /* one or more selected */
-	EM_POPUP_ATTACHMENTS_MULTIPLE = 1<<2, /* More than 1 selected */
-	EM_POPUP_ATTACHMENTS_IMAGE = 1<<3, /* Image selected */
-	EM_POPUP_ATTACHMENTS_MESSAGE = 1<<4 /* Message selected */
-};
-
 typedef struct _EMPopupTargetSelect EMPopupTargetSelect;
 typedef struct _EMPopupTargetURI EMPopupTargetURI;
 typedef struct _EMPopupTargetPart EMPopupTargetPart;
 typedef struct _EMPopupTargetFolder EMPopupTargetFolder;
-typedef struct _EMPopupTargetAttachments EMPopupTargetAttachments;
 
 /**
  * struct _EMPopupTargetURI - An inline URI.
@@ -241,20 +223,6 @@
 	char *uri;
 };
 
-/**
- * struct _EMPopupTargetAttachments - A list of composer attachments.
- *
- * @target: Superclass.
- * @attachments: A GSList list of EMsgComposer attachments.
- *
- * This target is used to represent a selected list of attachments in
- * the message composer attachment area.
- **/
-struct _EMPopupTargetAttachments {
-	EPopupTarget target;
-	GSList *attachments;
-};
-
 typedef struct _EPopupItem EMPopupItem;
 
 /* The object */
@@ -276,7 +244,6 @@
 EMPopupTargetSelect *em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char *folder_uri, GPtrArray *uids);
 EMPopupTargetPart *em_popup_target_new_part(EMPopup *emp, struct _CamelMimePart *part, const char *mime_type);
 EMPopupTargetFolder *em_popup_target_new_folder(EMPopup *emp, const char *uri, guint32 info_flags, guint32 popup_flags);
-EMPopupTargetAttachments *em_popup_target_new_attachments(EMPopup *emp, GSList *attachments);
 
 /* ********************************************************************** */
 



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