Be sure to handle feed panel elements as HTML rather than text

While we are at it, use the new metadata API of KatzeItem.
This commit is contained in:
Dale Whittaker 2009-08-14 23:33:10 +02:00 committed by Christian Dywan
parent 74457cfd75
commit f48f47f372
2 changed files with 19 additions and 25 deletions

View file

@ -11,12 +11,6 @@
#include "feed-atom.h"
#define atom_get_link_attribute(item, attribute) \
(gchar*)g_object_get_data (G_OBJECT (item), attribute)
#define atom_set_link_attribute(item, attribute, value) \
g_object_set_data (G_OBJECT (item), attribute, value)
static gboolean
atom_is_valid (FeedParser* fparser)
{
@ -102,8 +96,8 @@ atom_get_link (KatzeItem* item,
gboolean newlink;
newlink = FALSE;
oldtype = atom_get_link_attribute (item, "linktype");
oldrel = atom_get_link_attribute (item, "linkrel");
oldtype = (gchar*)katze_item_get_meta_string (item, "feedpanel:linktype");
oldrel = (gchar*)katze_item_get_meta_string (item, "feedpanel:linkrel");
newtype = (gchar*)xmlGetProp (node, BAD_CAST "type");
newrel = (gchar*)xmlGetProp (node, BAD_CAST "rel");
@ -127,21 +121,21 @@ atom_get_link (KatzeItem* item,
if (newlink)
{
katze_item_set_uri (item, href);
atom_set_link_attribute (item, "linkrel", newrel);
atom_set_link_attribute (item, "linktype", newrel);
katze_item_set_meta_string (item, "feedpanel:linkrel", newrel);
katze_item_set_meta_string (item, "feedpanel:linktype", newtype);
}
else
{
xmlFree (href);
xmlFree (newrel);
xmlFree (newtype);
}
}
static gchar*
atom_get_title (FeedParser* fparser)
{
if (!katze_item_get_name (fparser->item))
const gchar* name;
if (!(name = katze_item_get_name (fparser->item)))
{
gchar* type;
@ -159,9 +153,10 @@ atom_get_title (FeedParser* fparser)
if (content)
return content;
}
}
return feed_get_element_string (fparser);
}
return g_strdup (name);
}
static void
atom_preparse_entry (FeedParser* fparser)
@ -245,8 +240,8 @@ atom_postparse_entry (FeedParser* fparser)
if (KATZE_IS_ITEM (fparser->item))
{
atom_set_link_attribute (fparser->item, "linkrel", NULL);
atom_set_link_attribute (fparser->item, "linktype", NULL);
katze_item_set_meta_string (fparser->item, "feedpanel:linkrel", NULL);
katze_item_set_meta_string (fparser->item, "feedpanel:linktype", NULL);
if (*fparser->error)
{
@ -330,8 +325,8 @@ atom_postparse_feed (FeedParser* fparser)
{
if (KATZE_IS_ARRAY (fparser->item))
{
atom_set_link_attribute (fparser->item, "linkrel", NULL);
atom_set_link_attribute (fparser->item, "linktype", NULL);
katze_item_set_meta_string (fparser->item, "feedpanel:linkrel", NULL);
katze_item_set_meta_string (fparser->item, "feedpanel:linktype", NULL);
}
if (!*fparser->error)

View file

@ -19,11 +19,10 @@
#define UPDATE_FREQ 10
#define feed_get_flags(feed) \
GPOINTER_TO_INT (g_object_get_data (G_OBJECT ((feed)), "flags"))
katze_item_get_meta_integer (KATZE_ITEM ((feed)), "feedpanel:flags")
#define feed_set_flags(feed, flags) \
g_object_set_data (G_OBJECT ((feed)), "flags", \
GINT_TO_POINTER ((flags)))
katze_item_set_meta_integer (KATZE_ITEM ((feed)), "feedpanel:flags", (flags))
#define feed_has_flags(feed, flags) \
((flags) & feed_get_flags ((feed)))