[totem] main: Rename totem_playlist_save_current_playlist()



commit c57ad1bc0ef7edcb1195463d7119fa0ed66c38ba
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Mar 11 13:14:58 2013 +0100

    main: Rename totem_playlist_save_current_playlist()
    
    To totem_playlist_save_session_playlist() and make the
    new function check whether we should be saving the session
    state.

 src/totem-playlist.c |   20 ++++++++++++++++++--
 src/totem-playlist.h |    4 ++--
 src/totem-session.c  |    2 +-
 3 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 96fc75d..c751d92 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -439,9 +439,25 @@ totem_playlist_save_iter_foreach (GtkTreeModel *model,
 }
 
 void
-totem_playlist_save_current_playlist (TotemPlaylist *playlist, const char *output)
+totem_playlist_save_session_playlist (TotemPlaylist *playlist,
+                                     const char    *output_uri)
 {
-       totem_playlist_save_current_playlist_ext (playlist, output, TOTEM_PL_PARSER_XSPF);
+       if (playlist->priv->disable_save_to_disk) {
+               /* On lockdown, we do not touch the disk,
+                * even to remove the existing session */
+               return;
+       }
+       if (!playlist->priv->save) {
+               GFile *file;
+
+
+               file = g_file_new_for_uri (output_uri);
+               g_file_delete (file, NULL, NULL);
+               g_object_unref (file);
+               return;
+       }
+
+       totem_playlist_save_current_playlist_ext (playlist, output_uri, TOTEM_PL_PARSER_XSPF);
 }
 
 void
diff --git a/src/totem-playlist.h b/src/totem-playlist.h
index d08be2c..14db5e8 100644
--- a/src/totem-playlist.h
+++ b/src/totem-playlist.h
@@ -114,8 +114,8 @@ gboolean totem_playlist_add_mrls_finish (TotemPlaylist *self,
                                          GAsyncResult *result,
                                          GError **error);
 
-void totem_playlist_save_current_playlist (TotemPlaylist *playlist,
-                                          const char *output);
+void totem_playlist_save_session_playlist (TotemPlaylist *playlist,
+                                          const char *output_uri);
 void totem_playlist_save_current_playlist_ext (TotemPlaylist *playlist,
                                           const char *output, TotemPlParserType type);
 void totem_playlist_select_subtitle_dialog (TotemPlaylist *playlist,
diff --git a/src/totem-session.c b/src/totem-session.c
index d3d018a..1580749 100644
--- a/src/totem-session.c
+++ b/src/totem-session.c
@@ -82,6 +82,6 @@ totem_session_save (Totem *totem)
        uri = get_session_filename ();
        /* FIXME: Save the current seek time somehow */
        /* FIXME: Check whether we actually want to be saved */
-       totem_playlist_save_current_playlist (totem->playlist, uri);
+       totem_playlist_save_session_playlist (totem->playlist, uri);
        g_free (uri);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]