[evolution-rss] Default to masking xml errors Lots of feeds out there are badly xml-formated and/or contains errors



commit 013b57d7dfb580b4e3466788e6c39d2ebcdc3e5b
Author: Lucian Langa <lucilanga gnome org>
Date:   Tue Apr 23 23:49:25 2013 +0200

    Default to masking  xml errors
    Lots of feeds out there are badly xml-formated and/or contains errors.
    There is no point in spamming the user with xml errors.
    It might be activated by triggering 'show-xml-errors' value

 ...e.evolution.plugin.evolution-rss.gschema.xml.in |    5 +++++
 src/rss.c                                          |    4 ++++
 src/rss.h                                          |    1 +
 3 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/org.gnome.evolution.plugin.evolution-rss.gschema.xml.in 
b/src/org.gnome.evolution.plugin.evolution-rss.gschema.xml.in
index 27ceb5c..127657d 100644
--- a/src/org.gnome.evolution.plugin.evolution-rss.gschema.xml.in
+++ b/src/org.gnome.evolution.plugin.evolution-rss.gschema.xml.in
@@ -135,6 +135,11 @@
       <summary>Show articles comments</summary>
       <description>If a feed article has comments, it will be displayed.</description>
     </key>
+    <key name="show-xml-errors" type="b">
+      <default>false</default>
+      <summary>Report xml errors</summary>
+      <description>Print xml errors in the feeds</description>
+    </key>
     <key name="use-proxy" type="b">
       <default>false</default>
       <summary>Use proxy server</summary>
diff --git a/src/rss.c b/src/rss.c
index 55a0f12..32c747e 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -2233,6 +2233,10 @@ generic_finish_feed(rfMessage *msg, gpointer user_data)
        xmlSubstituteEntitiesDefaultValue = 1;
        r->cache = xml_parse_sux (response->str, response->len);
        if (rsserror) {
+               GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+               if (!g_settings_get_boolean (settings,
+                       CONF_SHOW_XML_ERRORS))
+                               goto out;
                gchar *title = g_strdup_printf(
                                _("Error while parsing feed: %s"),
                                (gchar *)user_data);
diff --git a/src/rss.h b/src/rss.h
index 18ecb55..f542a99 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -223,6 +223,7 @@ typedef struct _rssfeed {
 #define CONF_SEARCH_RSS "search-rss"
 #define CONF_FEED_ICON "feed-icon"
 #define CONF_SHOW_COMMENTS "show-comments"
+#define CONF_SHOW_XML_ERRORS "show-xml-errors"
 #endif
 
 enum {


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