hostversion.cpp revision e3559ff9101568144a45ace0534bf0283d7a91bd
/** @file
* X11 guest client - host version check.
*/
/*
* Copyright (C) 2009 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include <stdio.h>
#ifdef VBOX_WITH_DBUS
#endif
#include <VBox/VBoxGuestLib.h>
#include "VBoxClient.h"
{
public:
virtual const char *getPidFilePath()
{
return ".vboxclient-hostversion.pid";
}
{
int rc;
#ifdef VBOX_WITH_DBUS
{
LogFlow(("Could not retrieve D-BUS session bus!\n"));
}
else
{
"org.freedesktop.Notifications",
"Notify");
{
LogFlow(("Could not create D-BUS message!\n"));
}
}
if (RT_SUCCESS(rc))
{
uint32_t msg_replace_id = 0;
const char *msg_app = "VBoxClient";
const char *msg_icon = "";
const char *msg_summary = pcHeader;
/* Format: UINT32 org.freedesktop.Notifications.Notify
* (STRING app_name, UINT32 replaces_id, STRING app_icon, STRING summary, STRING body,
* ARRAY actions, DICT hints, INT32 expire_timeout)
*/
/* @todo Send with waiting for a reply! */
}
#else
/* TODO: Implement me */
rc = VINF_SUCCESS;
#endif /* VBOX_WITH_DBUS */
return rc;
}
virtual int run()
{
int rc;
LogFlowFunc(("\n"));
#ifdef VBOX_WITH_DBUS
rc = RTDBusLoadLib();
if (RT_FAILURE(rc))
{
LogRel(("VBoxClient: D-Bus seems not to be installed; no host version check/notification done.\n"));
}
#else
#endif
if (RT_SUCCESS(rc))
{
int rc;
char *pszHostVersion;
char *pszGuestVersion;
if (RT_SUCCESS(rc))
{
char szMsg[256];
char szTitle[64];
/** @todo add some translation macros here */
RTStrPrintf(szMsg, sizeof(szMsg), "Your guest is currently running the Guest Additions version %s. "
"We recommend updating to the latest version (%s) by choosing the "
if (RT_FAILURE(rc))
}
/* If we didn't have to check for the host version then this is not an error */
if (rc == VERR_NOT_SUPPORTED)
rc = VINF_SUCCESS;
}
return rc;
}
virtual void cleanup()
{
}
};
/* Static factory */
{
return new HostVersionService;
}