1
From c6f46e8a757e40773f7767ec2d645032b9442569 Mon Sep 17 00:00:00 2001
2
From: =?utf-8?q?Aur=C3=A9lien=20G=C3=A2teau?= <agateau@kde.org>
3
Date: Mon, 22 Jun 2009 10:57:31 +0200
4
Subject: [PATCH] Support for image_data hint
7
libnotify/internal.h | 1 +
8
libnotify/notification.c | 4 +++-
9
libnotify/notify.c | 30 ++++++++++++++++++++++++++++++
10
3 files changed, 34 insertions(+), 1 deletions(-)
12
diff --git a/libnotify/internal.h b/libnotify/internal.h
13
index 697f64a..e0a689d 100644
14
--- a/libnotify/internal.h
15
+++ b/libnotify/internal.h
16
@@ -46,6 +46,7 @@ void _notify_cache_remove_notification(NotifyNotification *n);
17
gint _notify_notification_get_timeout(const NotifyNotification *n);
18
gboolean _notify_notification_has_nondefault_actions(
19
const NotifyNotification *n);
20
+gboolean _notify_check_spec_version(int major, int minor);
24
diff --git a/libnotify/notification.c b/libnotify/notification.c
25
index 0a5051d..9341941 100644
26
--- a/libnotify/notification.c
27
+++ b/libnotify/notification.c
28
@@ -1011,8 +1011,10 @@ notify_notification_set_icon_from_pixbuf(NotifyNotification *notification,
29
g_value_init(value, G_TYPE_VALUE_ARRAY);
30
g_value_set_boxed_take_ownership(value, image_struct);
32
+ char *hint_name = _notify_check_spec_version(0, 10)
33
+ ? "image_data" : "icon_data";
34
g_hash_table_insert(notification->priv->hints,
35
- g_strdup("icon_data"), value);
36
+ g_strdup(hint_name), value);
37
#else /* D-BUS < 0.60 */
38
g_warning("Raw images and pixbufs require D-BUS >= 0.60");
40
diff --git a/libnotify/notify.c b/libnotify/notify.c
41
index c0c7b21..7dd74d5 100644
42
--- a/libnotify/notify.c
43
+++ b/libnotify/notify.c
44
@@ -32,6 +32,30 @@ static gchar *_app_name = NULL;
45
static DBusGProxy *_proxy = NULL;
46
static DBusGConnection *_dbus_gconn = NULL;
47
static GList *_active_notifications = NULL;
48
+static int _spec_version_major = 0;
49
+static int _spec_version_minor = 0;
52
+_notify_check_spec_version(int major, int minor)
54
+ if (_spec_version_major > major)
56
+ if (_spec_version_major < major)
58
+ return _spec_version_minor >= minor;
62
+_notify_update_spec_version(void)
65
+ if (!notify_get_server_info(NULL, NULL, NULL, &spec_version))
68
+ sscanf(spec_version, "%d.%d", &_spec_version_major, &_spec_version_minor);
69
+ g_free(spec_version);
75
@@ -89,6 +113,12 @@ notify_init(const char *app_name)
76
G_TYPE_UINT, G_TYPE_STRING,
79
+ if (!_notify_update_spec_version())
81
+ g_message("Error getting spec version");