prefill new session name with a date-based default

Select it, so that typing will immediately replace it
This commit is contained in:
Paul Davis 2020-03-23 22:40:13 -06:00
parent fbcb7b9ffc
commit 78cf1ed119

View File

@ -507,6 +507,15 @@ SessionDialog::new_session_button_clicked ()
get_vbox()->remove (ic_vbox);
get_vbox()->pack_start (session_new_vbox, true, true);
time_t n;
time (&n);
struct tm* now = localtime (&n);
Glib::DateTime tm (Glib::DateTime::create_now_local (mktime (now)));
new_name_entry.set_text (string_compose (_("Untitled-%1"), tm.format ("%F-%H-%M-%S")));
new_name_entry.select_region (0, -1);
back_button->set_sensitive (true);
new_name_entry.grab_focus ();
}