1
/*********************************************************
2
* Copyright (C) 2011 VMware, Inc. All rights reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License as published
6
* by the Free Software Foundation version 2.1 and no later version.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
* or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
11
* License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*********************************************************/
20
* unityPluginPosix.cpp --
22
* POSIX subclass of UnityPlugin interface.
26
#include "unityPluginPosix.h"
30
#include <glib-object.h>
32
#include "vmware/tools/desktopevents.h"
33
#if defined(OPEN_VM_TOOLS)
34
#include "unitylib/unity.h"
37
#endif // OPEN_VM_TOOLS
46
*-----------------------------------------------------------------------------
48
* UnityPluginPosix::UnityPluginPosix --
58
*-----------------------------------------------------------------------------
61
UnityPluginPosix::UnityPluginPosix()
69
*-----------------------------------------------------------------------------
71
* UnityPluginPosix::~UnityPluginPosix --
81
*-----------------------------------------------------------------------------
84
UnityPluginPosix::~UnityPluginPosix()
87
for (std::map<const char*, gulong>::iterator i = mSignalIDs.begin();
88
i != mSignalIDs.end();
90
g_signal_handler_disconnect(mCtx->serviceObj, i->second);
97
*-----------------------------------------------------------------------------
99
* UnityPluginPosix::Initialize --
101
* Initialize UnityPlugin base class and connect to X Session Manager
105
* TRUE on success, FALSE otherwise.
110
*-----------------------------------------------------------------------------
114
UnityPluginPosix::Initialize(ToolsAppCtx* ctx) // IN
116
if (UnityPlugin::Initialize(ctx)) {
118
mSignalIDs[TOOLS_CORE_SIG_XSM_DIE] =
119
g_signal_connect(ctx->serviceObj, TOOLS_CORE_SIG_XSM_DIE,
120
G_CALLBACK(XSMDieCb), static_cast<gpointer>(this));
129
*-----------------------------------------------------------------------------
131
* UnityPluginPosix::OnXSMEvent --
133
* X Session Management event handler. Exits Unity upon notice of session
140
* May trigger Unity exit.
142
*-----------------------------------------------------------------------------
146
UnityPluginPosix::OnXSMDie()
148
if (Unity_IsActive()) {
155
******************************************************************************
156
* BEGIN Static member functions
161
*-----------------------------------------------------------------------------
163
* UnityPluginPosix::XSMDieCb --
165
* Thunk between XSM "die" OnXSMDie.
173
*-----------------------------------------------------------------------------
177
UnityPluginPosix::XSMDieCb(GObject* obj, // UNUSED
178
ToolsAppCtx* ctx, // UNUSED
179
gpointer cbData) // IN: UnityPluginPosix*
181
UnityPluginPosix* unityPlugin = static_cast<UnityPluginPosix*>(cbData);
182
unityPlugin->OnXSMDie();
187
* END Static member functions
188
******************************************************************************
193
} // namespace vmware