diff options
author | infirit <[email protected]> | 2015-09-08 16:47:39 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-09-08 16:47:39 +0200 |
commit | 8f060cfddeedc196cf8689ffc670a80cbe5698c6 (patch) | |
tree | f2c7e8a25d6ff574cb7db9079b7adbee7a8a752e | |
parent | a93e9c7e31963dd954f0952375cf31c80d5bd252 (diff) | |
download | mate-utils-8f060cfddeedc196cf8689ffc670a80cbe5698c6.tar.bz2 mate-utils-8f060cfddeedc196cf8689ffc670a80cbe5698c6.tar.xz |
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.
-rw-r--r-- | mate-screenshot/mate-screenshot.c | 44 | ||||
-rw-r--r-- | mate-screenshot/mate-screenshot.ui | 2 |
2 files changed, 18 insertions, 28 deletions
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; } diff --git a/mate-screenshot/mate-screenshot.ui b/mate-screenshot/mate-screenshot.ui index 942897b3..80382ed4 100644 --- a/mate-screenshot/mate-screenshot.ui +++ b/mate-screenshot/mate-screenshot.ui @@ -190,7 +190,7 @@ <property name="has_frame">True</property> <property name="invisible_char" translatable="yes">*</property> <property name="activates_default">True</property> - <property name="width_chars">24</property> + <property name="width_chars">32</property> </object> <packing> <property name="left_attach">1</property> |