Merge branch 'master' of ssh://houllier/home/carl/git/dvdomatic
[dcpomatic.git] / src / tools / servomatic_gui.cc
index dd169725f988f7f96669afd03378145702390542..5e36660eb798b861372db178c5010f4c97a8d271 100644 (file)
@@ -94,7 +94,15 @@ class TaskBarIcon : public wxTaskBarIcon
 public:
        TaskBarIcon ()
        {
+#ifdef __WXMSW__               
                wxIcon icon (std_to_wx ("taskbar_icon"));
+#endif
+#ifdef __WXGTK__
+               wxInitAllImageHandlers();
+               wxBitmap bitmap (wxString::Format (wxT ("%s/taskbar_icon.png"), POSIX_ICON_PREFIX), wxBITMAP_TYPE_PNG);
+               wxIcon icon;
+               icon.CopyFromBitmap (bitmap);
+#endif         
                SetIcon (icon, std_to_wx ("DVD-o-matic encode server"));
 
                Connect (ID_status, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (TaskBarIcon::status));
@@ -128,20 +136,31 @@ public:
        App ()
                : wxApp ()
                , _thread (0)
+               , _icon (0)
        {}
 
 private:       
        
        bool OnInit ()
        {
+               if (!wxApp::OnInit ()) {
+                       return false;
+               }
+               
                dvdomatic_setup ();
 
-               new TaskBarIcon;
-
+               _icon = new TaskBarIcon;
                _thread = new thread (bind (&App::main_thread, this));
+               
                return true;
        }
 
+       int OnExit ()
+       {
+               delete _icon;
+               return wxApp::OnExit ();
+       }
+
        void main_thread ()
        {
                Server server (memory_log);
@@ -149,6 +168,7 @@ private:
        }
 
        boost::thread* _thread;
+       TaskBarIcon* _icon;
 };
 
 IMPLEMENT_APP (App)