[nautilus] Bug 686137 - Add Access Date column and set as default for recent



commit 1fd016ed96c5ea0ee53c6416c22e3e5192f1f971
Author: Garrett Regier <garrett yorba org>
Date:   Thu Jul 11 11:59:35 2013 -0700

    Bug 686137 - Add Access Date column and set as default for recent

 libnautilus-private/nautilus-column-utilities.c |    9 +++++++++
 libnautilus-private/nautilus-file.c             |    4 +++-
 src/nautilus-canvas-view-ui.xml                 |    1 +
 src/nautilus-canvas-view.c                      |   11 ++++++++++-
 4 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/libnautilus-private/nautilus-column-utilities.c b/libnautilus-private/nautilus-column-utilities.c
index b9c5afa..5eba7ff 100644
--- a/libnautilus-private/nautilus-column-utilities.c
+++ b/libnautilus-private/nautilus-column-utilities.c
@@ -36,6 +36,7 @@ static const char *default_column_order[] = {
        "size",
        "type",
        "date_modified",
+       "date_accessed",
        "owner",
        "group",
        "permissions",
@@ -79,6 +80,14 @@ get_builtin_columns (void)
                                               "description", _("The date the file was modified."),
                                               "default-sort-order", GTK_SORT_DESCENDING,
                                               NULL));
+       columns = g_list_append (columns,
+                                g_object_new (NAUTILUS_TYPE_COLUMN,
+                                              "name", "date_accessed",
+                                              "attribute", "date_accessed",
+                                              "label", _("Accessed"),
+                                              "description", _("The date the file was accessed."),
+                                              "default-sort-order", GTK_SORT_DESCENDING,
+                                              NULL));
 
        columns = g_list_append (columns,
                                 g_object_new (NAUTILUS_TYPE_COLUMN,
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 8974a87..5ae7cc4 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -7647,7 +7647,9 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
        res = get_attributes_for_default_sort_type (file, &is_recent, &is_download, &is_trash, &is_search);
 
        if (res) {
-               if (is_recent || is_download) {
+               if (is_recent) {
+                       retval = NAUTILUS_FILE_SORT_BY_ATIME;
+               } else if (is_download) {
                        retval = NAUTILUS_FILE_SORT_BY_MTIME;
                } else if (is_trash) {
                        retval = NAUTILUS_FILE_SORT_BY_TRASHED_TIME;
diff --git a/src/nautilus-canvas-view-ui.xml b/src/nautilus-canvas-view-ui.xml
index 1caffe1..4ead416 100644
--- a/src/nautilus-canvas-view-ui.xml
+++ b/src/nautilus-canvas-view-ui.xml
@@ -7,6 +7,7 @@
         <menuitem name="Sort by Size" action="Sort by Size"/>
         <menuitem name="Sort by Type" action="Sort by Type"/>
         <menuitem name="Sort by Modification Date" action="Sort by Modification Date"/>
+        <menuitem name="Sort by Access Date" action="Sort by Access Date"/>
         <menuitem name="Sort by Trash Time" action="Sort by Trash Time"/>
         <menuitem name="Sort by Search Relevance" action="Sort by Search Relevance"/>
       </placeholder>
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 247912a..50af736 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -136,6 +136,11 @@ static const SortCriterion sort_criteria[] = {
                "Sort by Modification Date"
        },
        {
+               NAUTILUS_FILE_SORT_BY_ATIME,
+               "access date",
+               "Sort by Access Date"
+       },
+       {
                NAUTILUS_FILE_SORT_BY_TRASHED_TIME,
                "trashed",
                NAUTILUS_ACTION_SORT_TRASH_TIME
@@ -592,7 +597,7 @@ get_default_sort_order (NautilusFile *file, gboolean *reversed)
                }
 
                retval = CLAMP (default_sort_order, NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
-                               NAUTILUS_FILE_SORT_BY_MTIME);
+                               NAUTILUS_FILE_SORT_BY_ATIME);
        }
 
        return retval;
@@ -1133,6 +1138,10 @@ static const GtkRadioActionEntry arrange_radio_entries[] = {
     N_("By Modification _Date"), NULL,
     N_("Keep icons sorted by modification date in rows"),
     NAUTILUS_FILE_SORT_BY_MTIME },
+  { "Sort by Access Date", NULL,
+    N_("By _Access Date"), NULL,
+    N_("Keep icons sorted by access date in rows"),
+    NAUTILUS_FILE_SORT_BY_ATIME },
   { NAUTILUS_ACTION_SORT_TRASH_TIME, NULL,
     N_("By T_rash Time"), NULL,
     N_("Keep icons sorted by trash time in rows"),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]