[evolution-rss] adapt to EMailPart changes



commit 6f0baabc697accf70b524a7baab91865f335daa3
Author: Lucian Langa <lucilanga gnome org>
Date:   Sat May 25 01:53:39 2013 +0200

    adapt to EMailPart changes

 src/Makefile.am                      |    2 ++
 src/e-mail-formatter-evolution-rss.c |   11 +++++++----
 src/e-mail-parser-evolution-rss.c    |   20 ++++++--------------
 src/evolution-module-rss.c           |    2 ++
 4 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 7a86c1f..91f2671 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -116,6 +116,8 @@ evolution_module_rss_la_SOURCES =           \
        rss-status-icon.c                       \
        rss-icon-factory.c                      \
        dbus.c                                  \
+       e-mail-part-rss.c                       \
+       e-mail-part-rss.h                       \
        e-mail-parser-evolution-rss.c           \
        e-mail-parser-evolution-rss.h           \
        e-mail-formatter-evolution-rss.c        \
diff --git a/src/e-mail-formatter-evolution-rss.c b/src/e-mail-formatter-evolution-rss.c
index e500864..3496d19 100644
--- a/src/e-mail-formatter-evolution-rss.c
+++ b/src/e-mail-formatter-evolution-rss.c
@@ -35,6 +35,7 @@
 
 #include "misc.h"
 #include "rss-formatter.h"
+#include "e-mail-part-rss.h"
 
 
 typedef EMailFormatterExtension EMailFormatterRSS;
@@ -98,20 +99,21 @@ emfe_evolution_rss_format (EMailFormatterExtension *extension,
        gchar *str;
        GByteArray *ba;
        gchar *src;
-       CamelMimePart *message = (CamelMimePart *)part->part;
+       CamelMimePart *message = e_mail_part_ref_mime_part (part);
        gchar *website, *subject, *category, *feedid, *comments;
        guint32 frame_col, cont_col, text_col;
        gboolean is_html = NULL;
        gchar *feed_dir, *tmp_file, *tmp_path, *iconfile;
        GdkPixbuf *pixbuf;
 
-       CamelContentType *ct = camel_mime_part_get_content_type (part->part);
+
+       CamelContentType *ct = camel_mime_part_get_content_type (message);
        if (ct) {
                if (!camel_content_type_is (ct, "x-evolution", "evolution-rss-feed"))
                        return FALSE;
        }
 
-       dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
+       dw = camel_medium_get_content (CAMEL_MEDIUM (message));
        if (!dw) {
                return FALSE;
        }
@@ -119,7 +121,8 @@ emfe_evolution_rss_format (EMailFormatterExtension *extension,
        str = g_strdup_printf (
                "<object type=\"application/vnd.evolution.attachment\" "
                "height=\"0\" width=\"100%%\" data=\"%s\" id=\"%s\"></object>",
-               part->id, part->id);
+               e_mail_part_get_id(part),
+               e_mail_part_get_id(part));
        camel_stream_write_string (
                stream, str, cancellable, NULL);
        gchar *h = g_strdup(e_web_view_get_html (E_WEB_VIEW (rss_get_display())));
diff --git a/src/e-mail-parser-evolution-rss.c b/src/e-mail-parser-evolution-rss.c
index c815326..58f5c66 100644
--- a/src/e-mail-parser-evolution-rss.c
+++ b/src/e-mail-parser-evolution-rss.c
@@ -22,8 +22,6 @@
 #include <glib/gi18n.h>
 #include <camel/camel.h>
 
-#include "e-mail-parser-evolution-rss.h"
-
 #include <em-format/e-mail-extension-registry.h>
 #include <em-format/e-mail-parser-extension.h>
 #include <em-format/e-mail-part.h>
@@ -31,6 +29,9 @@
 
 #include <libebackend/libebackend.h>
 
+#include "e-mail-parser-evolution-rss.h"
+#include "e-mail-part-rss.h"
+
 
 typedef EMailParserExtension EMailParserRSS;
 typedef EMailParserExtensionClass EMailParserRSSClass;
@@ -44,12 +45,6 @@ G_DEFINE_DYNAMIC_TYPE (
 
 static const gchar* pser_mime_types[] = { "x-evolution/evolution-rss-feed", NULL };
 
-typedef struct _EMailPartRSS EMailPartRSS;
-
-struct _EMailPartRSS {
-       EMailPart parent;
-};
-
 static gboolean
 empe_evolution_rss_parse (EMailParserExtension *extension,
                                EMailParser *parser,
@@ -58,17 +53,14 @@ empe_evolution_rss_parse (EMailParserExtension *extension,
                                GCancellable *cancellable,
                                GQueue *out_mail_queue)
 {
-       EMailPartRSS *mail_part;
+       EMailPart *mail_part;
        GQueue work_queue = G_QUEUE_INIT;
        gint len;
 
        len = part_id->len;
 
-       mail_part = (EMailPartRSS *) e_mail_part_subclass_new (
-               part, part_id->str, sizeof (EMailPartRSS),
-               NULL);
-       mail_part->parent.mime_type = camel_content_type_simple (
-               camel_mime_part_get_content_type (part));
+       mail_part = e_mail_part_rss_new(part, part_id->str);
+
        g_string_truncate (part_id, len);
 
        g_queue_push_tail (&work_queue, mail_part);
diff --git a/src/evolution-module-rss.c b/src/evolution-module-rss.c
index fb03946..61fdbf2 100644
--- a/src/evolution-module-rss.c
+++ b/src/evolution-module-rss.c
@@ -20,6 +20,7 @@
 
 #include "e-mail-parser-evolution-rss.h"
 #include "e-mail-formatter-evolution-rss.h"
+#include "e-mail-part-rss.h"
 
 #include <gmodule.h>
 
@@ -31,6 +32,7 @@ G_MODULE_EXPORT void
 e_module_load (GTypeModule *type_module)
 {
        /* Register dynamically loaded types. */
+       e_mail_part_rss_type_register (type_module);
        e_mail_parser_evolution_rss_type_register (type_module);
        e_mail_formatter_evolution_rss_type_register (type_module);
 }


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