13
0

add "last modified" column to session-dialog

This commit is contained in:
Robin Gareus 2015-09-16 17:14:10 +02:00
parent 6c43ca5334
commit 1fb38a416a
2 changed files with 19 additions and 2 deletions

View File

@ -326,6 +326,7 @@ SessionDialog::setup_initial_choice_box ()
recent_session_display.append_column (_("Session Name"), recent_session_columns.visible_name); recent_session_display.append_column (_("Session Name"), recent_session_columns.visible_name);
recent_session_display.append_column (_("Sample Rate"), recent_session_columns.sample_rate); recent_session_display.append_column (_("Sample Rate"), recent_session_columns.sample_rate);
recent_session_display.append_column (_("File Resolution"), recent_session_columns.disk_format); recent_session_display.append_column (_("File Resolution"), recent_session_columns.disk_format);
recent_session_display.append_column (_("Last Modified"), recent_session_columns.time_formatted);
recent_session_display.set_headers_visible (true); recent_session_display.set_headers_visible (true);
recent_session_display.get_selection()->set_mode (SELECTION_SINGLE); recent_session_display.get_selection()->set_mode (SELECTION_SINGLE);
@ -688,6 +689,7 @@ SessionDialog::redisplay_recent_sessions ()
// opening the parent item will fail, but expanding it will show the session // opening the parent item will fail, but expanding it will show the session
// files that actually exist, and the right one can then be opened. // files that actually exist, and the right one can then be opened.
row[recent_session_columns.visible_name] = Glib::path_get_basename (dirname); row[recent_session_columns.visible_name] = Glib::path_get_basename (dirname);
int64_t most_recent = 0;
// add the children // add the children
for (std::vector<std::string>::iterator i2 = state_file_names.begin(); i2 != state_file_names.end(); ++i2) { for (std::vector<std::string>::iterator i2 = state_file_names.begin(); i2 != state_file_names.end(); ++i2) {
@ -699,7 +701,14 @@ SessionDialog::redisplay_recent_sessions ()
child_row[recent_session_columns.fullpath] = s; child_row[recent_session_columns.fullpath] = s;
child_row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname); child_row[recent_session_columns.tip] = Glib::Markup::escape_text (dirname);
g_stat (s.c_str(), &gsb); g_stat (s.c_str(), &gsb);
row[recent_session_columns.time_modified] = gsb.st_mtime; child_row[recent_session_columns.time_modified] = gsb.st_mtime;
Glib::DateTime gdt(Glib::DateTime::create_now_local (gsb.st_mtime));
child_row[recent_session_columns.time_formatted] = gdt.format ("%F");
if (gsb.st_mtime > most_recent) {
most_recent = gsb.st_mtime;
}
if (Session::get_info_from_path (s, sr, sf) == 0) { if (Session::get_info_from_path (s, sr, sf) == 0) {
child_row[recent_session_columns.sample_rate] = rate_as_string (sr); child_row[recent_session_columns.sample_rate] = rate_as_string (sr);
@ -719,13 +728,19 @@ SessionDialog::redisplay_recent_sessions ()
child_row[recent_session_columns.disk_format] = "--"; child_row[recent_session_columns.disk_format] = "--";
} }
++session_snapshot_count; ++session_snapshot_count;
} }
assert (most_recent >= row[recent_session_columns.time_modified]);
row[recent_session_columns.time_modified] = most_recent;
} else { } else {
// only a single session file in the directory - show its actual name. // only a single session file in the directory - show its actual name.
row[recent_session_columns.visible_name] = state_file_basename; row[recent_session_columns.visible_name] = state_file_basename;
} }
Glib::DateTime gdt(Glib::DateTime::create_now_local (row[recent_session_columns.time_modified]));
row[recent_session_columns.time_formatted] = gdt.format ("%F");
} }
recent_session_display.set_tooltip_column(1); // recent_session_columns.tip recent_session_display.set_tooltip_column(1); // recent_session_columns.tip

View File

@ -116,6 +116,7 @@ class SessionDialog : public ArdourDialog {
add (sample_rate); add (sample_rate);
add (disk_format); add (disk_format);
add (time_modified); add (time_modified);
add (time_formatted);
} }
Gtk::TreeModelColumn<std::string> visible_name; Gtk::TreeModelColumn<std::string> visible_name;
Gtk::TreeModelColumn<std::string> tip; Gtk::TreeModelColumn<std::string> tip;
@ -123,6 +124,7 @@ class SessionDialog : public ArdourDialog {
Gtk::TreeModelColumn<std::string> sample_rate; Gtk::TreeModelColumn<std::string> sample_rate;
Gtk::TreeModelColumn<std::string> disk_format; Gtk::TreeModelColumn<std::string> disk_format;
Gtk::TreeModelColumn<int64_t> time_modified; Gtk::TreeModelColumn<int64_t> time_modified;
Gtk::TreeModelColumn<std::string> time_formatted;
}; };
RecentSessionModelColumns recent_session_columns; RecentSessionModelColumns recent_session_columns;