[gnome-utils] Add a timestamp to screenshot filenames by default
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] Add a timestamp to screenshot filenames by default
- Date: Mon, 13 Jun 2011 18:52:58 +0000 (UTC)
commit 58efa234daaaf7a4b7ef5429f95971eaff9b0da1
Author: William Jon McCann <jmccann redhat com>
Date: Fri Jun 10 14:13:36 2011 -0400
Add a timestamp to screenshot filenames by default
This is useful for correct ordering of sequences, unique
filename generation regardless of target directory, and
information recording.
https://bugzilla.gnome.org/show_bug.cgi?id=565907
gnome-screenshot/gnome-screenshot.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gnome-screenshot/gnome-screenshot.c b/gnome-screenshot/gnome-screenshot.c
index 2ab66bd..40e232c 100644
--- a/gnome-screenshot/gnome-screenshot.c
+++ b/gnome-screenshot/gnome-screenshot.c
@@ -976,6 +976,15 @@ static char *
build_uri (AsyncExistenceJob *job)
{
char *retval, *file_name;
+ char *timestamp;
+ GDateTime *d;
+
+ 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 (window_title)
{
@@ -983,15 +992,17 @@ build_uri (AsyncExistenceJob *job)
* with the screenshot if a specific window is taken */
if (job->iteration == 0)
{
- file_name = g_strdup_printf (_("Screenshot-%s.png"), window_title);
+ file_name = g_strdup_printf (_("Screenshot %s - %s.png"), timestamp, 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);
+ file_name = g_strdup_printf (_("Screenshot %s - %s-%d.png"),
+ timestamp,
+ window_title,
+ job->iteration);
}
}
else
@@ -1000,19 +1011,20 @@ build_uri (AsyncExistenceJob *job)
{
/* 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"));
+ file_name = g_strdup_printf (_("Screenshot %s.png"), timestamp);
}
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);
+ file_name = g_strdup_printf (_("Screenshot %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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]