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. r2640 - in
      trunk/src/target/OM-2007.2/applications/openmoko-feedreader2: .
      src ([EMAIL PROTECTED])
   2. r2641 - in
      trunk/src/target/OM-2007.2/applications/openmoko-feedreader2: .
      src ([EMAIL PROTECTED])
   3. r2642 - in
      trunk/src/target/OM-2007.2/applications/openmoko-feedreader2: .
      src ([EMAIL PROTECTED])
--- Begin Message ---
Author: zecke
Date: 2007-08-05 23:21:18 +0200 (Sun, 05 Aug 2007)
New Revision: 2640

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.h
   
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-item-view.c
   
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
   
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.h
Log:
2007-08-05  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>

        Implement filtering of feeds again. Switch the position
        of Prev/Next and use the right stock items in feed_item_view_init.

        * src/feed-data.c:
        (feed_filter_filter_category): Implement
        (feed_filter_filter_text): Implement (similiar to _category)
        * src/feed-data.h:
        * src/feed-item-view.c:
        (feed_item_view_init):
        * src/feed-selection-view.c:
        (treeview_keypress_event): Filter key presses in the treeview and 
forward to the search entry
        (search_toggled):
        (search_entry_changed):
        (category_combo_update):
        (feed_selection_view_init):
        * src/feed-selection-view.h:



Modified: trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog      
2007-08-05 09:00:11 UTC (rev 2639)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog      
2007-08-05 21:21:18 UTC (rev 2640)
@@ -1,3 +1,22 @@
+2007-08-05  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>
+
+        Implement filtering of feeds again. Switch the position
+        of Prev/Next and use the right stock items in feed_item_view_init.
+
+        * src/feed-data.c:
+        (feed_filter_filter_category): Implement
+        (feed_filter_filter_text): Implement (similiar to _category)
+        * src/feed-data.h:
+        * src/feed-item-view.c:
+        (feed_item_view_init):
+        * src/feed-selection-view.c:
+        (treeview_keypress_event): Filter key presses in the treeview and 
forward to the search entry
+        (search_toggled):
+        (search_entry_changed):
+        (category_combo_update):
+        (feed_selection_view_init):
+        * src/feed-selection-view.h:
+
 2007-08-04  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>
 
         First version that can fetch feeds again and display some part of the

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c    
    2007-08-05 09:00:11 UTC (rev 2639)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c    
    2007-08-05 21:21:18 UTC (rev 2640)
@@ -27,11 +27,13 @@
 #include "feed-data.h"
 #include "feed-configuration.h"
 #include "rfcdate.h"
+#include "config.h"
 
 #include <mrss.h>
 #include <string.h>
 #include <stdlib.h>
 
+#include <glib/gi18n.h>
     
 static gboolean
 rss_filter_entries (GtkTreeModel *model, GtkTreeIter *iter, FeedFilter *data)
@@ -412,13 +414,24 @@
 }
 
 void
-feed_filter_filter_category (FeedFilter* filter, GtkTreeIter* iter)
+feed_filter_filter_category (FeedFilter* filter, const gchar* text)
 {
+    if (filter->category)
+        g_free (filter->category);
+
+    filter->category = g_strdup (text);
+    filter->is_all_filter = strcmp (_("All"), text) == 0;
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter));
 }
 
 void
 feed_filter_filter_text (FeedFilter* filter, const gchar* text)
 {
+    if (filter->filter_string)
+        g_free (filter->filter_string);
+
+    filter->filter_string = g_strdup (text);
+    gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter));
 }
 
 GObject*

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.h
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.h    
    2007-08-05 09:00:11 UTC (rev 2639)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.h    
    2007-08-05 21:21:18 UTC (rev 2640)
@@ -145,7 +145,7 @@
 GType       feed_filter_get_type        (void);
 GObject*    feed_filter_new             (const FeedData*);
 void        feed_filter_reset           (FeedFilter*);
-void        feed_filter_filter_category (FeedFilter*, GtkTreeIter*);
+void        feed_filter_filter_category (FeedFilter*, const gchar*);
 void        feed_filter_filter_text     (FeedFilter*, const gchar*);
 
 GType       feed_sort_get_type          (void);

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-item-view.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-item-view.c
   2007-08-05 09:00:11 UTC (rev 2639)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-item-view.c
   2007-08-05 21:21:18 UTC (rev 2640)
@@ -80,7 +80,7 @@
     GtkWidget* toolbar = gtk_toolbar_new ();
     gtk_box_pack_start (GTK_BOX(view), toolbar, FALSE, FALSE, 0);
 
-    view->back = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD);
+    view->back = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
     gtk_tool_item_set_expand (GTK_TOOL_ITEM(view->back), TRUE);
     gtk_toolbar_insert (GTK_TOOLBAR(toolbar), view->back, 0);
     g_signal_connect (view->back, "clicked", G_CALLBACK(prev_clicked), view);

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
      2007-08-05 09:00:11 UTC (rev 2639)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
      2007-08-05 21:21:18 UTC (rev 2640)
@@ -57,30 +57,80 @@
     g_free (message);
 }
 
-gboolean treeview_keypress_event( GtkWidget *tree_view, GdkEventKey *key, 
FeedSelectionView *data) {
+gboolean treeview_keypress_event( GtkWidget *tree_view, GdkEventKey *key, 
FeedSelectionView *view) {
     if (key->keyval == GDK_Left || key->keyval == GDK_Right || key->keyval == 
GDK_Up || key->keyval == GDK_Down)
         return FALSE;
     
-#if 0
-    moko_tool_box_set_search_visible (data->box, TRUE);
-    gtk_entry_set_text (GTK_ENTRY(moko_tool_box_get_entry(data->box)), "");
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->search_toggle), 
TRUE);
+    gtk_entry_set_text (GTK_ENTRY(view->search_entry), "");
+    GTK_WIDGET_CLASS(GTK_ENTRY_GET_CLASS(view->search_entry))->key_press_event 
(GTK_WIDGET(view->search_entry), key);
 
-    /*
-     * forward the key event
-     */
-    GtkEntry *entry = GTK_ENTRY(moko_tool_box_get_entry(data->box));
-    GTK_WIDGET_CLASS(GTK_ENTRY_GET_CLASS(entry))->key_press_event 
(GTK_WIDGET(entry), key);
-#endif
-
     return TRUE;
 }
 
 static void
+search_toggled (GtkWidget* button, FeedSelectionView* view)
+{
+    gboolean search_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(button));
+
+    if (search_active) {
+        gtk_widget_show (GTK_WIDGET (view->search_entry));
+        gtk_widget_hide (GTK_WIDGET (view->category_combo));
+        gtk_widget_grab_focus (GTK_WIDGET (view->search_entry));
+    } else {
+        gtk_widget_hide (GTK_WIDGET (view->search_entry));
+        gtk_widget_show (GTK_WIDGET (view->category_combo));
+    }
+}
+
+static void
+search_entry_changed (GtkEntry* entry, FeedSelectionView* view)
+{
+    feed_filter_filter_text (view->filter, gtk_entry_get_text (entry)); 
+}
+
+static void
 refresh_feeds_closure (GtkWidget* button, FeedSelectionView* view)
 {
     feed_data_update_all (RSS_FEED_DATA (feed_data_get_instance ()));
 }
 
+static void
+category_combo_update (FeedSelectionView* view, ...)
+{
+    gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model 
(GTK_COMBO_BOX (view->category_combo))));
+    gtk_combo_box_append_text (GTK_COMBO_BOX (view->category_combo), _("All"));
+
+    GtkTreeModel *store = GTK_TREE_MODEL (feed_configuration_get_configuration 
());
+    GtkTreeIter iter;
+
+    gboolean valid = gtk_tree_model_get_iter_first (store, &iter);
+    while (valid) {
+        gchar *category;
+        gtk_tree_model_get (store, &iter, FEED_NAME, &category, -1);
+
+        /*
+         * create the new item(s)
+         */
+        add_mrss_item (data, rss_data, url, category);
+
+        /*
+         * now cache the feed, a bit inefficient as we do not write to a file 
directly
+         */
+        if (buffer) {
+            moko_cache_write_object (data->cache, url, buffer, size, NULL);
+            free (buffer);
+        }
+
+        mrss_free( rss_data );
+
+next:
+        g_free (url);
+        g_free (category);
+        valid = gtk_tree_model_iter_next (store, &iter);
+    }
+}
+
 G_DEFINE_TYPE(FeedSelectionView, feed_selection_view, GTK_TYPE_VBOX)
 
 static void
@@ -106,7 +156,29 @@
     /*
      * search/filter
      */
+    GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
+    gtk_box_pack_start (GTK_BOX (view), hbox, FALSE, FALSE, 0);
 
+    view->search_toggle = gtk_toggle_button_new ();
+    gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (view->search_toggle), 
FALSE, FALSE, 0);
+    gtk_widget_set_name (GTK_WIDGET (view->search_toggle), "mokosearchbutton");
+    gtk_button_set_image (GTK_BUTTON (view->search_toggle), 
gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR));
+    g_signal_connect (G_OBJECT (view->search_toggle), "toggled", G_CALLBACK 
(search_toggled), view);
+
+    view->search_entry = GTK_ENTRY (gtk_entry_new ());
+    gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (view->search_entry), TRUE, 
TRUE, 0);
+    gtk_widget_set_name (GTK_WIDGET (view->search_entry), "mokosearchentry");
+    g_signal_connect (G_OBJECT (view->search_entry), "changed", G_CALLBACK 
(search_entry_changed), view);
+    g_object_set (G_OBJECT (view->search_entry), "no-show-all", TRUE, NULL);
+
+    view->category_combo = GTK_WIDGET (gtk_combo_box_new ());
+    gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (view->category_combo), 
TRUE, TRUE, 0);
+    category_combo_update (view);
+    g_signal_connect (G_OBJECT (view->category_combo), "changed", 
G_CALLBACK(category_selection_changed), view);
+    g_signal_connect_swapped (feed_configuration_get_configuration (), 
"row-changed",  G_CALLBACK(category_combo_update), view);
+    g_signal_connect_swapped (feed_configuration_get_configuration (), 
"row-inserted", G_CALLBACK(category_combo_update), view);
+    g_signal_connect_swapped (feed_configuration_get_configuration (), 
"row-deleted",  G_CALLBACK(category_combo_update), view);
+
     /*
      * selection view
      */

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.h
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.h
      2007-08-05 09:00:11 UTC (rev 2639)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.h
      2007-08-05 21:21:18 UTC (rev 2640)
@@ -49,6 +49,10 @@
 struct _FeedSelectionView {
     GtkVBox parent;
 
+    GtkEntry        *search_entry;
+    GtkWidget       *search_toggle;
+    GtkWidget       *category_combo;
+
     FeedFilter      *filter;
     FeedSort        *sort;   
     GtkTreeView     *view;




--- End Message ---
--- Begin Message ---
Author: zecke
Date: 2007-08-05 23:44:33 +0200 (Sun, 05 Aug 2007)
New Revision: 2641

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c
   
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
Log:
2007-08-05  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>

        Implement category filtering (and made sure it compiles). Feature wise
        it is 'enpar' with the old application again.

        * src/feed-data.c:
        (rss_filter_entries): Use FeedFilter::category for filtering categories
        * src/feed-selection-view.c:
        (category_combo_update): Fill the combobox with data
        (category_selection_changed): Get the current text and pass it to the 
FeedFilter
        (feed_selection_view_init): Create a ComboBox with the text model.



Modified: trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog      
2007-08-05 21:21:18 UTC (rev 2640)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog      
2007-08-05 21:44:33 UTC (rev 2641)
@@ -1,5 +1,17 @@
 2007-08-05  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>
 
+        Implement category filtering (and made sure it compiles). Feature wise
+        it is 'enpar' with the old application again.
+
+        * src/feed-data.c:
+        (rss_filter_entries): Use FeedFilter::category for filtering categories
+        * src/feed-selection-view.c:
+        (category_combo_update): Fill the combobox with data
+        (category_selection_changed): Get the current text and pass it to the 
FeedFilter
+        (feed_selection_view_init): Create a ComboBox with the text model.
+
+2007-08-05  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>
+
         Implement filtering of feeds again. Switch the position
         of Prev/Next and use the right stock items in feed_item_view_init.
 

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c    
    2007-08-05 21:21:18 UTC (rev 2640)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c    
    2007-08-05 21:44:33 UTC (rev 2641)
@@ -51,7 +51,7 @@
         if (!category)
             return FALSE;
 
-        if (strcmp(category, data->filter_string) != 0)
+        if (strcmp(category, data->category) != 0)
             return FALSE;
 
         g_free (category);

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
      2007-08-05 21:21:18 UTC (rev 2640)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c
      2007-08-05 21:44:33 UTC (rev 2641)
@@ -26,6 +26,7 @@
 
 #include "config.h"
 #include "feed-selection-view.h"
+#include "feed-configuration.h"
 
 #include <moko-finger-scroll.h>
 #include <glib/gi18n.h>
@@ -108,29 +109,23 @@
     while (valid) {
         gchar *category;
         gtk_tree_model_get (store, &iter, FEED_NAME, &category, -1);
-
-        /*
-         * create the new item(s)
-         */
-        add_mrss_item (data, rss_data, url, category);
-
-        /*
-         * now cache the feed, a bit inefficient as we do not write to a file 
directly
-         */
-        if (buffer) {
-            moko_cache_write_object (data->cache, url, buffer, size, NULL);
-            free (buffer);
-        }
-
-        mrss_free( rss_data );
-
-next:
-        g_free (url);
+        gtk_combo_box_append_text (GTK_COMBO_BOX (view->category_combo), 
category);
         g_free (category);
         valid = gtk_tree_model_iter_next (store, &iter);
     }
+
+    /*
+     * Make All active
+     */
+    gtk_combo_box_set_active (GTK_COMBO_BOX (view->category_combo), 0);
 }
 
+static void
+category_selection_changed (GtkComboBox* box, FeedSelectionView* view)
+{
+    feed_filter_filter_category (view->filter, gtk_combo_box_get_active_text 
(box));
+}
+
 G_DEFINE_TYPE(FeedSelectionView, feed_selection_view, GTK_TYPE_VBOX)
 
 static void
@@ -171,7 +166,7 @@
     g_signal_connect (G_OBJECT (view->search_entry), "changed", G_CALLBACK 
(search_entry_changed), view);
     g_object_set (G_OBJECT (view->search_entry), "no-show-all", TRUE, NULL);
 
-    view->category_combo = GTK_WIDGET (gtk_combo_box_new ());
+    view->category_combo = GTK_WIDGET (gtk_combo_box_new_text ());
     gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (view->category_combo), 
TRUE, TRUE, 0);
     category_combo_update (view);
     g_signal_connect (G_OBJECT (view->category_combo), "changed", 
G_CALLBACK(category_selection_changed), view);




--- End Message ---
--- Begin Message ---
Author: zecke
Date: 2007-08-06 00:50:00 +0200 (Mon, 06 Aug 2007)
New Revision: 2642

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c
Log:
2007-08-06  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>

        Remove old feed posts from the model only once the new posts
        were fetched and parsed.

        * src/feed-data.c:
        (remove_old_items):
        (feed_update_thread):
        (feed_data_update_all):



Modified: trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog      
2007-08-05 21:44:33 UTC (rev 2641)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog      
2007-08-05 22:50:00 UTC (rev 2642)
@@ -1,3 +1,13 @@
+2007-08-06  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>
+
+        Remove old feed posts from the model only once the new posts
+        were fetched and parsed.
+
+        * src/feed-data.c:
+        (remove_old_items):
+        (feed_update_thread):
+        (feed_data_update_all):
+
 2007-08-05  Holger Hans Peter Freyther  <[EMAIL PROTECTED]>
 
         Implement category filtering (and made sure it compiles). Feature wise

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c    
    2007-08-05 21:44:33 UTC (rev 2641)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-data.c    
    2007-08-05 22:50:00 UTC (rev 2642)
@@ -111,6 +111,28 @@
 }
 
 /*
+ * remove all entries with this category
+ */
+static void
+remove_old_items (FeedData *data, const gchar* delete_category)
+{
+    gdk_threads_enter();
+
+    GtkTreeIter iter;
+    gboolean valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (data), 
&iter);
+    while (valid) {
+        gchar *category;
+        gtk_tree_model_get (GTK_TREE_MODEL (data), &iter, 
RSS_READER_COLUMN_CATEGORY, &category, -1);
+        if (category && strcmp(category, delete_category) == 0)
+            valid = gtk_list_store_remove (GTK_LIST_STORE (data), &iter);
+        else
+            valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (data), &iter);
+    }
+
+    gdk_threads_leave();
+}
+
+/*
  * Add items from rss_data to the GtkListStore/FeedData
  */
 static void
@@ -223,6 +245,7 @@
         /*
          * create the new item(s)
          */
+        remove_old_items (data, category);
         add_mrss_item (data, rss_data, url, category);
 
         /*
@@ -322,8 +345,6 @@
 void
 feed_data_update_all (FeedData* data)
 {
-    gtk_list_store_clear (GTK_LIST_STORE (data));
-
     GError *error = NULL;
     (void)g_thread_create( (GThreadFunc)feed_update_thread, data, FALSE, 
&error );
 




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to