Gentoo Archives: gentoo-commits

From: "Lars Wendler (polynomial-c)" <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-irc/xchat/files: xchat-2.8.8-libnotify07.patch
Date: Sun, 30 Jan 2011 09:51:53
Message-Id: 20110130095143.4FBF820057@flycatcher.gentoo.org
1 polynomial-c 11/01/30 09:51:43
2
3 Modified: xchat-2.8.8-libnotify07.patch
4 Log:
5 Better patch for >=libnotify-0.7
6
7 (Portage version: 2.2.0_alpha19/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.2 net-irc/xchat/files/xchat-2.8.8-libnotify07.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-irc/xchat/files/xchat-2.8.8-libnotify07.patch?rev=1.2&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-irc/xchat/files/xchat-2.8.8-libnotify07.patch?rev=1.2&content-type=text/plain
14 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-irc/xchat/files/xchat-2.8.8-libnotify07.patch?r1=1.1&r2=1.2
15
16 Index: xchat-2.8.8-libnotify07.patch
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/net-irc/xchat/files/xchat-2.8.8-libnotify07.patch,v
19 retrieving revision 1.1
20 retrieving revision 1.2
21 diff -u -r1.1 -r1.2
22 --- xchat-2.8.8-libnotify07.patch 30 Jan 2011 09:32:21 -0000 1.1
23 +++ xchat-2.8.8-libnotify07.patch 30 Jan 2011 09:51:43 -0000 1.2
24 @@ -1,24 +1,51 @@
25 -diff -up xchat-2.8.8/src/fe-gtk/plugin-tray.c.libnotify07 xchat-2.8.8/src/fe-gtk/plugin-tray.c
26 ---- xchat-2.8.8/src/fe-gtk/plugin-tray.c.libnotify07 2010-11-15 17:32:15.708325783 -0500
27 -+++ xchat-2.8.8/src/fe-gtk/plugin-tray.c 2010-11-15 18:05:17.322141789 -0500
28 -@@ -125,8 +125,9 @@ static void *nn_mod = NULL;
29 - /* prototypes */
30 - static gboolean (*nn_init) (char *);
31 - static void (*nn_uninit) (void);
32 --static void *(*nn_new_with_status_icon) (const gchar *summary, const gchar *message, const gchar *icon, GtkStatusIcon *status_icon);
33 --static void *(*nn_new) (const gchar *summary, const gchar *message, const gchar *icon, GtkWidget *attach);
34 -+/* recent versions of libnotify don't take the fourth GtkWidget argument, but passing an
35 -+ * extra NULL argument will be fine */
36 -+static void *(*nn_new) (const gchar *summary, const gchar *message, const gchar *icon, gpointer dummy);
37 - static gboolean (*nn_show) (void *noti, GError **error);
38 - static void (*nn_set_timeout) (void *noti, gint timeout);
39 +Port libnotify support to 0.7
40 +
41 +* Forwards/backwards-compatible, don't need a recompile when upgrading libnotify
42 +* Haven't tested with older libnotify, but should work fine
43 +* nn_new() takes the same no. of arguments because everything except the first
44 + argument is optional, and the last argument passed is supposed to be NULL.
45 +
46 +---
47 +--- a/src/fe-gtk/plugin-tray.c
48 ++++ b/src/fe-gtk/plugin-tray.c
49 +@@ -145,6 +145,7 @@
50 + libnotify_notify_new (const char *title, const char *text, GtkStatusIcon *icon)
51 + {
52 + void *noti;
53 ++ int libnotify_version = 0;
54
55 -@@ -160,8 +161,6 @@ libnotify_notify_new (const char *title,
56 - goto bad;
57 + if (!nn_mod)
58 + {
59 +@@ -152,8 +153,13 @@
60 + if (!nn_mod)
61 + {
62 + nn_mod = g_module_open ("libnotify.so.1", G_MODULE_BIND_LAZY);
63 +- if (!nn_mod)
64 +- return FALSE;
65 ++ if (!nn_mod) {
66 ++ nn_mod = g_module_open ("libnotify.so.4", G_MODULE_BIND_LAZY);
67 ++ if (!nn_mod)
68 ++ return FALSE;
69 ++ libnotify_version = 4;
70 ++ }
71 ++ libnotify_version = 1;
72 + }
73 +
74 + if (!g_module_symbol (nn_mod, "notify_init", (gpointer)&nn_init))
75 +@@ -161,7 +167,15 @@
76 if (!g_module_symbol (nn_mod, "notify_uninit", (gpointer)&nn_uninit))
77 goto bad;
78 -- if (!g_module_symbol (nn_mod, "notify_notification_new_with_status_icon", (gpointer)&nn_new_with_status_icon))
79 + if (!g_module_symbol (nn_mod, "notify_notification_new_with_status_icon", (gpointer)&nn_new_with_status_icon))
80 - goto bad;
81 ++ if (libnotify_version == 1)
82 ++ /* We know we're using API version 1, but something is wrong */
83 ++ goto bad;
84 ++ else
85 ++ /* It's probably API version 4, aka libnotify-0.7 */
86 ++ libnotify_version = 4;
87 ++ else
88 ++ /* Only this API version has notify_notification_new_with_status_icon */
89 ++ libnotify_version = 1;
90 if (!g_module_symbol (nn_mod, "notify_notification_new", (gpointer)&nn_new))
91 goto bad;
92 if (!g_module_symbol (nn_mod, "notify_notification_show", (gpointer)&nn_show))