Merge pull request #469 from RichardHitt/banlist-datesort

Fix datesort problem after new column in banlist
This commit is contained in:
TingPing 2013-03-24 12:21:02 -07:00
commit e0bb6ff0cc
1 changed files with 8 additions and 8 deletions

View File

@ -621,8 +621,8 @@ banlist_date_sort (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer
time_t t1, t2; time_t t1, t2;
char *time1, *time2; char *time1, *time2;
gtk_tree_model_get(model, a, 2, &time1, -1); gtk_tree_model_get(model, a, DATE_COLUMN, &time1, -1);
gtk_tree_model_get(model, b, 2, &time2, -1); gtk_tree_model_get(model, b, DATE_COLUMN, &time2, -1);
strptime (time1, &tm1); strptime (time1, &tm1);
strptime (time2, &tm2); strptime (time2, &tm2);
t1 = mktime (&tm1); t1 = mktime (&tm1);
@ -643,17 +643,17 @@ banlist_treeview_new (GtkWidget *box, banlist_info *banl)
GtkTreeSortable *sortable; GtkTreeSortable *sortable;
store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING); G_TYPE_STRING, G_TYPE_STRING);
g_return_val_if_fail (store != NULL, NULL); g_return_val_if_fail (store != NULL, NULL);
sortable = GTK_TREE_SORTABLE (store); sortable = GTK_TREE_SORTABLE (store);
gtk_tree_sortable_set_sort_func (sortable, 2, banlist_date_sort, GINT_TO_POINTER (2), NULL); gtk_tree_sortable_set_sort_func (sortable, DATE_COLUMN, banlist_date_sort, GINT_TO_POINTER (DATE_COLUMN), NULL);
view = gtkutil_treeview_new (box, GTK_TREE_MODEL (store), NULL, view = gtkutil_treeview_new (box, GTK_TREE_MODEL (store), NULL,
TYPE_COLUMN, _("Type"), TYPE_COLUMN, _("Type"),
MASK_COLUMN, _("Mask"), MASK_COLUMN, _("Mask"),
FROM_COLUMN, _("From"), FROM_COLUMN, _("From"),
DATE_COLUMN, _("Date"), -1); DATE_COLUMN, _("Date"), -1);
col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), MASK_COLUMN); col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), MASK_COLUMN);
gtk_tree_view_column_set_alignment (col, 0.5); gtk_tree_view_column_set_alignment (col, 0.5);