Commit 76c63eb3 authored by Carlos Soriano Sánchez's avatar Carlos Soriano Sánchez
Browse files

toolbar: show modified time for all places except Recent

We changed to only show access time for sorting in the sort menu
in 3.16 to avoid having both sorting options always present.
But for folders like Downloads, the most useful sorting criteria is
actually modified time, since it orders the files in downloading order.
Actually modified time is more useful than access time is all cases
except in "Recent", which what we actually want is the most recent
accessed or modified file.

For that, show only Modified Time sorting menu item in all places
except in "Recent", where we will show only Access Time.
parent 2e1ac987
......@@ -107,6 +107,12 @@ struct NautilusCanvasViewDetails
gboolean supports_keep_aligned;
static gboolean
file_is_not_in_recent (NautilusFile *file)
return !nautilus_file_is_in_recent (file);
/* Note that the first item in this list is the default sort,
* and that the items show up in the menu in the order they
* appear in this list.
......@@ -130,12 +136,14 @@ static const SortCriterion sort_criteria[] = {
"modification date",
"access date",
......@@ -131,6 +131,15 @@
<property name="action-target">'access-date'</property>
<object class="GtkModelButton" id="sort_modification_date">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">Last _Modified</property>
<property name="action-name">view.sort</property>
<property name="action-target">'modification-date'</property>
<object class="GtkModelButton" id="sort_trash_time">
<property name="visible">False</property>
......@@ -59,6 +59,8 @@ struct _NautilusToolbarPrivate {
GtkWidget *view_menu_widget;
GtkWidget *sort_menu;
GtkWidget *sort_modification_date;
GtkWidget *sort_access_date;
GtkWidget *sort_trash_time;
GtkWidget *sort_search_relevance;
GtkWidget *visible_columns;
......@@ -440,6 +442,8 @@ nautilus_toolbar_init (NautilusToolbar *self)
self->priv->zoom_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "zoom_adjustment"));
self->priv->sort_menu = GTK_WIDGET (gtk_builder_get_object (builder, "sort_menu"));
self->priv->sort_modification_date = GTK_WIDGET (gtk_builder_get_object (builder, "sort_modification_date"));
self->priv->sort_access_date = GTK_WIDGET (gtk_builder_get_object (builder, "sort_access_date"));
self->priv->sort_trash_time = GTK_WIDGET (gtk_builder_get_object (builder, "sort_trash_time"));
self->priv->sort_search_relevance = GTK_WIDGET (gtk_builder_get_object (builder, "sort_search_relevance"));
self->priv->visible_columns = GTK_WIDGET (gtk_builder_get_object (builder, "visible_columns"));
......@@ -575,7 +579,7 @@ nautilus_toolbar_reset_menus (NautilusToolbar *self)
GActionGroup *view_action_group;
GVariant *variant;
GVariantIter iter;
gboolean sort_trash, sort_search, has_sort;
gboolean show_sort_trash, show_sort_search, show_sort_access, show_sort_modification, has_sort;
const gchar *hint;
/* Allow actions from the current view to be activated through
......@@ -591,7 +595,7 @@ nautilus_toolbar_reset_menus (NautilusToolbar *self)
g_action_group_has_action (view_action_group, "visible-columns"));
has_sort = g_action_group_has_action (view_action_group, "sort");
sort_trash = sort_search = FALSE;
show_sort_trash = show_sort_search = show_sort_modification = show_sort_access = FALSE;
gtk_widget_set_visible (self->priv->sort_menu, has_sort);
if (has_sort) {
......@@ -600,16 +604,22 @@ nautilus_toolbar_reset_menus (NautilusToolbar *self)
while (g_variant_iter_next (&iter, "&s", &hint)) {
if (g_strcmp0 (hint, "trash-time") == 0)
sort_trash = TRUE;
show_sort_trash = TRUE;
if (g_strcmp0 (hint, "search-relevance") == 0)
sort_search = TRUE;
show_sort_search = TRUE;
if (g_strcmp0 (hint, "access-date") == 0)
show_sort_access = TRUE;
if (g_strcmp0 (hint, "modification-date") == 0)
show_sort_modification = TRUE;
g_variant_unref (variant);
gtk_widget_set_visible (self->priv->sort_trash_time, sort_trash);
gtk_widget_set_visible (self->priv->sort_search_relevance, sort_search);
gtk_widget_set_visible (self->priv->sort_trash_time, show_sort_trash);
gtk_widget_set_visible (self->priv->sort_search_relevance, show_sort_search);
gtk_widget_set_visible (self->priv->sort_modification_date, show_sort_modification);
gtk_widget_set_visible (self->priv->sort_access_date, show_sort_access);
variant = g_action_group_get_action_state (view_action_group, "zoom-to-level");
gtk_adjustment_set_value (self->priv->zoom_adjustment,
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