[evolution-rss] add support for no type opml entities
- From: Lucian Langa <lucilanga src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-rss] add support for no type opml entities
- Date: Thu, 31 Dec 2009 20:23:48 +0000 (UTC)
commit 726aa7e17e265a664498329b6dcebd0e9649925d
Author: Lucian Langa <lucilanga gnome org>
Date: Thu Dec 31 22:23:39 2009 +0200
add support for no type opml entities
TODO | 1 +
src/rss-config-factory.c | 38 +++++++++++++++++++++++++++-----------
src/rss.c | 14 ++++++++++----
src/rss.h | 2 +-
4 files changed, 39 insertions(+), 16 deletions(-)
---
diff --git a/TODO b/TODO
index f6ebc41..49d8e78 100644
--- a/TODO
+++ b/TODO
@@ -44,3 +44,4 @@
* hook all rss config options in RSS top folder properties in right click menu
* image contained in feeds displayed after the coments ??
* accept feeds clicked from mails - add feed option to right click context menu
+ * when delete folder remove any pending filter process
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index d178177..4c32b51 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -1319,7 +1319,7 @@ import_opml(gchar *file)
guint current = 0;
guint type = 0; //file type
gchar *what = NULL;
- gchar *msg, *tmp;
+ gchar *msg, *tmp, *maintitle;
GtkWidget *import_dialog = NULL;
GtkWidget *import_label;
GtkWidget *import_progress;
@@ -1422,8 +1422,14 @@ import_opml(gchar *file)
if (type == 0) {
gint size = 0;
- gchar *base = NULL, *root = NULL, *last = NULL;
+ gchar *base = NULL, *start = NULL, *root = NULL, *last = NULL;
gchar *rssprefix = NULL;
+ /* need to automate this, not just guess title at random */
+ src=src->children;
+ src = src->children;
+ src = src->next;
+ src = src->children;
+ maintitle = layer_find(src, "title", NULL);
while (src) {
gchar *rssurl = NULL, *rsstitle = NULL;
if (rf->cancel) {
@@ -1456,22 +1462,26 @@ import_opml(gchar *file)
}
if (src->name) {
gchar *prop = (gchar *)xmlGetProp(src, (xmlChar *)"type");
- if (prop) {
- if (!strcmp(prop, "folder")) {
+// if (prop) {
+ if ((prop && !strcmp(prop, "folder")) || !prop) {
base = (gchar *)xmlGetProp(src, (xmlChar *)"text");
if (NULL != src->last) {
gchar *tmp = root;
if (!root)
root = g_build_path("/", base, NULL);
- else
+ else {
root = g_build_path("/", root, base, NULL);
+ }
if (base) xmlFree(base);
if (tmp) g_free(tmp);
}
// we're insterested in rss/pie only
} else if (strcmp(prop, "link")) {
// && strcmp(prop, "vfolder")) {
- rssprefix = root;
+ if (maintitle)
+ rssprefix = g_build_path("/", maintitle, root, NULL);
+ else
+ rssprefix = g_strdup(root);
rssurl = (gchar *)xmlGetProp(src, (xmlChar *)"xmlUrl");
if (!rssurl)
goto fail;
@@ -1481,6 +1491,10 @@ import_opml(gchar *file)
gtk_label_set_ellipsize (GTK_LABEL (import_label), PANGO_ELLIPSIZE_START);
#endif
gtk_label_set_justify(GTK_LABEL(import_label), GTK_JUSTIFY_CENTER);
+
+ g_print("rssprefix:%s\n", rssprefix);
+ g_print("rssurl:%s\n", rssurl);
+ g_print("rsstitle:%s\n", rsstitle);
import_one_feed(rssurl, rsstitle, rssprefix);
if (rssurl) xmlFree(rssurl);
if (rsstitle) xmlFree(rsstitle);
@@ -1493,13 +1507,14 @@ fail: while (gtk_events_pending ())
what = g_strdup_printf(_("%2.0f%% done"), fr);
gtk_progress_bar_set_text((GtkProgressBar *)import_progress, what);
g_free(what);
+ g_free(rssprefix);
while (gtk_events_pending ())
gtk_main_iteration ();
store_redraw(GTK_TREE_VIEW(rf->treeview));
save_gconf_feed();
}
xmlFree(prop);
- }
+// }
}
}
goto out;
@@ -1539,8 +1554,8 @@ fail: while (gtk_events_pending ())
while (gtk_events_pending ())
gtk_main_iteration ();
out: rf->import = 0;
- if (doc)
- xmlFree(doc);
+ if (maintitle) xmlFree(maintitle);
+ if (doc) xmlFree(doc);
gtk_widget_destroy(import_dialog);
}
@@ -2545,6 +2560,7 @@ rss_folder_factory (EPlugin *epl, EConfigHookItemFactoryData *data)
GtkWidget *action_area, *ok;
GtkAccelGroup *accel_group = gtk_accel_group_new ();
gpointer key;
+ gboolean found;
//filter only rss folders
if (folder == NULL
@@ -2552,7 +2568,7 @@ rss_folder_factory (EPlugin *epl, EConfigHookItemFactoryData *data)
|| !g_ascii_strcasecmp(folder, main_folder))
goto out;
- ofolder = lookup_original_folder(folder);
+ ofolder = lookup_original_folder(folder, &found);
key = lookup_key(ofolder);
if (!key) {
g_free(ofolder);
@@ -2613,7 +2629,7 @@ rss_config_control_new (void)
{
GtkWidget *control_widget;
GtkWidget *button1, *button2, *button3;
- char *gladefile;
+ gchar *gladefile;
setupfeed *sf;
GtkListStore *store;
GtkTreeIter iter;
diff --git a/src/rss.c b/src/rss.c
index 0a91017..71a28ca 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -594,6 +594,7 @@ taskbar_op_finish(gchar *key)
#else
EActivity *activity_key = g_hash_table_lookup(rf->activity, key);
#endif
+ g_print("activity_key:%p\n", activity_key);
if (activity_key)
#if EVOLUTION_VERSION < 22900 //kb//
e_activity_handler_operation_finished(activity_handler, activity_key);
@@ -3764,18 +3765,22 @@ lookup_main_folder(void)
//lookup original name based on renamed folder
//
gchar *
-lookup_original_folder(gchar *folder)
+lookup_original_folder(gchar *folder, gboolean *found)
{
gchar *tmp = NULL, *ofolder = NULL;
tmp = extract_main_folder(folder);
if (tmp) {
ofolder = g_hash_table_lookup(rf->feed_folders, tmp);
+ dp("result ofolder:%s\n", ofolder);
if (ofolder) {
g_free(tmp);
+ if (found) *found = TRUE;
return g_strdup(ofolder);
- } else
+ } else {
+ if (found) *found = FALSE;
return tmp;
+ }
}
return NULL;
}
@@ -4147,8 +4152,8 @@ update_feed_folder(gchar *old_name, gchar *new_name, gboolean valid_folder)
orig_name = g_hash_table_lookup(rf->feed_folders, oname);
if (!orig_name) {
if (valid_folder) {
- ofolder = lookup_original_folder(old_name);
- if (!ofolder)
+ ofolder = lookup_original_folder(old_name, NULL); //perhaps supply found variable
+ if (!ofolder) // to test result
return 0;
else if (!lookup_key(ofolder))
return 0;
@@ -4312,6 +4317,7 @@ custom_update_articles(CDATA *cdata)
network_timeout();
// check if we're enabled and no cancelation signal pending
// and no imports pending
+ dp("cdata->key:%s\n", cdata->key);
if (g_hash_table_lookup(rf->hre, lookup_key(cdata->key)) && !rf->cancel && !rf->import) {
d("\nFetching: %s..%s\n",
(char *)g_hash_table_lookup(rf->hr, lookup_key(cdata->key)), (char *)cdata->key);
diff --git a/src/rss.h b/src/rss.h
index 7bbd288..ba395d1 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -359,7 +359,7 @@ gchar *lookup_chn_name_by_url(gchar *url);
gboolean update_articles(gboolean disabler);
gchar *lookup_main_folder(void);
gchar *lookup_feed_folder(gchar *folder);
-gchar *lookup_original_folder(gchar *folder);
+gchar *lookup_original_folder(gchar *folder, gboolean *found);
gchar *decode_utf8_entities(gchar *str);
gchar *decode_html_entities(gchar *str);
gchar *get_real_channel_name(gchar *uri, gchar *failed);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]