[evolution/webkit: 15/102] Adapt all plugins to the new EMFormat API
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 15/102] Adapt all plugins to the new EMFormat API
- Date: Fri, 6 Jan 2012 09:26:20 +0000 (UTC)
commit 82c4860bba2a69b450d6d6a22dea7a7cecc63668
Author: Dan VrÃtil <dvratil redhat com>
Date: Fri Aug 26 16:23:37 2011 +0200
Adapt all plugins to the new EMFormat API
The itip-features, mail-to-task, prefer-plain and vcard-inline plugins
are known to work very well now, though all of them need to be
thoroughly tested.
plugins/audio-inline/audio-inline.c | 55 ++++++++---------
plugins/external-editor/external-editor.c | 2 +-
plugins/itip-formatter/itip-formatter.c | 85 +++++++++++++--------------
plugins/mail-to-task/mail-to-task.c | 10 +--
plugins/prefer-plain/prefer-plain.c | 92 ++++++++++++++---------------
plugins/vcard-inline/vcard-inline.c | 60 +++++++++----------
6 files changed, 145 insertions(+), 159 deletions(-)
---
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c
index a5e7ccd..c79fd34 100644
--- a/plugins/audio-inline/audio-inline.c
+++ b/plugins/audio-inline/audio-inline.c
@@ -47,8 +47,10 @@ void org_gnome_audio_inline_format (gpointer ep, EMFormatHookTarget *t);
static volatile gint org_gnome_audio_class_id_counter = 0;
-struct _org_gnome_audio_inline_pobject {
- EMFormatHTMLPObject object;
+typedef struct _EMFormatInlineAudioPURI EMFormatInlineAudioPURI;
+
+struct _EMFormatInlineAudioPURI {
+ EMFormatPURI puri;
CamelMimePart *part;
gchar *filename;
@@ -61,9 +63,9 @@ struct _org_gnome_audio_inline_pobject {
};
static void
-org_gnome_audio_inline_pobject_free (EMFormatHTMLPObject *o)
+org_gnome_audio_inline_pobject_free (EMFormatPURI *o)
{
- struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) o;
+ EMFormatInlineAudioPURI *po = (EMFormatInlineAudioPURI *) o;
d(printf ("audio inline formatter: pobject free\n"));
@@ -106,9 +108,9 @@ org_gnome_audio_inline_pobject_free (EMFormatHTMLPObject *o)
static void
org_gnome_audio_inline_pause_clicked (GtkWidget *button,
- EMFormatHTMLPObject *pobject)
+ EMFormatPURI *puri)
{
- struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject;
+ EMFormatInlineAudioPURI *po = (EMFormatInlineAudioPURI *) puri;
if (po->playbin) {
/* pause playing */
@@ -118,9 +120,9 @@ org_gnome_audio_inline_pause_clicked (GtkWidget *button,
static void
org_gnome_audio_inline_stop_clicked (GtkWidget *button,
- EMFormatHTMLPObject *pobject)
+ EMFormatPURI *puri)
{
- struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject;
+ EMFormatInlineAudioPURI *po = (EMFormatInlineAudioPURI *) puri;
if (po->playbin) {
/* ready to play */
@@ -150,7 +152,7 @@ org_gnome_audio_inline_gst_callback (GstBus *bus,
GstMessage *message,
gpointer data)
{
- struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) data;
+ EMFormatInlineAudioPURI *po = (EMFormatInlineAudioPURI *) data;
GstMessageType msg_type;
g_return_val_if_fail (po != NULL, TRUE);
@@ -195,9 +197,9 @@ org_gnome_audio_inline_gst_callback (GstBus *bus,
static void
org_gnome_audio_inline_play_clicked (GtkWidget *button,
- EMFormatHTMLPObject *pobject)
+ EMFormatPURI *puri)
{
- struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject;
+ EMFormatInlineAudioPURI *po = (EMFormatInlineAudioPURI *) puri;
GstState cur_state;
d(printf ("audio inline formatter: play\n"));
@@ -281,13 +283,13 @@ org_gnome_audio_inline_add_button (GtkWidget *box,
return button;
}
-static gboolean
-org_gnome_audio_inline_button_panel (EMFormatHTML *efh,
- GtkHTMLEmbedded *eb,
- EMFormatHTMLPObject *pobject)
+static GtkWidget*
+org_gnome_audio_inline_button_panel (EMFormat *emf,
+ EMFormatPURI *puri,
+ GCancellable *cancellable)
{
GtkWidget *box;
- struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject;
+ EMFormatInlineAudioPURI *po = (EMFormatInlineAudioPURI *) puri;
/* it is OK to call UI functions here, since we are called from UI thread */
@@ -297,18 +299,16 @@ org_gnome_audio_inline_button_panel (EMFormatHTML *efh,
po->stop_button = g_object_ref (org_gnome_audio_inline_add_button (box, GTK_STOCK_MEDIA_STOP, G_CALLBACK (org_gnome_audio_inline_stop_clicked), po, FALSE));
gtk_widget_show (box);
- gtk_container_add ((GtkContainer *) eb, box);
- return TRUE;
+ return box;
}
void
org_gnome_audio_inline_format (gpointer ep,
EMFormatHookTarget *t)
{
- struct _org_gnome_audio_inline_pobject *pobj;
+ EMFormatInlineAudioPURI *pobj;
gchar *classid;
- gchar *content;
classid = g_strdup_printf (
"org-gnome-audio-inline-button-panel-%d",
@@ -318,21 +318,16 @@ org_gnome_audio_inline_format (gpointer ep,
d(printf ("audio inline formatter: format classid %s\n", classid));
- pobj = (struct _org_gnome_audio_inline_pobject *)
- em_format_html_add_pobject (
- (EMFormatHTML *) t->format, sizeof (*pobj), classid,
- t->part, org_gnome_audio_inline_button_panel);
- pobj->part = g_object_ref (t->part);
+ pobj = (EMFormatInlineAudioPURI *) em_format_puri_new (
+ t->format, sizeof (EMFormatInlineAudioPURI), t->part, classid);
+ pobj->puri.widget_func = org_gnome_audio_inline_button_panel;
+ pobj->puri.part = g_object_ref (t->part);
pobj->filename = NULL;
pobj->playbin = NULL;
pobj->play_button = NULL;
pobj->stop_button = NULL;
pobj->pause_button = NULL;
pobj->bus_id = 0;
- pobj->object.free = org_gnome_audio_inline_pobject_free;
+ pobj->puri.free = org_gnome_audio_inline_pobject_free;
pobj->target_state = GST_STATE_NULL;
-
- content = g_strdup_printf ("<object classid=%s></object>\n", classid);
- camel_stream_write_string (t->stream, content, NULL, NULL);
- g_free (content);
}
diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c
index 7d67faa..434dcac 100644
--- a/plugins/external-editor/external-editor.c
+++ b/plugins/external-editor/external-editor.c
@@ -467,7 +467,7 @@ e_plugin_ui_init (GtkUIManager *manager,
EMsgComposer *composer)
{
GtkhtmlEditor *editor;
- EWebView *web_view;
+ EWebViewGtkHTML *web_view;
editor = GTKHTML_EDITOR (composer);
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 272eb3c..c24e2ce 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -49,7 +49,7 @@
#include "itip-view.h"
#include <misc/e-attachment.h>
-#define CLASSID "itip://"
+#define CLASSID "mail://itip."
#define CONF_KEY_DELETE "delete-processed"
#define d(x)
@@ -2178,9 +2178,9 @@ save_vcalendar_cb (GtkWidget *button,
static GtkWidget *
set_itip_error (struct _itip_puri *pitip,
- GtkContainer *container,
- const gchar *primary,
- const gchar *secondary)
+ GtkWidget *container,
+ const gchar *primary,
+ const gchar *secondary)
{
GtkWidget *vbox, *label;
gchar *message;
@@ -2201,15 +2201,14 @@ set_itip_error (struct _itip_puri *pitip,
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- gtk_container_add (container, vbox);
+ gtk_container_add (GTK_CONTAINER (container), vbox);
return vbox;
}
-static gboolean
+static GtkWidget*
extract_itip_data (struct _itip_puri *pitip,
- GtkContainer *container,
- gboolean *have_alarms)
+ gboolean *have_alarms)
{
EShell *shell;
EShellSettings *shell_settings;
@@ -2221,16 +2220,19 @@ extract_itip_data (struct _itip_puri *pitip,
icalcompiter alarm_iter;
ECalComponent *comp;
gboolean use_default_reminder;
+ GtkWidget *container;
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
+ container = gtk_vbox_new (FALSE, 5);
+
if (!pitip->vcalendar) {
set_itip_error (pitip, container,
_("The calendar attached is not valid"),
_("The message claims to contain a calendar, but the calendar is not a valid iCalendar."));
- return FALSE;
+ return container;
}
pitip->top_level = e_cal_util_new_top_level ();
@@ -2246,7 +2248,7 @@ extract_itip_data (struct _itip_puri *pitip,
pitip->main_comp = NULL;
}
- return FALSE;
+ return container;
}
prop = icalcomponent_get_first_property (pitip->main_comp, ICAL_METHOD_PROPERTY);
@@ -2282,7 +2284,7 @@ extract_itip_data (struct _itip_puri *pitip,
_("The item in the calendar is not valid"),
_("The message does contain a calendar, but the calendar contains no events, tasks or free/busy information"));
- return FALSE;
+ return container;
}
switch (icalcomponent_isa (pitip->ical_comp)) {
@@ -2309,7 +2311,7 @@ extract_itip_data (struct _itip_puri *pitip,
set_itip_error (pitip, container,
_("The item in the calendar is not valid"),
_("The message does contain a calendar, but the calendar contains no events, tasks or free/busy information"));
- return FALSE;
+ return container;
}
pitip->total = icalcomponent_count_components (pitip->main_comp, ICAL_VEVENT_COMPONENT);
@@ -2336,7 +2338,7 @@ extract_itip_data (struct _itip_puri *pitip,
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
g_signal_connect (save, "clicked", G_CALLBACK (save_vcalendar_cb), pitip);
- return FALSE;
+ return container;
} if (pitip->total > 0) {
pitip->current = 1;
} else {
@@ -2419,7 +2421,7 @@ extract_itip_data (struct _itip_puri *pitip,
_("The item in the calendar is not valid"),
_("The message does contain a calendar, but the calendar contains no events, tasks or free/busy information"));
- return FALSE;
+ return container;
};
/* Add default reminder if the config says so */
@@ -2470,7 +2472,9 @@ extract_itip_data (struct _itip_puri *pitip,
find_from_address (pitip, pitip->ical_comp);
find_to_address (pitip, pitip->ical_comp, NULL);
- return TRUE;
+ gtk_widget_destroy (container);
+
+ return NULL;
}
struct _opencal_msg {
@@ -2685,8 +2689,9 @@ in_proper_folder (CamelFolder *folder)
}
static GtkWidget*
-format_itip_object (EMFormatHTML *efh,
- EMFormatHTMLPObject *pobject)
+format_itip_object (EMFormat *emf,
+ EMFormatPURI *puri,
+ GCancellable *cancellable)
{
EShell *shell;
EShellSettings *shell_settings;
@@ -2702,11 +2707,13 @@ format_itip_object (EMFormatHTML *efh,
gint i;
gboolean response_enabled;
gboolean have_alarms = FALSE;
+ GtkWidget *err_widget;
+ EMFormatHTML *efh = (EMFormatHTML *) emf;
shell = e_shell_get_default ();
shell_settings = e_shell_get_shell_settings (shell);
- info = (struct _itip_puri *) em_format_find_puri ((EMFormat *) efh, pobject->classid);
+ info = (struct _itip_puri *) puri;
/* Accounts */
info->accounts = e_get_account_list ();
@@ -2722,10 +2729,8 @@ format_itip_object (EMFormatHTML *efh,
}
/* FIXME Handle multiple VEVENTS with the same UID, ie detached instances */
-#if 0 /* WEBKIT - FIXME!! */
- if (!extract_itip_data (info, GTK_CONTAINER (eb), &have_alarms))
- return TRUE;
-#endif
+ if ((err_widget = extract_itip_data (info, &have_alarms)) != NULL)
+ return err_widget;
info->view = itip_view_new ();
gtk_widget_show (info->view);
@@ -3071,35 +3076,34 @@ format_itip (EPlugin *ep,
EMFormatHookTarget *target)
{
GSettings *settings;
- gchar *classid;
struct _itip_puri *puri;
CamelDataWrapper *content;
CamelStream *stream;
GByteArray *byte_array;
- gchar *string;
+ gint len;
- classid = g_strdup_printf("itip:///%s", ((EMFormat *) target->format)->part_id->str);
+ len = target->part_id->len;
+ g_string_append_printf (target->part_id, ".itip");
/* mark message as containing calendar, thus it will show the icon in message list now on */
- if (target->format->uid && target->format->folder &&
- !camel_folder_get_message_user_flag (target->format->folder, target->format->uid, "$has_cal"))
- camel_folder_set_message_user_flag (target->format->folder, target->format->uid, "$has_cal", TRUE);
-
- puri = (struct _itip_puri *) em_format_add_puri (target->format, sizeof (struct _itip_puri), classid, target->part, itip_attachment_frame);
-
- em_format_html_add_pobject ((EMFormatHTML *) target->format, sizeof (EMFormatHTMLPObject), classid, target->part, format_itip_object);
+ if (target->format->message_uid && target->format->folder &&
+ !camel_folder_get_message_user_flag (target->format->folder, target->format->message_uid, "$has_cal"))
+ camel_folder_set_message_user_flag (target->format->folder, target->format->message_uid, "$has_cal", TRUE);
settings = g_settings_new ("org.gnome.evolution.plugin.itip");
+
+ puri = (struct _itip_puri *) em_format_puri_new (target->format, sizeof (struct _itip_puri), target->part, target->part_id->str);
+ puri->puri.widget_func = format_itip_object;
+ puri->puri.free = puri_free;
puri->delete_message = g_settings_get_boolean (settings, CONF_KEY_DELETE);
puri->has_organizer = FALSE;
puri->no_reply_wanted = FALSE;
puri->folder = ((EMFormat *) target->format)->folder;
- puri->uid = g_strdup (((EMFormat *) target->format)->uid);
+ puri->uid = g_strdup (((EMFormat *) target->format)->message_uid);
puri->msg = ((EMFormat *) target->format)->message;
puri->part = target->part;
puri->cancellable = g_cancellable_new ();
puri->real_comps = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
- puri->puri.free = puri_free;
g_object_unref (settings);
@@ -3117,16 +3121,7 @@ format_itip (EPlugin *ep,
(gchar *) byte_array->data, byte_array->len);
g_object_unref (stream);
-
- string = g_strdup_printf (
- "<table border=0 width=\"100%%\" cellpadding=3><tr>"
- "<td valign=top><object classid=\"%s\"></object></td>"
- "<td width=100%% valign=top></td></tr></table>",
- classid);
- camel_stream_write_string (target->stream, string, NULL, NULL);
- g_free (string);
-
- g_free (classid);
+ g_string_truncate (target->part_id, len);
}
static void
@@ -3303,6 +3298,7 @@ itip_attachment_frame (EMFormat *emf,
EMFormatPURI *puri,
GCancellable *cancellable)
{
+ /* FIXME WEBKIT: I have no idea what these _frame functions are supposed to do
struct _itip_puri *info = (struct _itip_puri *) puri;
info->handle->handler (
@@ -3310,5 +3306,6 @@ itip_attachment_frame (EMFormat *emf,
info->handle, cancellable, FALSE);
camel_stream_close (stream, cancellable, NULL);
+ */
}
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index a4713c5..11f7648 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -1045,18 +1045,16 @@ text_contains_nonwhitespace (const gchar *text,
static gchar *
get_selected_text (EMailReader *reader)
{
- EMFormatHTML *formatter;
- EWebView *web_view;
+ EMailDisplay *display;
gchar *text = NULL;
gint len;
- formatter = e_mail_reader_get_formatter (reader);
- web_view = em_format_html_get_web_view (formatter);
+ display = e_mail_reader_get_mail_display (reader);
- if (!e_web_view_is_selection_active (web_view))
+ if (!e_mail_display_is_selection_active (display))
return NULL;
- text = gtk_html_get_selection_plain_text (GTK_HTML (web_view), &len);
+ text = e_mail_display_get_selection_plain_text (display, &len);
if (text == NULL || !text_contains_nonwhitespace (text, len)) {
g_free (text);
diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c
index 5a8c4b6..79d3bb0 100644
--- a/plugins/prefer-plain/prefer-plain.c
+++ b/plugins/prefer-plain/prefer-plain.c
@@ -49,14 +49,12 @@ static gboolean epp_show_suppressed = TRUE;
static void
make_part_attachment (EMFormat *format,
- CamelStream *stream,
- CamelMimePart *part,
- gint i)
+ CamelMimePart *part,
+ GString *part_id,
+ gboolean force_html,
+ GCancellable *cancellable)
{
- gint partidlen = format->part_id->len;
-
- if (i != -1)
- g_string_append_printf (format->part_id, ".alternative-prefer-plain.%d", i);
+ EMFormatParserInfo info = {0};
if (camel_content_type_is (camel_mime_part_get_content_type (part), "text", "html")) {
/* always show HTML as attachments and not inline */
@@ -68,11 +66,9 @@ make_part_attachment (EMFormat *format,
g_free (str);
}
- /* FIXME Not passing a GCancellable here. */
- em_format_part_as (
- format, stream, part,
- "application/octet-stream", NULL);
- } else if (i == -1 && CAMEL_IS_MIME_MESSAGE (part)) {
+ em_format_parse_part_as (
+ format, part, part_id, &info, "application/octet-stream", cancellable);
+ } else if (force_html && CAMEL_IS_MIME_MESSAGE (part)) {
/* message was asked to be formatted as text/html;
* might be for cases where message itself is a text/html part */
CamelMimePart *new_part;
@@ -84,15 +80,13 @@ make_part_attachment (EMFormat *format,
new_part = camel_mime_part_new ();
camel_medium_set_content (CAMEL_MEDIUM (new_part), content);
- em_format_part (format, stream, new_part, NULL);
+ em_format_parse_part (format, new_part, part_id, &info, cancellable);
g_object_unref (new_part);
} else {
/* FIXME Not passing a GCancellable here. */
- em_format_part (format, stream, part, NULL);
+ em_format_parse_part (format, part, part_id, &info, cancellable);
}
-
- g_string_truncate (format->part_id, partidlen);
}
void
@@ -101,28 +95,30 @@ org_gnome_prefer_plain_text_html (gpointer ep,
{
/* In text-only mode, all html output is suppressed for the first processing */
if (epp_mode != EPP_TEXT
- || strstr (t->format->part_id->str, ".alternative-prefer-plain.") != NULL
- || em_format_is_inline (t->format, t->format->part_id->str, t->part, &(t->item->handler)))
+ || strstr (t->part_id->str, ".alternative-prefer-plain.") != NULL
+ || em_format_is_inline (t->format, t->part_id->str, t->part, t->info->handler)) {
/* FIXME Not passing a GCancellable here. */
- t->item->handler.old->handler (
- t->format, t->stream, t->part,
- t->item->handler.old, NULL, FALSE);
- else if (epp_show_suppressed)
- make_part_attachment (t->format, t->stream, t->part, -1);
+ t->info->handler->old->parse_func (
+ t->format, t->part, t->part_id,
+ t->info, NULL);
+ } else if (epp_show_suppressed)
+ make_part_attachment (t->format, t->part, t->part_id, TRUE, NULL);
}
static void
export_as_attachments (CamelMultipart *mp,
- EMFormat *format,
- CamelStream *stream,
- CamelMimePart *except)
+ EMFormat *format,
+ CamelMimePart *except,
+ GString *part_id)
{
gint i, nparts;
CamelMimePart *part;
+ gint len;
if (!mp || !CAMEL_IS_MULTIPART (mp))
return;
+ len = part_id->len;
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts; i++) {
part = camel_multipart_get_part (mp, i);
@@ -130,11 +126,13 @@ export_as_attachments (CamelMultipart *mp,
if (part != except) {
CamelMultipart *multipart = (CamelMultipart *) camel_medium_get_content ((CamelMedium *) part);
+ g_string_append_printf (part_id, ".aleternative-prefer-plain.%d", i);
if (CAMEL_IS_MULTIPART (multipart)) {
- export_as_attachments (multipart, format, stream, except);
+ export_as_attachments (multipart, format, except, part_id);
} else {
- make_part_attachment (format, stream, part, i);
+ make_part_attachment (format, part, part_id, FALSE, NULL);
}
+ g_string_truncate (part_id, len);
}
}
}
@@ -148,7 +146,7 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep,
gint i, nparts, partidlen, displayid = 0, calendarid = 0;
/* FIXME: this part-id stuff is poking private data, needs api */
- partidlen = t->format->part_id->len;
+ partidlen = t->part_id->len;
if (epp_mode == EPP_NORMAL) {
gboolean have_plain = FALSE;
@@ -185,21 +183,20 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep,
}
if (display_part && have_plain && nparts == 2) {
- g_string_append_printf (t->format->part_id, ".alternative-prefer-plain.%d", displayid);
+ g_string_append_printf (t->part_id, ".alternative-prefer-plain.%d", displayid);
/* FIXME Not passing a GCancellable here. */
- em_format_part_as (
- t->format, t->stream,
- display_part, "text/html", NULL);
- g_string_truncate (t->format->part_id, partidlen);
+ em_format_parse_part_as (
+ t->format, display_part, t->part_id, t->info, "text/html", NULL);
+ g_string_truncate (t->part_id, partidlen);
} else {
/* FIXME Not passing a GCancellable here. */
- t->item->handler.old->handler (
- t->format, t->stream, t->part,
- t->item->handler.old, NULL, FALSE);
+ t->info->handler->old->parse_func (
+ t->format, display_part, t->part_id,
+ t->info, NULL);
}
return;
} else if (!CAMEL_IS_MULTIPART (mp)) {
- em_format_format_source (t->format, t->stream, t->part, NULL);
+ em_format_parse_part_as (t->format, t->part, t->part_id, t->info, "x-evolution/message/source", NULL);
return;
}
@@ -224,21 +221,22 @@ org_gnome_prefer_plain_multipart_alternative (gpointer ep,
/* if we found a text part, show it */
if (display_part) {
- g_string_append_printf(t->format->part_id, ".alternative-prefer-plain.%d", displayid);
+ g_string_append_printf(t->part_id, ".alternative-prefer-plain.%d", displayid);
/* FIXME Not passing a GCancellable here. */
- em_format_part_as (
- t->format, t->stream,
- display_part, "text/plain", NULL);
- g_string_truncate (t->format->part_id, partidlen);
+ em_format_parse_part_as (
+ t->format, display_part, t->part_id, t->info, "text/plain", NULL);
+ g_string_truncate (t->part_id, partidlen);
}
/* all other parts are attachments */
if (epp_show_suppressed)
- export_as_attachments (mp, t->format, t->stream, display_part);
- else if (calendar_part)
- make_part_attachment (t->format, t->stream, calendar_part, calendarid);
+ export_as_attachments (mp, t->format, display_part, t->part_id);
+ else if (calendar_part) {
+ g_string_append_printf(t->part_id, ".alternative-prefer-plain.%d", calendarid);
+ make_part_attachment (t->format, calendar_part, t->part_id, FALSE, NULL);
+ }
- g_string_truncate (t->format->part_id, partidlen);
+ g_string_truncate (t->part_id, partidlen);
}
static struct {
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index cfe461b..16829b3 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -36,10 +36,10 @@
#define d(x)
-typedef struct _VCardInlinePObject VCardInlinePObject;
+typedef struct _VCardInlinePURI VCardInlinePURI;
-struct _VCardInlinePObject {
- EMFormatHTMLPObject object;
+struct _VCardInlinePURI {
+ EMFormatPURI puri;
GSList *contact_list;
ESourceList *source_list;
@@ -61,11 +61,11 @@ e_plugin_lib_enable (EPlugin *ep,
}
static void
-org_gnome_vcard_inline_pobject_free (EMFormatHTMLPObject *object)
+org_gnome_vcard_inline_pobject_free (EMFormatPURI *object)
{
- VCardInlinePObject *vcard_object;
+ VCardInlinePURI *vcard_object;
- vcard_object = (VCardInlinePObject *) object;
+ vcard_object = (VCardInlinePURI *) object;
e_client_util_free_object_slist (vcard_object->contact_list);
vcard_object->contact_list = NULL;
@@ -87,7 +87,7 @@ org_gnome_vcard_inline_pobject_free (EMFormatHTMLPObject *object)
}
static void
-org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object,
+org_gnome_vcard_inline_decode (VCardInlinePURI *vcard_object,
CamelMimePart *mime_part)
{
CamelDataWrapper *data_wrapper;
@@ -157,7 +157,7 @@ org_gnome_vcard_inline_client_loaded_cb (ESource *source,
}
static void
-org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
+org_gnome_vcard_inline_save_cb (VCardInlinePURI *vcard_object)
{
ESource *source;
GSList *contact_list;
@@ -192,7 +192,7 @@ org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object)
}
static void
-org_gnome_vcard_inline_toggle_cb (VCardInlinePObject *vcard_object,
+org_gnome_vcard_inline_toggle_cb (VCardInlinePURI *vcard_object,
GtkButton *button)
{
EABContactDisplay *contact_display;
@@ -215,19 +215,20 @@ org_gnome_vcard_inline_toggle_cb (VCardInlinePObject *vcard_object,
gtk_button_set_label (button, label);
}
-static gboolean
-org_gnome_vcard_inline_embed (EMFormatHTML *format,
- GtkHTMLEmbedded *embedded,
- EMFormatHTMLPObject *object)
+static GtkWidget*
+org_gnome_vcard_inline_embed (EMFormat *emf,
+ EMFormatPURI *object,
+ GCancellable *cancellable)
{
- VCardInlinePObject *vcard_object;
+ VCardInlinePURI *vcard_object;
GtkWidget *button_box;
GtkWidget *container;
GtkWidget *widget;
+ GtkWidget *layout;
EContact *contact;
guint length;
- vcard_object = (VCardInlinePObject *) object;
+ vcard_object = (VCardInlinePURI *) object;
length = g_slist_length (vcard_object->contact_list);
if (vcard_object->contact_list != NULL)
@@ -235,13 +236,10 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
else
contact = NULL;
- container = GTK_WIDGET (embedded);
+ layout = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (layout);
- widget = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (container), widget);
- gtk_widget_show (widget);
-
- container = widget;
+ container = layout;
widget = gtk_hbutton_box_new ();
gtk_button_box_set_layout (
@@ -313,14 +311,14 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format,
G_CALLBACK (org_gnome_vcard_inline_save_cb),
vcard_object);
- return TRUE;
+ return layout;
}
void
org_gnome_vcard_inline_format (gpointer ep,
EMFormatHookTarget *target)
{
- VCardInlinePObject *vcard_object;
+ VCardInlinePURI *vcard_object;
gchar *classid;
gchar *content;
@@ -328,23 +326,23 @@ org_gnome_vcard_inline_format (gpointer ep,
"org-gnome-vcard-inline-display-%d",
org_gnome_vcard_inline_classid++);
- vcard_object = (VCardInlinePObject *)
- em_format_html_add_pobject (
- EM_FORMAT_HTML (target->format),
- sizeof (VCardInlinePObject),
- classid, target->part,
- org_gnome_vcard_inline_embed);
+ vcard_object = (VCardInlinePURI *) em_format_puri_new (
+ target->format, sizeof(VCardInlinePURI), target->part, classid);
+ vcard_object->puri.widget_func = org_gnome_vcard_inline_embed;
+ vcard_object->puri.free = org_gnome_vcard_inline_pobject_free;
- g_object_ref (target->part);
+ em_format_add_puri (target->format, (EMFormatPURI *) vcard_object);
- vcard_object->object.free = org_gnome_vcard_inline_pobject_free;
+ g_object_ref (target->part);
org_gnome_vcard_inline_decode (vcard_object, target->part);
e_book_client_get_sources (&vcard_object->source_list, NULL);
+ /* FIXME WEBKIT: No streams, right?
content = g_strdup_printf ("<object classid=%s></object>", classid);
camel_stream_write_string (target->stream, content, NULL, NULL);
g_free (content);
+ */
g_free (classid);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]