From 583aa0f41fc9cd5abad3220bee8e8cd9fa5ded32 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Fri, 26 Oct 2007 12:14:47 -0400 Subject: [PATCH] Sort the items on date. --- example/rss/gntrss-ui.py | 1 + example/rss/gntrss.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/example/rss/gntrss-ui.py b/example/rss/gntrss-ui.py index 9f2ef95..8f25f30 100755 --- a/example/rss/gntrss-ui.py +++ b/example/rss/gntrss-ui.py @@ -303,6 +303,7 @@ def item_key_pressed(tree, text): return True items = RssTree() +items.enable_sort() items.set_property('columns', 2) items.set_col_width(0, 40) items.set_col_width(1, 11) diff --git a/example/rss/gntrss.py b/example/rss/gntrss.py index efc5557..c85ae2e 100644 --- a/example/rss/gntrss.py +++ b/example/rss/gntrss.py @@ -32,6 +32,13 @@ import gobject import sys import time +def compare_feed_items(i1, i2): + if i1.date < i2.date: + return -1 + elif i1.date > i2.date: + return 1 + return 0 + ## # The FeedItem class. It will update emit 'delete' signal when it's # destroyed. @@ -45,6 +52,9 @@ class FeedItem(gobject.GObject): __gsignals__ = { 'delete' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_OBJECT,)) } + + COMPARE_FUNC = compare_feed_items + def __init__(self, item, parent): self.__gobject_init__() try: -- 2.11.4.GIT