[Commits] [SCM] claws branch, master, updated. 3.10.1-176-g924f8c9

ticho at claws-mail.org ticho at claws-mail.org
Mon Oct 20 21:02:51 CEST 2014


The branch, master has been updated
       via  924f8c954834d9f28261f3884e23fe322f044a24 (commit)
      from  c77e9c8d6bc7e88be9e1e64b368dd999c0c3cf10 (commit)

Summary of changes:
 src/plugins/rssyl/rssyl_subscribe.c     |   12 ++++++++++++
 src/plugins/rssyl/rssyl_subscribe_gtk.c |    3 ++-
 src/plugins/rssyl/rssyl_subscribe_gtk.h |    1 +
 3 files changed, 15 insertions(+), 1 deletion(-)


- Log -----------------------------------------------------------------
commit 924f8c954834d9f28261f3884e23fe322f044a24
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Oct 20 21:00:57 2014 +0200

    RSSyl: when user chooses a different folder name for a newly subscribed feed, store the official title, so that it doesn't revert back after first feed update.

diff --git a/src/plugins/rssyl/rssyl_subscribe.c b/src/plugins/rssyl/rssyl_subscribe.c
index ac5453d..7cc30e9 100644
--- a/src/plugins/rssyl/rssyl_subscribe.c
+++ b/src/plugins/rssyl/rssyl_subscribe.c
@@ -66,6 +66,7 @@ gboolean rssyl_subscribe(FolderItem *parent, const gchar *url,
 	gint i = 1;
 	RSubCtx *sctx;
 	gboolean edit_properties = FALSE;
+	gchar *official_title = NULL;
 
 	g_return_val_if_fail(parent != NULL, FALSE);
 	g_return_val_if_fail(url != NULL, FALSE);
@@ -108,10 +109,16 @@ gboolean rssyl_subscribe(FolderItem *parent, const gchar *url,
 		}
 
 		edit_properties = sctx->edit_properties;
+		if (sctx->official_title != NULL) {
+			debug_print("RSSyl: custom official title\n");
+			official_title = g_strdup(sctx->official_title);
+		}
+
 		if (sctx->edit_properties)
 			debug_print("RSSyl: User wants to edit properties of the new feed.\n");
 		else
 			debug_print("RSSyl: User does not want to edit properties of the new feed.\n");
+		g_free(sctx->official_title);
 		g_free(sctx);
 	}
 
@@ -150,6 +157,11 @@ gboolean rssyl_subscribe(FolderItem *parent, const gchar *url,
 	ritem = (RFolderItem *)new_item;
 	ritem->url = g_strdup(ctx->feed->url);
 
+	if (official_title != NULL) {
+		debug_print("RSSyl: storing official feed title '%s'\n", official_title);
+		ritem->official_title = official_title;
+	}
+
 	if (feed_n_items(ctx->feed) > 0)
 		feed_foreach_item(ctx->feed, rssyl_subscribe_foreach_func, (gpointer)ritem);
 
diff --git a/src/plugins/rssyl/rssyl_subscribe_gtk.c b/src/plugins/rssyl/rssyl_subscribe_gtk.c
index 73a6728..932883c 100644
--- a/src/plugins/rssyl/rssyl_subscribe_gtk.c
+++ b/src/plugins/rssyl/rssyl_subscribe_gtk.c
@@ -100,7 +100,8 @@ void rssyl_subscribe_dialog(RSubCtx *ctx) {
 		/* Modify ctx->feed based on user changes in dialog */
 		newtitle = (gchar *)gtk_entry_get_text(GTK_ENTRY(title));
 		if (strcmp(feed_get_title(ctx->feed), newtitle)) {
-			debug_print("RSSyl: Using feed title '%s'\n", newtitle);
+			debug_print("RSSyl: Using user-supplied feed title '%s', instead of '%s'\n", newtitle, feed_get_title(ctx->feed));
+			ctx->official_title = g_strdup(feed_get_title(ctx->feed));
 			feed_set_title(ctx->feed, newtitle);
 		}
 		ctx->edit_properties =
diff --git a/src/plugins/rssyl/rssyl_subscribe_gtk.h b/src/plugins/rssyl/rssyl_subscribe_gtk.h
index e5c9e72..1023022 100644
--- a/src/plugins/rssyl/rssyl_subscribe_gtk.h
+++ b/src/plugins/rssyl/rssyl_subscribe_gtk.h
@@ -6,6 +6,7 @@
 struct _RSubCtx {
 	Feed *feed;
 	gboolean edit_properties;
+	gchar *official_title;
 };
 
 typedef struct _RSubCtx RSubCtx;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list