Show last played date on each playlist tab
I like to know when I last listened to a song. Signed-off-by: Bryan Schumaker <bjchuma@gmail.com>
This commit is contained in:
parent
ca9f3e6cf9
commit
057bce8809
|
@ -58,6 +58,7 @@ namespace libsaria
|
|||
string &get_comment();
|
||||
string &get_genre();
|
||||
string &get_lenstr();
|
||||
string get_last_played();
|
||||
int &get_length();
|
||||
unsigned int &get_year();
|
||||
unsigned int &get_track();
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// Copyright (c) 2011 Bryan Schumaker.
|
||||
#include <libsaria/track.h>
|
||||
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
|
||||
|
@ -29,6 +32,18 @@ namespace libsaria
|
|||
return lenstr;
|
||||
}
|
||||
|
||||
string Track::get_last_played()
|
||||
{
|
||||
stringstream s;
|
||||
|
||||
if (count == 0)
|
||||
return "Never";
|
||||
s << last_month << " / ";
|
||||
s << last_day << " / ";
|
||||
s << last_year;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
int &Track::get_length()
|
||||
{
|
||||
return length;
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace ocarina
|
|||
5, track->get_album().c_str(),
|
||||
6, track->get_year(),
|
||||
7, track->get_count(),
|
||||
8, formatted(track->get_filepath()).c_str(),
|
||||
8, track->get_last_played().c_str(),
|
||||
9, formatted(track->get_filepath()).c_str(),
|
||||
-1);
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,8 @@ namespace ocarina
|
|||
gtk_tree_model_get(GTK_TREE_MODEL(liststore), &iter, 0, &t, -1);
|
||||
|
||||
while (t != track) {
|
||||
gtk_tree_model_iter_next(GTK_TREE_MODEL(liststore), &iter);
|
||||
if (!gtk_tree_model_iter_next(GTK_TREE_MODEL(liststore), &iter))
|
||||
return;
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(liststore), &iter, 0, &t, -1);
|
||||
}
|
||||
|
||||
|
@ -74,7 +76,8 @@ namespace ocarina
|
|||
5, track->get_album().c_str(),
|
||||
6, track->get_year(),
|
||||
7, track->get_count(),
|
||||
8, formatted(track->get_filepath()).c_str(),
|
||||
8, track->get_last_played().c_str(),
|
||||
9, formatted(track->get_filepath()).c_str(),
|
||||
-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,18 +20,19 @@ struct column_info {
|
|||
};
|
||||
|
||||
static struct column_info columns[] = {
|
||||
column_info( "Pointer", G_TYPE_POINTER, 2, false),
|
||||
column_info( "#", G_TYPE_INT, 20, true),
|
||||
column_info( "Title", G_TYPE_STRING, 300, true),
|
||||
column_info( "Length", G_TYPE_STRING, 60, true),
|
||||
column_info( "Artist", G_TYPE_STRING, 125, true),
|
||||
column_info( "Album", G_TYPE_STRING, 125, true),
|
||||
column_info( "Year", G_TYPE_INT, 50, true),
|
||||
column_info( "Count", G_TYPE_INT, 50, true),
|
||||
column_info("Filepath", G_TYPE_STRING, 2, false),
|
||||
column_info( "Pointer", G_TYPE_POINTER, 2, false),
|
||||
column_info( "#", G_TYPE_INT, 20, true),
|
||||
column_info( "Title", G_TYPE_STRING, 300, true),
|
||||
column_info( "Length", G_TYPE_STRING, 60, true),
|
||||
column_info( "Artist", G_TYPE_STRING, 125, true),
|
||||
column_info( "Album", G_TYPE_STRING, 125, true),
|
||||
column_info( "Year", G_TYPE_INT, 50, true),
|
||||
column_info( "Count", G_TYPE_INT, 50, true),
|
||||
column_info("Last Played", G_TYPE_STRING, 80, true),
|
||||
column_info( "Filepath", G_TYPE_STRING, 2, false),
|
||||
};
|
||||
|
||||
#define TOOLTIP 8
|
||||
#define TOOLTIP 9
|
||||
#define NUM_COLUMNS (sizeof(columns) / sizeof(column_info))
|
||||
|
||||
static void track_selected(GtkWidget *treeview, GtkTreePath *path,
|
||||
|
|
Loading…
Reference in New Issue