ocarina: Set current duration using new format function

This gives me the correct answer right away.  I also re-set the time
whenever a new playlist is created to keep the new tab from changing the
time.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-29 08:10:24 -04:00
parent c5fe4546e2
commit 14c35e5810
2 changed files with 7 additions and 2 deletions

View File

@ -16,6 +16,11 @@ static void new_playlist(ocarina::Playlist *plist, PlaylistType type)
list<libsaria::Track *> tracks;
plist->list_selected_tracks(tracks);
libsaria::create_new_playlist(tracks, type);
/*
* The new playlist will set the length string text,
* so reset it again here
*/
plist->on_show();
}
static void new_queue(GtkMenuItem *menu, gpointer data)

View File

@ -2,6 +2,7 @@
#include <ocarina/playlist.h>
#include <ocarina/body.h>
#include <libsaria/format.h>
#include <libsaria/track.h>
#include <sstream>
@ -39,8 +40,7 @@ namespace ocarina
string text;
stringstream stream;
stream << playlist->get_size() << " ";
stream << "songs, " << playlist->get_length();
stream << " seconds";
stream << "songs: " << libsaria::length_string(playlist->get_length());
text = stream.str();
body::set_length_label_text(text);