r2656 - in trunk/src/target/OM-2007.2/applications/openmoko-feedreader2: . src
zecke at sita.openmoko.org
zecke at sita.openmoko.org
Mon Aug 6 23:06:13 CEST 2007
Author: zecke
Date: 2007-08-06 23:06:12 +0200 (Mon, 06 Aug 2007)
New Revision: 2656
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/application-data.h
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
trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/main.c
Log:
2007-08-06 Holger Hans Peter Freyther <zecke at selfish.org>
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):
Modified: trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog 2007-08-06 20:19:27 UTC (rev 2655)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/ChangeLog 2007-08-06 21:06:12 UTC (rev 2656)
@@ -1,5 +1,22 @@
2007-08-06 Holger Hans Peter Freyther <zecke at selfish.org>
+ 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):
+
+2007-08-06 Holger Hans Peter Freyther <zecke at selfish.org>
+
Make the Backward and Forward button sensitive/unsensitive depending on if
one can go backward/forward.
The backward/forward signals are not yet connected.
Modified: trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/application-data.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/application-data.h 2007-08-06 20:19:27 UTC (rev 2655)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/application-data.h 2007-08-06 21:06:12 UTC (rev 2656)
@@ -29,12 +29,14 @@
#include "moko_cache.h"
#include "feed-item-view.h"
+#include "feed-selection-view.h"
struct ApplicationData {
GtkWindow *window;
MokoCache *cache;
GtkNotebook *notebook;
FeedItemView *view;
+ FeedSelectionView *selection_view;
};
#endif
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-06 20:19:27 UTC (rev 2655)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.c 2007-08-06 21:06:12 UTC (rev 2656)
@@ -244,4 +244,30 @@
return view->filter->filter_string;
}
+void
+feed_selection_view_next_item (const FeedSelectionView* view)
+{
+ GtkTreeSelection* selection = gtk_tree_view_get_selection (view->view);
+ GtkTreeIter iter;
+ GtkTreeModel* model;
+ gboolean has_selection = gtk_tree_selection_get_selected (selection, &model, &iter);
+ if (has_selection && gtk_tree_model_iter_next (model, &iter))
+ gtk_tree_selection_select_iter (selection, &iter);
+}
+
+void
+feed_selection_view_prev_item (const FeedSelectionView* view)
+{
+ GtkTreeSelection* selection = gtk_tree_view_get_selection (view->view);
+ GtkTreeIter iter;
+ GtkTreeModel* model;
+ gboolean has_selection = gtk_tree_selection_get_selected (selection, &model, &iter);
+
+ if (has_selection) {
+ GtkTreePath* path = gtk_tree_model_get_path (model, &iter);
+ if (gtk_tree_path_prev (path))
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+ }
+}
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-06 20:19:27 UTC (rev 2655)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/feed-selection-view.h 2007-08-06 21:06:12 UTC (rev 2656)
@@ -67,6 +67,9 @@
void feed_selection_view_add_column (const FeedSelectionView*, int column_type, const gchar* txt);
gchar* feed_selection_view_get_search_string (const FeedSelectionView*);
+void feed_selection_view_next_item (const FeedSelectionView*);
+void feed_selection_view_prev_item (const FeedSelectionView*);
+
G_END_DECLS
#endif
Modified: trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/main.c 2007-08-06 20:19:27 UTC (rev 2655)
+++ trunk/src/target/OM-2007.2/applications/openmoko-feedreader2/src/main.c 2007-08-06 21:06:12 UTC (rev 2656)
@@ -69,6 +69,8 @@
feed_selection_view_add_column (RSS_FEED_SELECTION_VIEW (box), RSS_READER_COLUMN_DATE, _("Date"));
g_signal_connect (G_OBJECT(box), "item-changed", G_CALLBACK(feed_selection_changed), data);
+
+ data->selection_view = RSS_FEED_SELECTION_VIEW (box);
}
/*
@@ -80,6 +82,9 @@
data->view = RSS_FEED_ITEM_VIEW(feed_item_view_new ());
gtk_notebook_append_page (data->notebook, GTK_WIDGET(data->view), gtk_image_new_from_stock (GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_LARGE_TOOLBAR));
gtk_container_child_set (GTK_CONTAINER(data->notebook), GTK_WIDGET(data->view), "tab-expand", TRUE, "tab-fill", TRUE, NULL);
+
+ g_signal_connect_swapped (G_OBJECT (data->view), "next", G_CALLBACK(feed_selection_view_next_item), data->selection_view);
+ g_signal_connect_swapped (G_OBJECT (data->view), "previous", G_CALLBACK(feed_selection_view_prev_item), data->selection_view);
}
More information about the commitlog
mailing list