Changeset 2656


Ignore:
Timestamp:
08/06/07 23:06:12 (6 years ago)
Author:
zecke
Message:

2007-08-06 Holger Hans Peter Freyther <zecke@…>

Implement going forward and backward in the selection view. We have to
remember the FeedSelectionView? in the ApplicationData? to be able to connect the
next/previous signal of FeedItemView?.
Is g_signal_connect_swapped considered evil? And is it normal that the code is different
to get the next/previous item in a GtkListStore??

  • src/application-data.h:
  • src/feed-selection-view.c: (feed_selection_view_next_item): (feed_selection_view_prev_item):
  • src/feed-selection-view.h:
  • src/main.c: (create_feed_view): (create_text_view):
Location:
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog

    r2655 r2656  
     12007-08-06  Holger Hans Peter Freyther  <zecke@selfish.org> 
     2 
     3        Implement going forward and backward in the selection view. We have to 
     4        remember the FeedSelectionView in the ApplicationData to be able to connect the 
     5        next/previous signal of FeedItemView. 
     6        Is g_signal_connect_swapped considered evil? And is it normal that the code is different 
     7        to get the next/previous item in a GtkListStore? 
     8 
     9        * src/application-data.h: 
     10        * src/feed-selection-view.c: 
     11        (feed_selection_view_next_item): 
     12        (feed_selection_view_prev_item): 
     13        * src/feed-selection-view.h: 
     14        * src/main.c: 
     15        (create_feed_view): 
     16        (create_text_view): 
     17 
    1182007-08-06  Holger Hans Peter Freyther  <zecke@selfish.org> 
    219 
  • trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/application-data.h

    r2635 r2656  
    3030#include "moko_cache.h" 
    3131#include "feed-item-view.h" 
     32#include "feed-selection-view.h" 
    3233 
    3334struct ApplicationData { 
     
    3637    GtkNotebook       *notebook; 
    3738    FeedItemView      *view; 
     39    FeedSelectionView *selection_view; 
    3840}; 
    3941 
  • trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c

    r2655 r2656  
    245245} 
    246246 
    247  
     247void 
     248feed_selection_view_next_item (const FeedSelectionView* view) 
     249{ 
     250    GtkTreeSelection* selection = gtk_tree_view_get_selection (view->view); 
     251    GtkTreeIter iter; 
     252    GtkTreeModel* model; 
     253    gboolean has_selection = gtk_tree_selection_get_selected (selection, &model, &iter); 
     254 
     255    if (has_selection &&  gtk_tree_model_iter_next (model, &iter)) 
     256        gtk_tree_selection_select_iter (selection, &iter); 
     257} 
     258 
     259void 
     260feed_selection_view_prev_item (const FeedSelectionView* view) 
     261{ 
     262    GtkTreeSelection* selection = gtk_tree_view_get_selection (view->view); 
     263    GtkTreeIter iter; 
     264    GtkTreeModel* model; 
     265    gboolean has_selection = gtk_tree_selection_get_selected (selection, &model, &iter); 
     266 
     267    if (has_selection) { 
     268        GtkTreePath* path = gtk_tree_model_get_path (model, &iter); 
     269        if (gtk_tree_path_prev (path)) 
     270            gtk_tree_selection_select_path (selection, path); 
     271        gtk_tree_path_free (path); 
     272    } 
     273} 
  • trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.h

    r2640 r2656  
    6868gchar*      feed_selection_view_get_search_string       (const FeedSelectionView*); 
    6969 
     70void        feed_selection_view_next_item               (const FeedSelectionView*); 
     71void        feed_selection_view_prev_item               (const FeedSelectionView*); 
     72 
    7073G_END_DECLS 
    7174 
  • trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/main.c

    r2655 r2656  
    7070 
    7171    g_signal_connect (G_OBJECT(box), "item-changed", G_CALLBACK(feed_selection_changed), data); 
     72 
     73    data->selection_view = RSS_FEED_SELECTION_VIEW (box); 
    7274} 
    7375 
     
    8183    gtk_notebook_append_page (data->notebook, GTK_WIDGET(data->view), gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_LARGE_TOOLBAR)); 
    8284    gtk_container_child_set (GTK_CONTAINER(data->notebook), GTK_WIDGET(data->view), "tab-expand", TRUE, "tab-fill", TRUE, NULL); 
     85 
     86    g_signal_connect_swapped (G_OBJECT (data->view), "next", G_CALLBACK(feed_selection_view_next_item), data->selection_view); 
     87    g_signal_connect_swapped (G_OBJECT (data->view), "previous", G_CALLBACK(feed_selection_view_prev_item), data->selection_view); 
    8388} 
    8489 
Note: See TracChangeset for help on using the changeset viewer.