Commit 988e33f3 authored by William Jon McCann's avatar William Jon McCann

Make time columns default to descending sort order

parent 88ae6601
......@@ -23,6 +23,7 @@
*/
#include <config.h>
#include <gtk/gtk.h>
#include "nautilus-column.h"
#include "nautilus-extension-i18n.h"
......@@ -34,6 +35,7 @@ enum {
PROP_LABEL,
PROP_DESCRIPTION,
PROP_XALIGN,
PROP_DEFAULT_SORT_ORDER,
LAST_PROP
};
......@@ -43,6 +45,7 @@ struct _NautilusColumnDetails {
char *label;
char *description;
float xalign;
GtkSortType default_sort_order;
};
G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT);
......@@ -110,6 +113,9 @@ nautilus_column_get_property (GObject *object,
case PROP_XALIGN :
g_value_set_float (value, column->details->xalign);
break;
case PROP_DEFAULT_SORT_ORDER :
g_value_set_enum (value, column->details->default_sort_order);
break;
default :
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
......@@ -151,6 +157,10 @@ nautilus_column_set_property (GObject *object,
column->details->xalign = g_value_get_float (value);
g_object_notify (object, "xalign");
break;
case PROP_DEFAULT_SORT_ORDER :
column->details->default_sort_order = g_value_get_enum (value);
g_object_notify (object, "default-sort-order");
break;
default :
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
......@@ -232,5 +242,13 @@ nautilus_column_class_init (NautilusColumnClass *class)
1.0,
0.0,
G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (class),
PROP_DEFAULT_SORT_ORDER,
g_param_spec_enum ("default-sort-order",
"Default sort order",
"Default sort order",
GTK_TYPE_SORT_TYPE,
GTK_SORT_ASCENDING,
G_PARAM_READWRITE));
}
......@@ -64,6 +64,7 @@ NautilusColumn * nautilus_column_new (const char *name,
* label (string) - the user-visible label for the column
* description (string) - a user-visible description of the column
* xalign (float) - x-alignment of the column
* default-sort-order (GtkSortType) - default sort order of the column
*/
G_END_DECLS
......
......@@ -80,6 +80,7 @@ get_builtin_columns (void)
"attribute", "date_modified",
"label", _("Modified"),
"description", _("The date the file was modified."),
"default-sort-order", GTK_SORT_DESCENDING,
NULL));
columns = g_list_append (columns,
......@@ -88,6 +89,7 @@ get_builtin_columns (void)
"attribute", "date_accessed",
"label", _("Accessed"),
"description", _("The date the file was accessed."),
"default-sort-order", GTK_SORT_DESCENDING,
NULL));
columns = g_list_append (columns,
......
......@@ -1627,13 +1627,16 @@ create_and_set_up_tree_view (NautilusListView *view)
char *name;
char *label;
float xalign;
GtkSortType sort_order;
nautilus_column = NAUTILUS_COLUMN (l->data);
g_object_get (nautilus_column,
"name", &name,
"label", &label,
"xalign", &xalign, NULL);
"xalign", &xalign,
"default-sort-order", &sort_order,
NULL);
column_num = nautilus_list_model_add_column (view->details->model,
nautilus_column);
......@@ -1701,6 +1704,7 @@ create_and_set_up_tree_view (NautilusListView *view)
gtk_tree_view_column_set_resizable (column, TRUE);
gtk_tree_view_column_set_visible (column, TRUE);
gtk_tree_view_column_set_sort_order (column, sort_order);
}
g_free (name);
g_free (label);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment