From 5649ddaf101db5d8ce70e9ba1bfda850c5d00aa5 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Mon, 4 Apr 2011 16:10:58 -0400 Subject: BACKENDS: Move Win32TaskbarManager init code to constructor --- backends/taskbar/win32/win32-taskbar.cpp | 30 +++++++++++++----------------- backends/taskbar/win32/win32-taskbar.h | 2 -- 2 files changed, 13 insertions(+), 19 deletions(-) (limited to 'backends/taskbar') diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp index c630129ea9..fd8cd263e8 100644 --- a/backends/taskbar/win32/win32-taskbar.cpp +++ b/backends/taskbar/win32/win32-taskbar.cpp @@ -51,19 +51,7 @@ const PROPERTYKEY PKEY_Title = { /* fmtid = */ { 0xF29F85E0, 0x4FF9, 0x1068, { 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9 } }, /* propID = */ 2 }; Win32TaskbarManager::Win32TaskbarManager() { - _taskbar = NULL; -} - -Win32TaskbarManager::~Win32TaskbarManager() { - if (_taskbar) - _taskbar->Release(); - _taskbar = NULL; - - CoUninitialize(); -} - -void Win32TaskbarManager::init() { - // Do nothing if not running on Windows 7 of later + // Do nothing if not running on Windows 7 or later if (!isWin7OrLater()) return; @@ -71,10 +59,10 @@ void Win32TaskbarManager::init() { // Try creating instance (on fail, _taskbar will contain NULL) HRESULT hr = CoCreateInstance(CLSID_TaskbarList, - 0, - CLSCTX_INPROC_SERVER, - IID_ITaskbarList3, - reinterpret_cast (&(_taskbar))); + 0, + CLSCTX_INPROC_SERVER, + IID_ITaskbarList3, + reinterpret_cast (&(_taskbar))); if (SUCCEEDED(hr)) { // Initialize taskbar object @@ -87,6 +75,14 @@ void Win32TaskbarManager::init() { } } +Win32TaskbarManager::~Win32TaskbarManager() { + if (_taskbar) + _taskbar->Release(); + _taskbar = NULL; + + CoUninitialize(); +} + void Win32TaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) { //warning("[Win32TaskbarManager::setOverlayIcon] Setting overlay icon to: %s (%s)", name.c_str(), description.c_str()); diff --git a/backends/taskbar/win32/win32-taskbar.h b/backends/taskbar/win32/win32-taskbar.h index 7d963c19ca..0fc219e816 100644 --- a/backends/taskbar/win32/win32-taskbar.h +++ b/backends/taskbar/win32/win32-taskbar.h @@ -38,8 +38,6 @@ public: Win32TaskbarManager(); virtual ~Win32TaskbarManager(); - void init(); - virtual void setOverlayIcon(const Common::String &name, const Common::String &description); virtual void setProgressValue(int completed, int total); virtual void setProgressState(TaskbarProgressState state); -- cgit v1.2.3