we sort by time in db query. no need to dup

This commit is contained in:
Nikos Kouremenos 2006-02-02 23:42:57 +00:00
parent 5a3f23f2a7
commit 496baa0f0c
1 changed files with 3 additions and 4 deletions

View File

@ -50,7 +50,7 @@ GTKGUI_GLADE = 'gtkgui.glade'
# contact_name, date, message, time
(
C_CONTACT_NAME,
C_DATE,
C_UNIXTIME,
C_MESSAGE,
C_TIME
) = range(4)
@ -94,8 +94,7 @@ class HistoryWindow:
self.results_treeview.append_column(col)
renderer = gtk.CellRendererText()
col.pack_start(renderer)
col.set_attributes(renderer, text = C_DATE)
col.set_sort_column_id(C_DATE)
col.set_attributes(renderer, text = C_UNIXTIME)
col.set_resizable(True)
col = gtk.TreeViewColumn(_('Message'))
@ -355,7 +354,7 @@ class HistoryWindow:
model = widget.get_model()
iter = model.get_iter(path)
# make it a tupple (Y, M, D, 0, 0, 0...)
tim = time.strptime(model[iter][C_DATE], '%x')
tim = time.strptime(model[iter][C_UNIXTIME], '%x')
year = tim[0]
gtk_month = tim[1]
month = gtkgui_helpers.make_python_month_gtk_month(gtk_month)