[evolution-rss] correctly restore feed after failed edit



commit 85e464f806e5ea5ad54751219c17c007665354d8
Author: Lucian Langa <lucilanga gnome org>
Date:   Sun May 16 11:02:14 2010 +0300

    correctly restore feed after failed edit

 src/rss-config-factory.c |   35 ++++++++++++++++++++---------------
 src/rss.c                |   22 +++++++++++-----------
 src/rss.h                |    2 +-
 3 files changed, 32 insertions(+), 27 deletions(-)
---
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index aee1310..d8a08e4 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -1081,59 +1081,62 @@ save_feed_hash(gpointer name)
 // s - feed structure to restore
 // upon return s structure is destroyed
 void
-restore_feed_hash(gpointer name, hrfeed *s)
+restore_feed_hash(hrfeed *s)
 {
 	g_hash_table_insert(
-		rf->hrname, g_strdup(name), s->hrname);
+		rf->hrname, s->hrname_r, s->hrname);
 	g_hash_table_insert(
-		rf->hrname_r, g_strdup(lookup_key(name)), s->hrname_r);
+		rf->hrname_r, s->hrname, s->hrname_r);
 	g_hash_table_insert(
 		rf->hre,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hre));
 	g_hash_table_insert(
 		rf->hrh,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrh));
 	g_hash_table_insert(
 		rf->hrt,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrt));
 	g_hash_table_insert(
-		rf->hr, g_strdup(lookup_key(name)), s->hr);
+		rf->hr, g_strdup(s->hrname), s->hr);
 	g_hash_table_insert(
 		rf->hrdel_feed,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrdel_feed));
 	g_hash_table_insert(
 		rf->hrdel_days,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrdel_days));
 	g_hash_table_insert(
 		rf->hrdel_messages,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrdel_messages));
 	g_hash_table_insert(
 		rf->hrdel_unread,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrdel_unread));
 	g_hash_table_insert(
 		rf->hrdel_notpresent,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrdel_notpresent));
 	g_hash_table_insert(
 		rf->hrupdate,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrupdate));
 	g_hash_table_insert(
 		rf->hrttl,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrttl));
 	g_hash_table_insert(
 		rf->hrttl_multiply,
-		g_strdup(lookup_key(name)),
+		g_strdup(s->hrname),
 		GINT_TO_POINTER(s->hrttl_multiply));
 	g_free(s);
+	g_hash_table_destroy(rf->feed_folders);
+	g_hash_table_destroy(rf->reversed_feed_folders);
+	get_feed_folders();
 }
 
 void
@@ -3337,7 +3340,9 @@ rss_folder_factory (EPlugin *epl, EConfigHookItemFactoryData *data)
 			goto out;
 
 	ofolder = lookup_original_folder(folder, &found);
+	g_print("ofolder:%s\n", ofolder);
 	key = lookup_key(ofolder);
+	g_print("key:%s\n", key);
 	if (!key) {
 		g_free(ofolder);
 		goto out;
diff --git a/src/rss.c b/src/rss.c
index e9d9c12..405ada9 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -1450,10 +1450,9 @@ migrate_old_config(gchar *feed_file)
 	}
 }
 
-guint
+void
 read_feeds(rssfeed *rf)
 {
-	guint res = 0;
 	gchar *feed_dir = rss_component_peek_base_directory();
 	gchar *feed_file;
 
@@ -1510,9 +1509,7 @@ read_feeds(rssfeed *rf)
 	else
 		load_gconf_feed();
 
-	res = 1;
 	g_free(feed_file);
-	return res;
 }
 
 static void
@@ -3166,10 +3163,12 @@ void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t)
 	}
 
 #if (EVOLUTION_VERSION >= 22703)
-normal:	gtk_tree_store_set (
-		t->store, t->iter,
-		COL_STRING_ICON_NAME, "rss-16",
-		-1);
+normal:
+	//if (key)
+		gtk_tree_store_set (
+			t->store, t->iter,
+			COL_STRING_ICON_NAME, "rss-16",
+			-1);
 #else
 normal:	if (!initialised) { //move this to startup
 		iconfile = g_build_filename (EVOLUTION_ICONDIR,
@@ -3641,7 +3640,7 @@ add:
 out:	rf->pending = FALSE;
 	if (!rf->setup && feed->cancelable != NULL) {
 		void (*f)() = (GFunc)feed->cancelable;
-		f(crc_feed, feed->cancelable_arg);
+		f(feed->cancelable_arg);
 	} else if (feed->ok != NULL) {
 		void (*f)() = (GFunc)feed->ok;
 		f(feed->ok_arg);
@@ -3670,6 +3669,7 @@ setup_feed(add_feed *feed)
 	check_folders();
 	prepare_hashes();
 
+	rf->setup = 0;
 	rf->pending = TRUE;
 
 //	if (!feed->validate)
@@ -5522,7 +5522,7 @@ org_gnome_evolution_rss(void *ep, EMPopupTargetSelect *t)
 	if (!g_hash_table_find(rf->hre, check_if_enabled, NULL))
 		return;
 
-	if (!rf->setup || g_hash_table_size(rf->hrname)<1) {
+	if (g_hash_table_size(rf->hrname)<1) {
 		taskbar_push_message(_("No RSS feeds configured!"));
 		return;
 	}
@@ -5798,7 +5798,7 @@ e_plugin_lib_enable(EPlugin *ep, int enable)
 				VERSION);
 			rf = malloc(sizeof(rssfeed));
 			memset(rf, 0, sizeof(rssfeed));
-			rf->setup = read_feeds(rf);
+			read_feeds(rf);
 			rf->pending = FALSE;
 			rf->progress_dialog = NULL;
 			rf->errdialog = NULL;
diff --git a/src/rss.h b/src/rss.h
index 8acb9e6..295ac6b 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -376,7 +376,7 @@ gboolean feed_new_from_xml(char *xml);
 char *feeds_uid_from_xml (const char *xml);
 void load_gconf_feed(void);
 void migrate_old_config(gchar *feed_file);
-guint read_feeds(rssfeed *rf);
+void read_feeds(rssfeed *rf);
 void reload_cb (GtkWidget *button, gpointer data);
 void gecko_set_preferences(void);
 void browser_copy_selection(



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