hostversion.cpp revision bfb94b3d82f6372f4693ee675d6c5030c6252401
/** @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");
{
Log(("Could not create D-BUS message!\n"));
}
else
rc = VINF_SUCCESS;
}
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)
*/
if (dbus_error_is_set(&err))
{
}
else if (reply)
{
}
if (dbus_error_is_set(&err))
}
# else
/* TODO: Implement me */
rc = VINF_SUCCESS;
# endif /* VBOX_WITH_DBUS */
return rc;
}
/** @todo Move this part in VbglR3 and just provide a callback for the platform-specific
notification stuff, since this is very similar to the VBoxTray code. */
{
int rc;
LogFlowFunc(("\n"));
/* Because we need desktop notifications to be displayed, wait
* some time to make the desktop environment load (as a work around). */
if (fDaemonised)
# 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 /* VBOX_WITH_DBUS */
# ifdef VBOX_WITH_GUEST_PROPS
if (RT_SUCCESS(rc))
{
if (RT_FAILURE(rc))
}
if (RT_SUCCESS(rc))
{
char *pszHostVersion;
char *pszGuestVersion;
bool bUpdate;
rc = VbglR3HostVersionCheckForUpdate(uGuestPropSvcClientID, &bUpdate, &pszHostVersion, &pszGuestVersion);
if (RT_SUCCESS(rc))
{
if (bUpdate)
{
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 "
LogRel(("VBoxClient: VirtualBox Guest Additions update available!"));
if (RT_FAILURE(rc))
}
/* Store host version to not notify again */
}
}
# endif /* VBOX_WITH_GUEST_PROPS */
return rc;
}
virtual void cleanup()
{
}
};
/* Static factory */
{
return new HostVersionService;
}