summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2014-09-07 17:25:04 +0200
committerBastien Nocera <hadess@hadess.net>2014-09-07 17:27:03 +0200
commite621d7063a08bda902138664afb7525fee806443 (patch)
tree6be9d5d00807589769114c645f00303c705fad44
parentfdd9f16fba353afb84af4d8a6b70bfe756a66f0a (diff)
downloadtotem-e621d7063a08bda902138664afb7525fee806443.tar.gz
save-file: Handle an unset Videos directory
This also fixes ~/Videos being used instead of the path to the real videos directory. https://bugzilla.gnome.org/show_bug.cgi?id=736231
-rw-r--r--src/plugins/save-file/totem-save-file.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/save-file/totem-save-file.c b/src/plugins/save-file/totem-save-file.c
index 03a0fc805..beb7c57b3 100644
--- a/src/plugins/save-file/totem-save-file.c
+++ b/src/plugins/save-file/totem-save-file.c
@@ -113,6 +113,17 @@ get_cache_path (void)
return path;
}
+static const char *
+get_videos_dir (void)
+{
+ const char *videos_dir;
+
+ videos_dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
+ if (!videos_dir)
+ videos_dir = g_get_home_dir ();
+ return videos_dir;
+}
+
static void
totem_save_file_plugin_copy (GSimpleAction *action,
GVariant *parameter,
@@ -176,7 +187,7 @@ totem_save_file_plugin_copy (GSimpleAction *action,
} else {
char *dest_path, *dest_uri;
- dest_path = g_build_filename (g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS), filename, NULL);
+ dest_path = g_build_filename (get_videos_dir (), filename, NULL);
dest_uri = g_filename_to_uri (dest_path, NULL, NULL);
g_free (dest_path);
@@ -258,9 +269,9 @@ totem_save_file_file_opened (TotemObject *totem,
/* We check whether it's in the Videos dir, in the future,
* we might want to check if it's native instead */
- videos_dir = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS));
+ videos_dir = g_file_new_for_path (get_videos_dir ());
if (file_has_ancestor (file, videos_dir)) {
- g_debug ("Not enabling offline save, as '%s' already in ~/Videos", mrl);
+ g_debug ("Not enabling offline save, as '%s' already in '%s'", mrl, get_videos_dir ());
goto out;
}