[gnome-flashback] screenshot: store creation time in metadata
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] screenshot: store creation time in metadata
- Date: Thu, 18 Jul 2019 17:29:45 +0000 (UTC)
commit efdb01888c1ab3263a5e844d8f833b24e649fdc3
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Jul 16 21:22:33 2019 +0300
screenshot: store creation time in metadata
Based on gnome-shell commit:
https://gitlab.gnome.org/GNOME/gnome-shell/commit/7a3927c16833030a
gnome-flashback/libscreenshot/gf-screenshot.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/gnome-flashback/libscreenshot/gf-screenshot.c b/gnome-flashback/libscreenshot/gf-screenshot.c
index deeb7ca..2f3d644 100644
--- a/gnome-flashback/libscreenshot/gf-screenshot.c
+++ b/gnome-flashback/libscreenshot/gf-screenshot.c
@@ -50,6 +50,8 @@ struct _GfScreenshot
GHashTable *senders;
GSettings *lockdown;
+
+ GDateTime *datetime;
};
typedef struct
@@ -310,12 +312,14 @@ get_filename (const gchar *filename)
}
static gboolean
-save_screenshot (GdkPixbuf *pixbuf,
- const gchar *filename_in,
- gchar **filename_out)
+save_screenshot (GfScreenshot *screenshot,
+ GdkPixbuf *pixbuf,
+ const gchar *filename_in,
+ gchar **filename_out)
{
gboolean result;
gchar *filename;
+ gchar *creation_time;
GError *error;
if (pixbuf == NULL)
@@ -323,8 +327,12 @@ save_screenshot (GdkPixbuf *pixbuf,
filename = get_filename (filename_in);
+ creation_time = g_date_time_format (screenshot->datetime, "%c");
+
error = NULL;
- result = gdk_pixbuf_save (pixbuf, filename, "png", &error, NULL);
+ result = gdk_pixbuf_save (pixbuf, filename, "png", &error,
+ "tEXt::Creation Time", creation_time,
+ NULL);
if (result)
*filename_out = filename;
@@ -338,6 +346,7 @@ save_screenshot (GdkPixbuf *pixbuf,
}
g_object_unref (pixbuf);
+ g_free (creation_time);
return result;
}
@@ -857,7 +866,7 @@ take_screenshot_real (GfScreenshot *screenshot,
*height -= extents.top + extents.bottom;
}
- return save_screenshot (pixbuf, filename_in, filename_out);
+ return save_screenshot (screenshot, pixbuf, filename_in, filename_out);
}
get_window_rect_coords (window, include_frame, &real, &s);
@@ -1020,7 +1029,7 @@ take_screenshot_real (GfScreenshot *screenshot,
*height = rect.height;
}
- return save_screenshot (pixbuf, filename_in, filename_out);
+ return save_screenshot (screenshot, pixbuf, filename_in, filename_out);
}
static void
@@ -1396,6 +1405,8 @@ gf_screenshot_dispose (GObject *object)
g_clear_object (&screenshot->lockdown);
+ g_clear_pointer (&screenshot->datetime, g_date_time_unref);
+
G_OBJECT_CLASS (gf_screenshot_parent_class)->dispose (object);
}
@@ -1425,6 +1436,8 @@ gf_screenshot_init (GfScreenshot *screenshot)
g_free, NULL);
screenshot->lockdown = g_settings_new ("org.gnome.desktop.lockdown");
+
+ screenshot->datetime = g_date_time_new_now_local ();
}
GfScreenshot *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]