aboutsummaryrefslogtreecommitdiff
path: root/backends/taskbar
diff options
context:
space:
mode:
authorLittleboy2011-04-01 08:01:53 -0400
committerJulien2011-06-16 10:38:40 -0400
commit984e1968bce3b4a23833719653a5d5751e5c8a04 (patch)
tree0235ecff55c4354bcce122c366d9de33011f3117 /backends/taskbar
parentc3d9c6afa57055705849359deaac7c5748d66fe1 (diff)
downloadscummvm-rg350-984e1968bce3b4a23833719653a5d5751e5c8a04.tar.gz
scummvm-rg350-984e1968bce3b4a23833719653a5d5751e5c8a04.tar.bz2
scummvm-rg350-984e1968bce3b4a23833719653a5d5751e5c8a04.zip
BACKENDS: Add WIP Unity support
Diffstat (limited to 'backends/taskbar')
-rw-r--r--backends/taskbar/unity/unity-taskbar.cpp43
-rw-r--r--backends/taskbar/unity/unity-taskbar.h7
2 files changed, 42 insertions, 8 deletions
diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp
index 4a074abca2..6c18f0940c 100644
--- a/backends/taskbar/unity/unity-taskbar.cpp
+++ b/backends/taskbar/unity/unity-taskbar.cpp
@@ -23,33 +23,64 @@
*
*/
+#include "common/scummsys.h"
+
#if defined(UNIX) && defined(USE_TASKBAR)
#include "backends/taskbar/unity/unity-taskbar.h"
-#include "common/config-manager.h"
#include "common/textconsole.h"
-#include "common/file.h"
UnityTaskbarManager::UnityTaskbarManager() {
+ g_type_init();
+
+ _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop");
}
UnityTaskbarManager::~UnityTaskbarManager() {
}
-void UnityTaskbarManager::setOverlayIcon(Common::String name, Common::String description) {
+void UnityTaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) {
+ if (_launcher == NULL)
+ return;
+
warning("[UnityTaskbarManager::setOverlayIcon] Not implemented");
}
void UnityTaskbarManager::setProgressValue(int completed, int total) {
- warning("[UnityTaskbarManager::setProgressValue] Not implemented");
+ if (_launcher == NULL)
+ return;
+
+ double percentage = (double)completed / (double)total;
+ unity_launcher_entry_set_progress(_launcher, percentage);
+ unity_launcher_entry_set_progress_visible(_launcher, TRUE);
}
void UnityTaskbarManager::setProgressState(TaskbarProgressState state) {
- warning("[UnityTaskbarManager::setProgressState] Not implemented");
+ if (_launcher == NULL)
+ return;
+
+ switch (state) {
+ default:
+ warning("[UnityTaskbarManager::setProgressState] Unknown state / Not implemented (%d)", state);
+ // fallback to noprogress state
+
+ case kTaskbarNoProgress:
+ unity_launcher_entry_set_progress_visible(_launcher, FALSE);
+ break;
+
+ // Unity only support two progress states as of 3.0: visible or not visible
+ // We show progress in all of those states
+ case kTaskbarIndeterminate:
+ case kTaskbarNormal:
+ case kTaskbarError:
+ case kTaskbarPaused:
+ unity_launcher_entry_set_progress_visible(_launcher, TRUE);
+ break;
+ }
}
-void UnityTaskbarManager::addRecent(Common::String name, Common::String description) {
+void UnityTaskbarManager::addRecent(const Common::String &name, const Common::String &description) {
warning("[UnityTaskbarManager::addRecent] Not implemented");
}
diff --git a/backends/taskbar/unity/unity-taskbar.h b/backends/taskbar/unity/unity-taskbar.h
index cd8efdaf2a..0d0484c02e 100644
--- a/backends/taskbar/unity/unity-taskbar.h
+++ b/backends/taskbar/unity/unity-taskbar.h
@@ -31,17 +31,20 @@
#include "common/str.h"
#include "common/taskbar.h"
+#include <unity.h>
+
class UnityTaskbarManager : public Common::TaskbarManager {
public:
UnityTaskbarManager();
virtual ~UnityTaskbarManager();
- virtual void setOverlayIcon(Common::String name, Common::String description);
+ virtual void setOverlayIcon(const Common::String &name, const Common::String &description);
virtual void setProgressValue(int completed, int total);
virtual void setProgressState(TaskbarProgressState state);
- virtual void addRecent(Common::String name, Common::String description);
+ virtual void addRecent(const Common::String &name, const Common::String &description);
private:
+ UnityLauncherEntry *_launcher;
};
#endif