From 8f060cfddeedc196cf8689ffc670a80cbe5698c6 Mon Sep 17 00:00:00 2001 From: infirit Date: Tue, 8 Sep 2015 16:47:39 +0200 Subject: Add a timestamp to screenshot filenames by default Useful for correct ordering, fixes #115 Also drop the window name as we now have the time-stamp to distinguish between screen-shots. --- mate-screenshot/mate-screenshot.c | 44 +++++++++++++++------------------------ 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'mate-screenshot/mate-screenshot.c') diff --git a/mate-screenshot/mate-screenshot.c b/mate-screenshot/mate-screenshot.c index 03b23e54..3e121f00 100644 --- a/mate-screenshot/mate-screenshot.c +++ b/mate-screenshot/mate-screenshot.c @@ -883,43 +883,33 @@ static char * build_uri (AsyncExistenceJob *job) { char *retval, *file_name; + char *timestamp; + GDateTime *d; - if (window_title) + d = g_date_time_new_now_local (); + /* Translators: This is a strftime format string. + * It is used to display the time in 24-hours format (eg, like + * in France: 20:10). */ + timestamp = g_date_time_format (d, _("%Y-%m-%d %H:%M:%S")); + g_date_time_unref (d); + + if (job->iteration == 0) { /* translators: this is the name of the file that gets made up - * with the screenshot if a specific window is taken */ - if (job->iteration == 0) - { - file_name = g_strdup_printf (_("Screenshot-%s.png"), window_title); - } - else - { - /* translators: this is the name of the file that gets - * made up with the screenshot if a specific window is - * taken */ - file_name = g_strdup_printf (_("Screenshot-%s-%d.png"), - window_title, job->iteration); - } + * with the screenshot if the entire screen is taken */ + file_name = g_strdup_printf (_("Screenshot at %s.png"), timestamp); } else { - if (job->iteration == 0) - { - /* translators: this is the name of the file that gets made up - * with the screenshot if the entire screen is taken */ - file_name = g_strdup (_("Screenshot.png")); - } - else - { - /* translators: this is the name of the file that gets - * made up with the screenshot if the entire screen is - * taken */ - file_name = g_strdup_printf (_("Screenshot-%d.png"), job->iteration); - } + /* translators: this is the name of the file that gets + * made up with the screenshot if the entire screen is + * taken */ + file_name = g_strdup_printf (_("Screenshot at %s - %d.png"), timestamp, job->iteration); } retval = g_build_filename (job->base_uris[job->type], file_name, NULL); g_free (file_name); + g_free (timestamp); return retval; } -- cgit v1.2.1