[totem/wip/hadess/screenshot-slash] screenshot: Remove '/' in screenshot filenames
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/screenshot-slash] screenshot: Remove '/' in screenshot filenames
- Date: Thu, 20 Aug 2020 11:50:41 +0000 (UTC)
commit b9189273be0adea997a4903df1a87ffe43f8df11
Author: Bastien Nocera <hadess hadess net>
Date: Thu Aug 20 13:41:38 2020 +0200
screenshot: Remove '/' in screenshot filenames
Make sure we don't use a slash in the pattern for screenshots or we
wouldn't be able to save the screenshot at all.
Closes: #427
src/plugins/screenshot/totem-screenshot-plugin.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/screenshot/totem-screenshot-plugin.c
b/src/plugins/screenshot/totem-screenshot-plugin.c
index 2d488b542..ce8481a26 100644
--- a/src/plugins/screenshot/totem-screenshot-plugin.c
+++ b/src/plugins/screenshot/totem-screenshot-plugin.c
@@ -200,6 +200,16 @@ flash_area (GtkWidget *widget)
NULL);
}
+static char *
+escape_video_name (const char *orig)
+{
+ g_auto(GStrv) elems = NULL;
+
+ /* '/' can't be in a filename */
+ elems = g_strsplit (orig, "/", -1);
+ return g_strjoinv ("–", elems);
+}
+
static void
take_screenshot_action_cb (GSimpleAction *action,
GVariant *parameter,
@@ -209,7 +219,8 @@ take_screenshot_action_cb (GSimpleAction *action,
GdkPixbuf *pixbuf;
GError *err = NULL;
ScreenshotSaveJob *job;
- char *video_name;
+ g_autofree char *video_name = NULL;
+ g_autofree char *escaped_video_name = NULL;
if (bacon_video_widget_get_logo_mode (priv->bvw) != FALSE)
return;
@@ -232,14 +243,13 @@ take_screenshot_action_cb (GSimpleAction *action,
}
video_name = totem_object_get_short_title (self->priv->totem);
+ escaped_video_name = escape_video_name (video_name);
job = g_slice_new (ScreenshotSaveJob);
job->plugin = self;
job->pixbuf = pixbuf;
screenshot_build_filename_async (NULL, video_name, screenshot_name_ready_cb, job);
-
- g_free (video_name);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]