Setup editor sensitivity on startup.
[dcpomatic.git] / src / tools / dcpomatic_playlist.cc
index 5a8ee91267a9cb27aa65dbc42f828a36fe6257fd..05dea1f330bfa09c88862ec43ccefd3706d02d53 100644 (file)
@@ -176,7 +176,9 @@ private:
                        return;
                }
 
-               if (change == SignalSPL::Change::NAME) {
+               switch (change) {
+               case SignalSPL::Change::NAME:
+               {
                        int N = 0;
                        for (auto i: _playlists) {
                                if (i == playlist) {
@@ -184,6 +186,13 @@ private:
                                }
                                ++N;
                        }
+                       break;
+               }
+               case SignalSPL::Change::CONTENT:
+                       if (auto dir = Config::instance()->player_playlist_directory()) {
+                               playlist->write(*dir / (playlist->id() + ".xml"));
+                       }
+                       break;
                }
        }
 
@@ -314,6 +323,8 @@ public:
                _down->Bind (wxEVT_BUTTON, bind(&PlaylistContent::down_clicked, this));
                _add->Bind (wxEVT_BUTTON, bind(&PlaylistContent::add_clicked, this));
                _remove->Bind (wxEVT_BUTTON, bind(&PlaylistContent::remove_clicked, this));
+
+               setup_sensitivity();
        }
 
        wxSizer* sizer ()
@@ -475,8 +486,6 @@ public:
 
                _playlist_list->Edit.connect (bind(&DOMFrame::change_playlist, this, _1));
 
-               _playlist_content->set (_playlist_list->first_playlist());
-
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::help_about, this), wxID_ABOUT);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);