I said we were in string freeze, but only nl_NL has come in so
[dcpomatic.git] / src / tools / dcpomatic_playlist.cc
index fe49a261070752c328e6e9762f05bc1756e32f23..6b1066c5dd7a148872bb670fe1df81c85e22aa2f 100644 (file)
@@ -32,6 +32,9 @@
 #include <wx/wx.h>
 #include <wx/listctrl.h>
 #include <wx/imaglist.h>
+#ifdef __WXOSX__
+#include <ApplicationServices/ApplicationServices.h>
+#endif
 
 using std::exception;
 using std::cout;
@@ -161,7 +164,6 @@ private:
                item.SetId (_list->GetItemCount());
                long const N = _list->InsertItem (item);
                set_item (N, e);
-               _playlist.add (e);
        }
 
        void selection_changed ()
@@ -230,7 +232,9 @@ private:
                if (r == wxID_OK) {
                        shared_ptr<Content> content = _content_dialog->selected ();
                        if (content) {
-                               add (SPLEntry(content));
+                               SPLEntry e (content);
+                               add (e);
+                               _playlist.add (e);
                        }
                }
        }
@@ -282,7 +286,9 @@ private:
                wxString default_dir = c->player_playlist_directory() ? std_to_wx(c->player_playlist_directory()->string()) : wxString(wxEmptyString);
                wxFileDialog* d = new wxFileDialog (this, _("Select playlist file"), default_dir, wxEmptyString, wxT("XML files (*.xml)|*.xml"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
                if (d->ShowModal() == wxID_OK) {
-                       _playlist.write (wx_to_std(d->GetPath()));
+                       boost::filesystem::path file = wx_to_std (d->GetPath());
+                       file.replace_extension (".xml");
+                       _playlist.write (file);
                }
        }
 
@@ -295,6 +301,7 @@ private:
                        _list->DeleteAllItems ();
                        _playlist.read (wx_to_std(d->GetPath()), _content_dialog);
                        if (!_playlist.missing()) {
+                               _list->DeleteAllItems ();
                                BOOST_FOREACH (SPLEntry i, _playlist.get()) {
                                        add (i);
                                }
@@ -347,7 +354,7 @@ private:
                unsetenv ("UBUNTU_MENUPROXY");
 #endif
 
-               #ifdef __WXOSX__
+#ifdef __WXOSX__
                ProcessSerialNumber serial;
                GetCurrentProcess (&serial);
                TransformProcessType (&serial, kProcessTransformToForegroundApplication);