File evolution-rss-EMailPart.patch of Package evolution-rss
From 6f0baabc697accf70b524a7baab91865f335daa3 Mon Sep 17 00:00:00 2001
From: Lucian Langa <lucilanga@gnome.org>
Date: Fri, 24 May 2013 23:53:39 +0000
Subject: adapt to EMailPart changes
---
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);
}
--
cgit v0.9.2
From bd99a69f924c52e3970e566974fb4b2aa5b6c1c8 Mon Sep 17 00:00:00 2001
From: Lucian Langa <lucilanga@gnome.org>
Date: Thu, 04 Jul 2013 18:28:31 +0000
Subject: add missing files from EMailPart modifications
---
diff --git a/src/e-mail-part-rss.c b/src/e-mail-part-rss.c
new file mode 100644
index 0000000..224a13b
--- /dev/null
+++ b/src/e-mail-part-rss.c
@@ -0,0 +1,122 @@
+
+#include "e-mail-part-rss.h"
+
+
+#define E_MAIL_PART_RSS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_PART_RSS, EMailPartRSSPrivate))
+
+struct _EMailPartRSSPrivate {
+ gint placeholder;
+};
+
+G_DEFINE_DYNAMIC_TYPE (
+ EMailPartRSS,
+ e_mail_part_rss,
+ E_TYPE_MAIL_PART)
+
+static void
+mail_part_rss_dispose (GObject *object)
+{
+ /*EMailPartAudio *part = E_MAIL_PART_AUDIO (object);
+
+ if (part->bus_id > 0) {
+ g_source_remove (part->bus_id);
+ part->bus_id = 0;
+ }
+
+ if (part->playbin != NULL) {
+ gst_element_set_state (part->playbin, GST_STATE_NULL);
+ gst_object_unref (part->playbin);
+ part->playbin = NULL;
+ }
+ g_clear_object (&part->play_button);
+ g_clear_object (&part->pause_button);
+ g_clear_object (&part->stop_button);*/
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_mail_part_rss_parent_class)->dispose (object);
+}
+
+static void
+mail_part_rss_finalize (GObject *object)
+{
+ //EMailPartAudio *part = E_MAIL_PART_AUDIO (object);
+
+ //if (part->filename != NULL) {
+ // g_unlink (part->filename);
+ // g_free (part->filename);
+ //}
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_mail_part_rss_parent_class)->finalize (object);
+}
+
+static void
+mail_part_rss_constructed (GObject *object)
+{
+ EMailPart *part;
+ CamelMimePart *mime_part;
+ CamelContentType *content_type;
+ gchar *mime_type;
+
+ part = E_MAIL_PART (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_mail_part_rss_parent_class)->constructed (object);
+
+ //e_mail_part_set_is_attachment (part, TRUE);
+ mime_part = e_mail_part_ref_mime_part (part);
+
+ content_type = camel_mime_part_get_content_type (mime_part);
+ mime_type = camel_content_type_simple (content_type);
+ e_mail_part_set_mime_type (part, mime_type);
+ g_free (mime_type);
+
+ g_object_unref (mime_part);
+}
+
+static void
+e_mail_part_rss_class_init (EMailPartRSSClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (EMailPartRSSPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = mail_part_rss_dispose;
+ object_class->finalize = mail_part_rss_finalize;
+ object_class->constructed = mail_part_rss_constructed;
+}
+
+static void
+e_mail_part_rss_class_finalize (EMailPartRSSClass *class)
+{
+}
+
+static void
+e_mail_part_rss_init (EMailPartRSS *part)
+{
+ part->priv = E_MAIL_PART_RSS_GET_PRIVATE (part);
+}
+
+void
+e_mail_part_rss_type_register (GTypeModule *type_module)
+{
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_mail_part_rss_register_type (type_module);
+}
+
+EMailPart *
+e_mail_part_rss_new (CamelMimePart *mime_part,
+ const gchar *id)
+{
+ g_return_val_if_fail (id != NULL, NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_PART_RSS,
+ "id", id, "mime-part", mime_part, NULL);
+}
+
diff --git a/src/e-mail-part-rss.h b/src/e-mail-part-rss.h
new file mode 100644
index 0000000..01a616f
--- /dev/null
+++ b/src/e-mail-part-rss.h
@@ -0,0 +1,57 @@
+
+#ifndef E_MAIL_PART_RSS_H
+#define E_MAIL_PART_RSS_H
+
+#include <em-format/e-mail-part.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_PART_RSS \
+ (e_mail_part_rss_get_type ())
+#define E_MAIL_PART_RSS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_PART_RSS, EMailPartRSS))
+#define E_MAIL_PART_RSS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_PART_RSS, EMailPartRSSClass))
+#define E_IS_MAIL_PART_RSS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_PART_RSS))
+#define E_IS_MAIL_PART_RSS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_PART_RSS))
+#define E_MAIL_PART_RSS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_PART_RSS, EMailPartRSSClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailPartRSS EMailPartRSS;
+typedef struct _EMailPartRSSClass EMailPartRSSClass;
+typedef struct _EMailPartRSSPrivate EMailPartRSSPrivate;
+
+struct _EMailPartRSS {
+ EMailPart parent;
+ EMailPartRSSPrivate *priv;
+
+ // gchar *filename;
+ // GstElement *playbin;
+ //gulong bus_id;
+ // GstState target_state;
+ // GtkWidget *play_button;
+ // GtkWidget *pause_button;
+// GtkWidget *stop_button;
+};
+
+struct _EMailPartRSSClass {
+ EMailPartClass parent_class;
+};
+
+GType e_mail_part_rss_get_type (void) G_GNUC_CONST;
+void e_mail_part_rss_type_register (GTypeModule *type_module);
+EMailPart * e_mail_part_rss_new (CamelMimePart *mime_part,
+ const gchar *id);
+
+G_END_DECLS
+
+#endif /* E_MAIL_PART_RSS_H */
+
--
cgit v0.9.2
From 7b753f7a26bbd645b185192bb84ebd7412293c5d Mon Sep 17 00:00:00 2001
From: Lucian Langa <lucilanga@gnome.org>
Date: Fri, 14 Jun 2013 19:56:26 +0000
Subject: Use GdkRGBA to get theme colors
---
diff --git a/src/e-mail-formatter-evolution-rss.c b/src/e-mail-formatter-evolution-rss.c
index 3496d19..5180972 100644
--- a/src/e-mail-formatter-evolution-rss.c
+++ b/src/e-mail-formatter-evolution-rss.c
@@ -126,7 +126,6 @@ emfe_evolution_rss_format (EMailFormatterExtension *extension,
camel_stream_write_string (
stream, str, cancellable, NULL);
gchar *h = g_strdup(e_web_view_get_html (E_WEB_VIEW (rss_get_display())));
- g_print("h:%s\n\n\n\n", h);
website = camel_medium_get_header (
CAMEL_MEDIUM (message), "Website");
@@ -168,11 +167,11 @@ emfe_evolution_rss_format (EMailFormatterExtension *extension,
}
}
- frame_col = e_color_to_value ((GdkColor *)
+ frame_col = e_rgba_to_value (
e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_FRAME));
- cont_col = e_color_to_value ((GdkColor *)
+ cont_col = e_rgba_to_value ((GdkColor *)
e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_CONTENT));
- text_col = e_color_to_value ((GdkColor *)
+ text_col = e_rgba_to_value ((GdkColor *)
e_mail_formatter_get_color (formatter, E_MAIL_FORMATTER_COLOR_TEXT));
if (!is_html && !rss_get_current_view()) {
--
cgit v0.9.2