summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-07 16:22:04 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-07 16:22:04 +0100
commite7aad9759e44ff3e1aa17ad8d5548a02646a67c5 (patch)
tree4e2ceabbc9abf6fe3417c74f715a04a5d9d4b03a /src
parentfea8c3743fd0710c2716fc6de5a283d378338800 (diff)
Fix servomatic_gui start-up on Linux (#98).
Diffstat (limited to 'src')
-rw-r--r--src/tools/servomatic_gui.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/tools/servomatic_gui.cc b/src/tools/servomatic_gui.cc
index dd169725f..52ec0a3a3 100644
--- a/src/tools/servomatic_gui.cc
+++ b/src/tools/servomatic_gui.cc
@@ -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 ("%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)