Removed dependency on qt for kde-style notifications. Updated notes.

This commit is contained in:
Guillaume Melquiond 2009-08-10 06:11:23 +00:00
parent 96a88e73a0
commit 12e2249d1d
4 changed files with 11 additions and 29 deletions

View file

@ -24,8 +24,7 @@ You'll need to have these libraries (with equivalent devel versions) to build We
These libraries are optional dependencies that unlock additional features:
gtkmm-2.4 >= 2.8.0 (needed by libnotifymm)
libnotifymm-1.0 (used for desktop notifications)
libdbus-1 (used for desktop notifications)
There are currently three ways to build wesnoth:
* The old autotools system

View file

@ -21,7 +21,8 @@ Minimum version for Boost is now 1.35.
***
REPLACE ME WITH CONTENT...
Dependencies on gtkmm/libnotify and qt are no longer needed for desktop
notifications. Plain dbus is now sufficient.
***

View file

@ -48,6 +48,7 @@ Version 1.7.2+svn:
* No longer "crash" upon invalid pango markup
* It's now possible to display the area a widget uses, for debug purposes
* The widget in a stacked widget now grows properly
* Merged code for FDO and KDE desktop notification; only dbus is needed
Version 1.7.2:
* Campaigns:

View file

@ -31,11 +31,6 @@
Growl_Delegate growl_obj;
#endif
#ifdef HAVE_QTDBUS
#define QT_NO_KEYWORDS
#include <QtDBus>
#endif
#include "actions.hpp"
#include "foreach.hpp"
#include "halo.hpp"
@ -1039,7 +1034,7 @@ std::string game_display::current_team_name() const
}
#ifdef HAVE_LIBDBUS
static int kde_style = 0;
static bool kde_style = false;
struct wnotify
{
@ -1078,6 +1073,10 @@ static DBusConnection *get_dbus_connection()
if (!initted)
{
initted = true;
if (getenv("KDE_FULL_SESSION")) {
// TODO: check for version <= 4.3.
kde_style = true;
}
DBusError err;
dbus_error_init(&err);
connection = dbus_bus_get(DBUS_BUS_SESSION, &err);
@ -1153,13 +1152,13 @@ static uint32_t send_dbus_notification(DBusConnection *connection, uint32_t repl
}
#endif
#if defined(HAVE_LIBDBUS) || defined(HAVE_QTDBUS) || defined(HAVE_GROWL)
#if defined(HAVE_LIBDBUS) || defined(HAVE_GROWL)
void game_display::send_notification(const std::string& owner, const std::string& message)
#else
void game_display::send_notification(const std::string& /*owner*/, const std::string& /*message*/)
#endif
{
#if defined(HAVE_LIBDBUS) || defined(HAVE_QTDBUS) || defined(HAVE_GROWL)
#if defined(HAVE_LIBDBUS) || defined(HAVE_GROWL)
Uint8 app_state = SDL_GetAppState();
// Do not show notifications when the window is visible...
@ -1196,24 +1195,6 @@ void game_display::send_notification(const std::string& /*owner*/, const std::st
notifications.push_back(visual);
#endif
#ifdef HAVE_QTDBUS
QDBusInterface notify("org.kde.VisualNotifications", "/VisualNotifications", "org.kde.VisualNotifications");
QList<QVariant> args;
args.append("Battle for Wesnoth");
args.append(0U);
args.append("");
args.append((game_config::path + "/data/core/images/wesnoth-icon.png").c_str());
args.append(QString::fromUtf8(owner.c_str()));
args.append(QString::fromUtf8(message.c_str()));
args.append(QStringList());
args.append(QVariantMap());
args.append(5000);
QDBusMessage result = notify.callWithArgumentList(QDBus::Block, "Notify", args);
if(result.type() == QDBusMessage::ErrorMessage) {
ERR_DP << "Failed to send a KDE notification with DBus: " << result.errorMessage().toLocal8Bit().data() << '\n';
}
#endif
#ifdef HAVE_GROWL
CFStringRef app_name = CFStringCreateWithCString(NULL, "Wesnoth", kCFStringEncodingUTF8);
CFStringRef cf_owner = CFStringCreateWithCString(NULL, owner.c_str(), kCFStringEncodingUTF8);