Send commitlog mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r1712 -
trunk/src/target/OM-2007/applications/openmoko-rssreader/src
([EMAIL PROTECTED])
--- Begin Message ---
Author: zecke
Date: 2007-04-08 18:59:10 +0200 (Sun, 08 Apr 2007)
New Revision: 1712
Modified:
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/application-data.h
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
Log:
openmoko-rssreader: Implement filtering the feed categories
Modified:
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/application-data.h
===================================================================
---
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/application-data.h
2007-04-08 00:42:26 UTC (rev 1711)
+++
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/application-data.h
2007-04-08 16:59:10 UTC (rev 1712)
@@ -55,6 +55,8 @@
GtkTextView *textView;
gchar *current_filter;
+ int is_all_filter;
+ gchar *current_search_text;
};
/*
Modified:
trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
2007-04-08 00:42:26 UTC (rev 1711)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/callbacks.c
2007-04-08 16:59:10 UTC (rev 1712)
@@ -56,6 +56,7 @@
* TODO: Use the ModelFilter to filter for All or Category
*/
void filter_feeds( struct RSSReaderData *data ) {
+ gtk_tree_model_filter_refilter (data->filter_model);
}
/*
@@ -82,6 +83,10 @@
g_free( data->current_filter );
data->current_filter = g_strdup( text );
+ /*
+ * shortcut for the later filter function
+ */
+ data->is_all_filter = strcmp( _( "All" ), text ) == 0;
filter_feeds( data );
return TRUE;
}
Modified: trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
2007-04-08 00:42:26 UTC (rev 1711)
+++ trunk/src/target/OM-2007/applications/openmoko-rssreader/src/main.c
2007-04-08 16:59:10 UTC (rev 1712)
@@ -32,11 +32,38 @@
#include <libmokoui/moko-details-window.h>
+#include <string.h>
#include <assert.h>
#define ASSERT_X(x, error) assert(x)
/*
+ * filter categories and such terms
+ */
+static gboolean
+rss_filter_entries (GtkTreeModel *model, GtkTreeIter *iter, struct
RSSReaderData *data)
+{
+ /*
+ * filter the category
+ */
+ if ( !data->is_all_filter ) {
+ gchar *category;
+ gtk_tree_model_get (model, iter, RSS_READER_COLUMN_CATEGORY,
&category, -1);
+
+
+ if ( strcmp(category, data->current_filter) != 0 )
+ return FALSE;
+ }
+
+
+ /*
+ * filter the text according to the search now
+ */
+
+ return TRUE;
+}
+
+/*
* sort the dates according to zsort. Ideally they should sort ascending
*/
static gint
@@ -109,6 +136,7 @@
* allow to filter for a search string
*/
data->filter_model =
GTK_TREE_MODEL_FILTER(gtk_tree_model_filter_new(GTK_TREE_MODEL(data->feed_data),NULL));
+ gtk_tree_model_filter_set_visible_func (data->filter_model,
(GtkTreeModelFilterVisibleFunc)rss_filter_entries, data, NULL);
/*
* Allow sorting of the base model
@@ -235,6 +263,7 @@
* load data
*/
refresh_categories( data );
+ data->is_all_filter = TRUE;
moko_menu_box_set_active_filter( data->menubox, _("All") );
gtk_widget_show_all( GTK_WIDGET(data->window) );
--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog