From 482b71d35e90dcda60324fe1714515be82317429 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 16 Sep 2015 22:17:02 +0200 Subject: add datetime to snapshot sidebar Currently only information, not sortable. --- gtk2_ardour/editor_snapshots.cc | 17 +++++++++++++++++ gtk2_ardour/editor_snapshots.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_snapshots.cc b/gtk2_ardour/editor_snapshots.cc index ed49ef35b3..65895f32d3 100644 --- a/gtk2_ardour/editor_snapshots.cc +++ b/gtk2_ardour/editor_snapshots.cc @@ -17,11 +17,20 @@ */ + +#include +#include +#include + #include + #include "gtkmm2ext/choice.h" + +#include "ardour/filename_extensions.h" #include "ardour/session.h" #include "ardour/session_state_utils.h" #include "ardour/session_directory.h" + #include "editor_snapshots.h" #include "ardour_ui.h" #include "i18n.h" @@ -40,6 +49,7 @@ EditorSnapshots::EditorSnapshots (Editor* e) _model = ListStore::create (_columns); _display.set_model (_model); _display.append_column (X_("snapshot"), _columns.visible_name); + _display.append_column (X_("lastmod"), _columns.time_formatted); _display.set_size_request (75, -1); _display.set_headers_visible (false); _display.set_reorderable (false); @@ -203,8 +213,15 @@ EditorSnapshots::redisplay () _display.get_selection()->select(row); } + std::string s = Glib::build_filename (_session->path(), statename + ARDOUR::statefile_suffix); + + GStatBuf gsb; + g_stat (s.c_str(), &gsb); + Glib::DateTime gdt(Glib::DateTime::create_now_local (gsb.st_mtime)); + row[_columns.visible_name] = display_name; row[_columns.real_name] = statename; + row[_columns.time_formatted] = gdt.format ("%F %H:%M"); } } diff --git a/gtk2_ardour/editor_snapshots.h b/gtk2_ardour/editor_snapshots.h index 132c2f090c..48626a5368 100644 --- a/gtk2_ardour/editor_snapshots.h +++ b/gtk2_ardour/editor_snapshots.h @@ -44,9 +44,11 @@ private: Columns () { add (visible_name); add (real_name); + add (time_formatted); } Gtk::TreeModelColumn visible_name; Gtk::TreeModelColumn real_name; + Gtk::TreeModelColumn time_formatted; }; Columns _columns; -- cgit v1.2.3