[evolution-rss] validate feed against added list of feeds too
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] validate feed against added list of feeds too
- Date: Sun, 11 Jul 2010 14:54:05 +0000 (UTC)
commit c8fce3121f009cea21d71f2330bc27d7eda63c06
Author: Lucian Langa <lucilanga gnome org>
Date: Sat Jul 10 20:16:42 2010 +0300
validate feed against added list of feeds too
src/rss-config-factory.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 0f06fb0..5b139de 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -65,6 +65,7 @@ extern int rss_verbose_debug;
#include "network-soup.h"
#include "notification.h"
+GHashTable *tmphash = NULL;
static guint feed_enabled = 0;
static guint feed_validate = 0;
static guint feed_html = 0;
@@ -1623,18 +1624,20 @@ import_one_feed(gchar *url, gchar *title, gchar *prefix)
feed->prefix = g_strdup(prefix);
rf->progress_bar = import_progress;
rf->progress_dialog = import_dialog;
- if (g_hash_table_find(
- rf->hr,
- check_if_match,
- feed->feed_url)) {
+ if ((g_hash_table_find(rf->hr, check_if_match,feed->feed_url))
+ || (g_hash_table_find(tmphash, check_if_match, feed->feed_url))) {
rss_error(
title,
feed->feed_name,
_("Error adding feed."),
_("Feed already exists!"));
rf->import--;
- } else
+ } else {
setup_feed(feed);
+ g_hash_table_insert(tmphash,
+ g_strdup(url),
+ g_strdup(url));
+ }
/* this allows adding feeds somewhat synchronous way
* it is very convenient to be able to cancel importing
@@ -1818,6 +1821,12 @@ error: rss_error(NULL,
src = src->children;
maintitle = (gchar *)layer_find(src, "title", NULL);
rf->import=2;
+ if (!tmphash)
+ tmphash = g_hash_table_new_full(
+ g_str_hash,
+ g_str_equal,
+ g_free,
+ g_free);
progress = 0;
rf->display_cancel=0; //clean this signal - as by this time we already cancel all displaying feed
while (src) {
@@ -1928,6 +1937,7 @@ fail: g_free(rssprefix);
}
goto out;
}
+ g_print("MARK #1\n");
while ((src = iterate_import_file(src, &url, &name, type))) {
if (url && strlen(url)) {
@@ -1957,7 +1967,9 @@ fail: g_free(rssprefix);
}
while (gtk_events_pending ())
gtk_main_iteration ();
-out: //prevent reseting queue before its time dues do async operations
+out: g_hash_table_destroy(tmphash);
+ tmphash=NULL;
+ //prevent reseting queue before its time dues do async operations
if (rf->import) rf->import -= 2;
rf->import_cancel = 0;
if (maintitle) xmlFree(maintitle);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]