[evolution-rss] fix editing feeds



commit 62d3590aa7215f07999c4ab958c697566da44456
Author: Lucian Langa <lucilanga gnome org>
Date:   Mon May 3 23:55:55 2010 +0300

    fix editing feeds

 TODO                     |    2 +-
 src/notification.c       |    2 ++
 src/rss-config-factory.c |   16 ++++++++--------
 src/rss.c                |   12 +++++++++++-
 src/rss.h                |    4 ++++
 5 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/TODO b/TODO
index 12165cf..6a66426 100644
--- a/TODO
+++ b/TODO
@@ -40,4 +40,4 @@
 	* split rss feed
 	* possibly completely disable messagefiltering at setup_feed
 	* after deletion properties list is not updated, or not in sync
-	* fix editing feeds
+	* delete of articles not present does not work when no deletion option selected
diff --git a/src/notification.c b/src/notification.c
index 82b47d0..679b424 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -312,6 +312,8 @@ taskbar_op_set_progress(gchar *key, gchar *msg, gdouble progress)
 	EActivity *activity_id;
 #endif
 
+	g_return_if_fail(key != NULL);
+
 #if (EVOLUTION_VERSION < 22900) //kb//
 	activity_handler = mail_component_peek_activity_handler
 				(mail_component_peek ());
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index e975cf5..f97fee7 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -1432,14 +1432,14 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
 			}
 			saved_feed = save_feed_hash(feed_name);
 			remove_feed_hash(feed_name);
-			md5 = gen_md5(feed->feed_url);
-			if (!setup_feed(feed)) {
-				//editing might loose a corectly setup feed
-				//so re-add previous deleted feed
-				restore_feed_hash(key, saved_feed);
-			} else
-				destroy_feed_hash_content(saved_feed);
-			g_free(md5);
+			feed->ok = (GFunc)destroy_feed_hash_content;
+			feed->ok_arg = saved_feed;
+			feed->cancelable = (GFunc)restore_feed_hash;
+			feed->cancelable_arg = saved_feed;
+			setup_feed(feed);
+			/* move destory after finish_setup_feed */
+			gtk_widget_destroy(msg_feeds);
+			return;
 		} else {
 			key = gen_md5(url);
 			g_hash_table_replace(rf->hrh,
diff --git a/src/rss.c b/src/rss.c
index d8250bc..b6ee2c2 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -3559,6 +3559,7 @@ add:
 
 	//search for a feed entry
 	if (gconf_client_get_bool (rss_gconf, GCONF_KEY_SEARCH_RSS, NULL)) {
+		dp("searching new feed\n");
 		rssurl = search_rss(content->str, content->len);
 		if (rssurl) {
 			if (doc)
@@ -3568,6 +3569,7 @@ add:
 			if (content)
 				g_string_free(content, 1);
 			feed->feed_url = rssurl;
+			g_print("rssurl:%s|\n", rssurl);
 
 			if (g_hash_table_find(
 					rf->hr,
@@ -3578,7 +3580,8 @@ add:
 					_("Feed already exists!"));
 				goto out;
 			}
-			setup_feed(g_memdup(feed, sizeof(feed)));
+			g_warning("Searching FOR feeds broken\n");
+			//setup_feed(g_memdup(feed, sizeof(feed)));
 			goto out;
 		}
 	}
@@ -3589,6 +3592,13 @@ add:
 		_("Invalid Feed"));
 
 out:	rf->pending = FALSE;
+	if (!rf->setup && feed->cancelable != NULL) {
+		void (*f)() = (GFunc)feed->cancelable;
+		f(crc_feed, feed->cancelable_arg);
+	} else if (feed->ok != NULL) {
+		void (*f)() = (GFunc)feed->ok;
+		f(feed->ok_arg);
+	}
 	aid = g_hash_table_lookup(rf->activity, crc_feed);
 	taskbar_op_finish(aid);
 	g_free(crc_feed);
diff --git a/src/rss.h b/src/rss.h
index cad9714..e45fef9 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -233,6 +233,10 @@ typedef struct ADD_FEED {
 	guint		update;	// feed update method global; ttl; disabled
 	gboolean	renamed;
 	gboolean	edit;
+	GFunc		*ok;
+	void		*ok_arg;
+	GFunc		*cancelable;
+	void		*cancelable_arg;
 } add_feed;
 
 typedef struct USERPASS {



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