From: Paul Davis Date: Thu, 9 Jul 2015 17:56:12 +0000 (-0400) Subject: update main window title appropriately X-Git-Tag: 5.0-pre0~1625 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=50e4ebff36108804d968bbe878ff4a470b1295f8;p=ardour.git update main window title appropriately --- diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 9e17d52e5e..997b790c1a 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -801,10 +801,15 @@ ARDOUR_UI::autosave_session () } void -ARDOUR_UI::update_autosave () +ARDOUR_UI::session_dirty_changed () { - ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_autosave) + update_autosave (); + update_title (); +} +void +ARDOUR_UI::update_autosave () +{ if (_session && _session->dirty()) { if (_autosave_connection.connected()) { _autosave_connection.disconnect(); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index cbc75e83a9..7b6c6f9e21 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -396,6 +396,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void update_autosave(); sigc::connection _autosave_connection; + void session_dirty_changed (); + void update_title (); + void map_transport_state (); int32_t do_engine_start (); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index bf965c7d34..6205272c4b 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -32,10 +32,12 @@ #include "pbd/error.h" #include "pbd/basename.h" #include "pbd/fastlog.h" -#include -#include -#include -#include + +#include "gtkmm2ext/cairocell.h" +#include "gtkmm2ext/utils.h" +#include "gtkmm2ext/click_box.h" +#include "gtkmm2ext/tearoff.h" +#include "gtkmm2ext/window_title.h" #include "ardour/profile.h" #include "ardour/session.h" @@ -795,4 +797,29 @@ ARDOUR_UI::toggle_follow_edits () UIConfiguration::instance().set_follow_edits (tact->get_active ()); } +void +ARDOUR_UI::update_title () +{ + if (_session) { + bool dirty = _session->dirty(); + string session_name; + + if (_session->snap_name() != _session->name()) { + session_name = _session->snap_name(); + } else { + session_name = _session->name(); + } + + if (dirty) { + session_name = "*" + session_name; + } + + WindowTitle title (session_name); + title += Glib::get_application_name(); + _main_window.set_title (title.get_string()); + } else { + WindowTitle title (Glib::get_application_name()); + _main_window.set_title (title.get_string()); + } +} diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 3bfe6d4a45..2b24b8535a 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -153,7 +153,7 @@ ARDOUR_UI::set_session (Session *s) _session->RecordStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::record_state_changed, this), gui_context()); _session->StepEditStatusChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::step_edit_status_change, this, _1), gui_context()); _session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::map_transport_state, this), gui_context()); - _session->DirtyChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_autosave, this), gui_context()); + _session->DirtyChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::session_dirty_changed, this), gui_context()); _session->Xrun.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::xrun_handler, this, _1), gui_context()); _session->SoloActive.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::soloing_changed, this, _1), gui_context()); @@ -237,6 +237,8 @@ ARDOUR_UI::set_session (Session *s) editor_meter_peak_display.show(); } } + + update_title (); } int @@ -315,7 +317,8 @@ ARDOUR_UI::unload_session (bool hide_stuff) session_loaded = false; update_buffer_load (); - + update_title (); + return 0; }