r2029 - in trunk/src/target/OM-2007/applications/openmoko-rssreader: . src
zecke at sita.openmoko.org
zecke at sita.openmoko.org
Sat May 19 00:15:14 CEST 2007
Author: zecke
Date: 2007-05-19 00:15:13 +0200 (Sat, 19 May 2007)
New Revision: 2029
Modified:
trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
Log:
2007-05-19 Holger Freyther <zecke at selfish.org>
Load data from the cache. Currently libmrss has some issues
parsing the data it wrote.
* src/callbacks.c:
(load_data_from_cache): Implement loading from cache,
* src/main.c: Call loading.
(main):
Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog 2007-05-18 21:59:58 UTC (rev 2028)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/ChangeLog 2007-05-18 22:15:13 UTC (rev 2029)
@@ -1,3 +1,13 @@
+2007-05-19 Holger Freyther <zecke at selfish.org>
+
+ Load data from the cache. Currently libmrss has some issues
+ parsing the data it wrote.
+
+ * src/callbacks.c:
+ (load_data_from_cache): Implement loading from cache,
+ * src/main.c: Call loading.
+ (main):
+
2007-05-18 Holger Freyther <zecke at selfish.org>
Start caching data
Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c 2007-05-18 21:59:58 UTC (rev 2028)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c 2007-05-18 22:15:13 UTC (rev 2029)
@@ -216,9 +216,44 @@
/**
* read the feeds from disk
+ * Similiar to the Thread, but
+ * -We do not run from a thread, so no gdk locking is necessary
+ * -We do not load from a url but from the cache
+ * -We do not need to cache ;)
*/
void load_data_from_cache (struct RSSReaderData *data)
{
+ gsize size;
+
+ for ( int i = 0; i < NUMBER_OF_FEEDS; ++i ) {
+ mrss_t *rss_data;
+ gchar *url = s_feeds[i].url;
+ g_debug ("Reading cached object '%s'\n", url);
+ gchar *content = moko_cache_read_object (data->cache, url, &size);
+ if ( !content || size == -1 ) {
+ g_debug ("Noting in the cache for '%s'\n", url);
+ continue;
+ }
+
+ int ret = mrss_parse_buffer( content, size, &rss_data );
+ if ( ret ) {
+ /* TODO use the footer to report error? */
+ g_debug( "parse_buffer of '%s' failed with '%d'", url, ret );
+ continue;
+ }
+
+ /*
+ * create the new item(s)
+ */
+ gdk_threads_leave();
+ add_mrss_item (data, rss_data, url, s_feeds[i].category);
+ gdk_threads_enter();
+
+ g_free (content);
+ mrss_free (rss_data);
+ }
+
+ g_debug ("Done loading from cache\n");
}
/*
Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c 2007-05-18 21:59:58 UTC (rev 2028)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c 2007-05-18 22:15:13 UTC (rev 2029)
@@ -299,8 +299,9 @@
/*
* load data
*/
+ data->is_all_filter = TRUE;
refresh_categories( data );
- data->is_all_filter = TRUE;
+ load_data_from_cache (data);
moko_menu_box_set_active_filter( data->menubox, _("All") );
gtk_widget_show_all( GTK_WIDGET(data->window) );
More information about the commitlog
mailing list