aboutsummaryrefslogtreecommitdiff
path: root/backends/taskbar/unity/unity-taskbar.cpp
diff options
context:
space:
mode:
authorLittleboy2011-04-04 12:35:19 -0400
committerJulien2011-06-16 14:22:51 -0400
commit6c14d8a95052b68c9f076d32e520c6befac3d959 (patch)
tree065d18cf4d35158c62ba6a39ec0029dc564d46c4 /backends/taskbar/unity/unity-taskbar.cpp
parentcd09b7e74fd9552901505082166b679c39f85ccc (diff)
downloadscummvm-rg350-6c14d8a95052b68c9f076d32e520c6befac3d959.tar.gz
scummvm-rg350-6c14d8a95052b68c9f076d32e520c6befac3d959.tar.bz2
scummvm-rg350-6c14d8a95052b68c9f076d32e520c6befac3d959.zip
BACKENDS: Integrate glib main event loop
- Unity needs a glib event loop to dispatch events. - Cleanup whitespace and indentation
Diffstat (limited to 'backends/taskbar/unity/unity-taskbar.cpp')
-rw-r--r--backends/taskbar/unity/unity-taskbar.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp
index 6c18f0940c..24347e382f 100644
--- a/backends/taskbar/unity/unity-taskbar.cpp
+++ b/backends/taskbar/unity/unity-taskbar.cpp
@@ -32,27 +32,31 @@
#include "common/textconsole.h"
UnityTaskbarManager::UnityTaskbarManager() {
- g_type_init();
+ g_type_init();
- _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop");
+ _loop = g_main_loop_new(NULL, FALSE);
+
+ _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop");
}
UnityTaskbarManager::~UnityTaskbarManager() {
+ g_main_loop_unref(_loop);
+ _loop = NULL;
}
void UnityTaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) {
if (_launcher == NULL)
- return;
+ return;
warning("[UnityTaskbarManager::setOverlayIcon] Not implemented");
}
void UnityTaskbarManager::setProgressValue(int completed, int total) {
- if (_launcher == NULL)
- return;
+ if (_launcher == NULL)
+ return;
- double percentage = (double)completed / (double)total;
- unity_launcher_entry_set_progress(_launcher, percentage);
+ double percentage = (double)completed / (double)total;
+ unity_launcher_entry_set_progress(_launcher, percentage);
unity_launcher_entry_set_progress_visible(_launcher, TRUE);
}
@@ -84,4 +88,21 @@ void UnityTaskbarManager::addRecent(const Common::String &name, const Common::St
warning("[UnityTaskbarManager::addRecent] Not implemented");
}
+// Unity requires the glib event loop to the run to function properly
+// as events are sent asynchronously
+bool UnityTaskbarManager::pollEvent(Common::Event &event) {
+ if (!_loop)
+ return false;
+
+ // Get context
+ GMainContext *context = g_main_loop_get_context(_loop);
+ if (!context)
+ return false;
+
+ // Dispatch events
+ g_main_context_iteration(context, FALSE);
+
+ return false;
+}
+
#endif