summaryrefslogtreecommitdiff
path: root/src/nautilus-ui-utilities.c
diff options
context:
space:
mode:
authorMonica Baluna <monicamariabaluna@gmail.com>2016-11-02 18:27:28 +0200
committerErnestas Kulik <ernestask@src.gnome.org>2016-11-03 13:18:02 +0200
commit01476a1e9acdea7a8e5a14ca9a7394acd8dc9263 (patch)
treedee9d4eaadae65ddde3bedd7490976fed4e3565b /src/nautilus-ui-utilities.c
parent3d50ceab14145912289cc0dc66c476037b5f4e08 (diff)
downloadnautilus-01476a1e9acdea7a8e5a14ca9a7394acd8dc9263.tar.gz
ui-utilities: clarify date label
Date label does not point out that nautilus searches for files modified or used after that date. In order to fix this, prepend "Since" to the date label. https://bugzilla.gnome.org/show_bug.cgi?id=767400
Diffstat (limited to 'src/nautilus-ui-utilities.c')
-rw-r--r--src/nautilus-ui-utilities.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/nautilus-ui-utilities.c b/src/nautilus-ui-utilities.c
index e8fdab8b4..07aca02e8 100644
--- a/src/nautilus-ui-utilities.c
+++ b/src/nautilus-ui-utilities.c
@@ -369,32 +369,40 @@ nautilus_file_date_in_between (guint64 unix_file_time,
}
static const gchar *
-get_text_for_days_ago (gint days)
+get_text_for_days_ago (gint days,
+ gboolean prefix_with_since)
{
if (days < 7)
{
/* days */
- return ngettext ("%d day ago", "%d days ago", days);
+ return prefix_with_since ?
+ ngettext ("Since %d day ago", "Since %d days ago", days) :
+ ngettext ("%d day ago", "%d days ago", days);
}
- else if (days < 30)
+ if (days < 30)
{
/* weeks */
- return ngettext ("Last week", "%d weeks ago", days / 7);
+ return prefix_with_since ?
+ ngettext ("Since last week", "Since %d weeks ago", days / 7) :
+ ngettext ("Last week", "%d weeks ago", days / 7);
}
- else if (days < 365)
+ if (days < 365)
{
/* months */
- return ngettext ("Last month", "%d months ago", days / 30);
- }
- else
- {
- /* years */
- return ngettext ("Last year", "%d years ago", days / 365);
+ return prefix_with_since ?
+ ngettext ("Since last month", "Since %d months ago", days / 30) :
+ ngettext ("Last month", "%d months ago", days / 30);
}
+
+ /* years */
+ return prefix_with_since ?
+ ngettext ("Since last year", "Since %d years ago", days / 365) :
+ ngettext ("Last year", "%d years ago", days / 365);
}
gchar *
-get_text_for_date_range (GPtrArray *date_range)
+get_text_for_date_range (GPtrArray *date_range,
+ gboolean prefix_with_since)
{
gint days;
gint normalized;
@@ -442,7 +450,9 @@ get_text_for_date_range (GPtrArray *date_range)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
- label = g_strdup_printf (get_text_for_days_ago (days), normalized);
+ label = g_strdup_printf (get_text_for_days_ago (days,
+ prefix_with_since),
+ normalized);
#pragma GCC diagnostic pop
}