summaryrefslogtreecommitdiff
path: root/src/totem-session.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-03-11 13:42:58 +0100
committerBastien Nocera <hadess@hadess.net>2013-03-11 13:42:58 +0100
commit3aa062419c13142300812cbdf733100d186bb4eb (patch)
treed4ba09ef3f65eaa1458bb146905bb80748230cee /src/totem-session.c
parentb720cdd388976778f2b9948fc2972f34624d1792 (diff)
downloadtotem-3aa062419c13142300812cbdf733100d186bb4eb.tar.gz
main: Split off saving of the session playlist
We were using the same code as the interactive playlist saving, which meant that error messages popped up in an error dialogue as we were closing the application.
Diffstat (limited to 'src/totem-session.c')
-rw-r--r--src/totem-session.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/totem-session.c b/src/totem-session.c
index 8956e56d5..be51f5df5 100644
--- a/src/totem-session.c
+++ b/src/totem-session.c
@@ -27,15 +27,29 @@
#include "totem-session.h"
#include "totem-uri.h"
-static char *
-get_session_filename (void)
+static GFile *
+get_session_file (void)
{
- char *path, *uri;
+ GFile *file;
+ char *path;
path = g_build_filename (g_get_user_config_dir (), "totem", "session_state.xspf", NULL);
- uri = g_filename_to_uri (path, NULL, NULL);
+ file = g_file_new_for_path (path);
g_free (path);
+ return file;
+}
+
+static char *
+get_session_filename (void)
+{
+ GFile *file;
+ char *uri;
+
+ file = get_session_file ();
+ uri = g_file_get_uri (file);
+ g_object_unref (file);
+
return uri;
}
@@ -80,11 +94,11 @@ totem_session_try_restore (Totem *totem)
void
totem_session_save (Totem *totem)
{
- char *uri;
+ GFile *file;
- uri = get_session_filename ();
+ file = get_session_file ();
/* FIXME: Save the current seek time somehow */
/* FIXME: Check whether we actually want to be saved */
- totem_playlist_save_session_playlist (totem->playlist, uri);
- g_free (uri);
+ totem_playlist_save_session_playlist (totem->playlist, file);
+ g_object_unref (file);
}