hostversion.cpp revision 917e3202179bd9460c46d8c1c4b2e34efaae1f41
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * X11 guest client - host version check.
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * Copyright (C) 2009 Sun Microsystems, Inc.
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * available from http://www.virtualbox.org. This file is free software;
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * you can redistribute it and/or modify it under the terms of the GNU
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * General Public License (GPL) as published by the Free Software
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * additional information or have any questions.
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsyncclass HostVersionService : public VBoxClient::Service
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync virtual const char *getPidFilePath()
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync return ".vboxclient-hostversion.pid";
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync virtual int showNotify(const char *pcHeader, const char *pcBody)
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync LogFlow(("Could not retrieve D-BUS session bus!\n"));
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync msg = dbus_message_new_method_call("org.freedesktop.Notifications",
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync "org.freedesktop.Notifications",
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync int32_t msg_timeout = -1; /* Let the notification server decide */
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync /* Format: UINT32 org.freedesktop.Notifications.Notify
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * (STRING app_name, UINT32 replaces_id, STRING app_icon, STRING summary, STRING body,
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync * ARRAY actions, DICT hints, INT32 expire_timeout)
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&msg_app);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_append_basic(&iter,DBUS_TYPE_UINT32,&msg_replace_id);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&msg_icon);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&msg_summary);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_append_basic(&iter,DBUS_TYPE_STRING,&msg_body);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_open_container(&iter,DBUS_TYPE_ARRAY,DBUS_TYPE_STRING_AS_STRING,&array);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_open_container(&iter,DBUS_TYPE_ARRAY,"{sv}",&array);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync dbus_message_iter_append_basic(&iter,DBUS_TYPE_INT32,&msg_timeout);
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync /* @todo Send with waiting for a reply! */
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync /* TODO: Implement me */
917e3202179bd9460c46d8c1c4b2e34efaae1f41vboxsync# endif /* VBOX_WITH_DBUS */
917e3202179bd9460c46d8c1c4b2e34efaae1f41vboxsync /** @todo Move this part in VbglR3 and just provide a callback for the platform-specific
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync notification stuff, since this is very similar to the VBoxTray code. */
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync virtual int run()
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync LogRel(("VBoxClient: D-Bus seems not to be installed; no host version check/notification done.\n"));
917e3202179bd9460c46d8c1c4b2e34efaae1f41vboxsync# endif /* VBOX_WITH_DBUS */
917e3202179bd9460c46d8c1c4b2e34efaae1f41vboxsync rc = VbglR3GuestPropConnect(&uGuestPropSvcClientID);
917e3202179bd9460c46d8c1c4b2e34efaae1f41vboxsync LogFlow(("Cannot connect to guest property service! rc = %Rrc\n", rc));
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync rc = VbglR3HostVersionCheckForUpdate(uGuestPropSvcClientID, &bUpdate, &pszHostVersion, &pszGuestVersion);
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync /** @todo add some translation macros here */
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync RTStrPrintf(szTitle, sizeof(szTitle), "VirtualBox Guest Additions update available!");
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync RTStrPrintf(szMsg, sizeof(szMsg), "Your guest is currently running the Guest Additions version %s. "
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync "We recommend updating to the latest version (%s) by choosing the "
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync "install option from the Devices menu.", pszGuestVersion, pszHostVersion);
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync Log(("VBoxClient: Could not show version notifier tooltip! rc = %d\n", rc));
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync /* Store host version to not notify again */
892354a49bac7f96155923cf8d2aa68a91c4dbd5vboxsync rc = VbglR3HostVersionLastCheckedStore(uGuestPropSvcClientID, pszHostVersion);
917e3202179bd9460c46d8c1c4b2e34efaae1f41vboxsync# endif /* VBOX_WITH_GUEST_PROPS */
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync virtual void cleanup()
e3559ff9101568144a45ace0534bf0283d7a91bdvboxsync/* Static factory */