From afa34d57a016110be321c2070cc6f181e04be351 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 26 Jun 2013 15:10:26 +0200 Subject: [PATCH] set window title of meterbridge window --- gtk2_ardour/meterbridge.cc | 37 +++++++++++++++++++++++++++++++++++++ gtk2_ardour/meterbridge.h | 2 ++ 2 files changed, 39 insertions(+) diff --git a/gtk2_ardour/meterbridge.cc b/gtk2_ardour/meterbridge.cc index 533e33d2e3..47f12b331f 100644 --- a/gtk2_ardour/meterbridge.cc +++ b/gtk2_ardour/meterbridge.cc @@ -117,6 +117,8 @@ Meterbridge::Meterbridge () { set_name ("Meter Bridge"); + update_title (); + set_wmclass (X_("ardour_mixer"), PROGRAM_NAME); Gdk::Geometry geom; @@ -160,6 +162,36 @@ Meterbridge::show_window () _visible = true; } +/* code duplicated from gtk2_ardour/mixer_ui.cc Mixer_UI::update_title() */ +void +Meterbridge::update_title () +{ + if (_session) { + string n; + + if (_session->snap_name() != _session->name()) { + n = _session->snap_name (); + } else { + n = _session->name (); + } + + if (_session->dirty ()) { + n = "*" + n; + } + + WindowTitle title (n); + title += S_("Window|Meterbridge"); + title += Glib::get_application_name (); + set_title (title.get_string()); + + } else { + + WindowTitle title (S_("Window|Meterbridge")); + title += Glib::get_application_name (); + set_title (title.get_string()); + } +} + void Meterbridge::set_window_pos_and_size () { @@ -215,6 +247,8 @@ Meterbridge::set_session (Session* s) set_state (*node); } + update_title (); + SignalOrderRouteSorter sorter; boost::shared_ptr routes = _session->get_routes(); @@ -223,6 +257,8 @@ Meterbridge::set_session (Session* s) add_strips(copy); _session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&Meterbridge::add_strips, this, _1), gui_context()); + _session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&Meterbridge::update_title, this), gui_context()); + _session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&Meterbridge::update_title, this), gui_context()); if (_visible) { show_window(); @@ -246,6 +282,7 @@ Meterbridge::session_going_away () SessionHandlePtr::session_going_away (); _session = 0; + update_title (); } int diff --git a/gtk2_ardour/meterbridge.h b/gtk2_ardour/meterbridge.h index 79bbdb0dbf..3b50d6f8ae 100644 --- a/gtk2_ardour/meterbridge.h +++ b/gtk2_ardour/meterbridge.h @@ -81,6 +81,8 @@ class Meterbridge : static const int32_t default_width = 600; static const int32_t default_height = 400; + void update_title (); + // for restoring window geometry. int m_root_x, m_root_y, m_width, m_height;