rpms/libnotify/devel 0001-Don-t-link-against-a-particular-version-of-GTK.patch, NONE, 1.1 .cvsignore, 1.10, 1.11 libnotify.spec, 1.41, 1.42 sources, 1.11, 1.12 nondefault-actions.patch, 1.1, NONE

Bastien Nocera hadess at fedoraproject.org
Mon Jun 28 22:25:51 UTC 2010


Author: hadess

Update of /cvs/pkgs/rpms/libnotify/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv20861

Modified Files:
	.cvsignore libnotify.spec sources 
Added Files:
	0001-Don-t-link-against-a-particular-version-of-GTK.patch 
Removed Files:
	nondefault-actions.patch 
Log Message:
* Mon Jun 28 2010 Bastien Nocera <bnocera at redhat.com> 0.5.0-1
- Update to 0.5.0


0001-Don-t-link-against-a-particular-version-of-GTK.patch:
 configure.ac          |   17 ++++++++--
 libnotify.pc.in       |    2 -
 libnotify/Makefile.am |    2 -
 libnotify/notify.c    |   43 +++++++++++++++++++++++++++
 tests/Makefile.am     |   11 ++++---
 tests/test-gtk3.c     |   78 +++++++++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 143 insertions(+), 10 deletions(-)

--- NEW FILE 0001-Don-t-link-against-a-particular-version-of-GTK.patch ---
>From a2c9b75478e9c76efac3e448abf388d7b31f18de Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess at hadess.net>
Date: Thu, 24 Jun 2010 01:26:34 +0100
Subject: [PATCH] Don't link against a particular version of GTK+

Instead, open ourselves through GModule, and check whether
we have all the GTK+ and GDK functions required for us to
work correctly.

This means that the front-end application cannot rely on
libnotify linking against GTK+, which would only be a problem
for edge-cases.

https://bugzilla.gnome.org/show_bug.cgi?id=622550
---
 configure.ac          |   17 +++++++++--
 libnotify.pc.in       |    2 +-
 libnotify/Makefile.am |    2 +-
 libnotify/notify.c    |   43 +++++++++++++++++++++++++++
 tests/Makefile.am     |   11 ++++--
 tests/test-gtk3.c     |   77 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 143 insertions(+), 9 deletions(-)
 create mode 100644 tests/test-gtk3.c

diff --git a/configure.ac b/configure.ac
index b92ca03..0137b95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,11 +86,22 @@ AM_PROG_LIBTOOL
 REQ_DBUS_VERSION=0.76
 REQ_GTK_VERSION=2.18
 REQ_GLIB_VERSION=2.6
-pkg_modules="gtk+-2.0 >= $REQ_GTK_VERSION, glib-2.0 >= $REQ_GLIB_VERSION, dbus-1 >= $REQ_DBUS_VERSION, dbus-glib-1 >= $REQ_DBUS_VERSION"
-AC_SUBST(pkg_modules)
+
+pkg_modules="gtk+-2.0 >= $REQ_GTK_VERSION, glib-2.0 >= $REQ_GLIB_VERSION, dbus-1 >= $REQ_DBUS_VERSION, dbus-glib-1 >= $REQ_DBUS_VERSION gmodule-2.0"
 PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
-AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(PACKAGE_LIBS)
+AC_SUBST(PACKAGE_CFLAGS)
+
+dnl The libraries against which we'll actually link
+link_modules="glib-2.0 >= $REQ_GLIB_VERSION, dbus-1 >= $REQ_DBUS_VERSION, dbus-glib-1 >= $REQ_DBUS_VERSION, gmodule-2.0"
+AC_SUBST(link_modules)
+PKG_CHECK_MODULES(LINKS, [$link_modules])
+AC_SUBST(LINKS_LIBS)
+
+dnl The libraries to compile the gtk3 test against
+PKG_CHECK_MODULES(GTK3, gtk+-3.0)
+AC_SUBST(GTK3_CFLAGS)
+AC_SUBST(GTK3_LIBS)
 
 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
 AC_SUBST(GLIB_GENMARSHAL)
diff --git a/libnotify.pc.in b/libnotify.pc.in
index b586d74..becce91 100644
--- a/libnotify.pc.in
+++ b/libnotify.pc.in
@@ -6,7 +6,7 @@ includedir=@includedir@
 Name: libnotify
 Description: Notifications Library
 Version: @VERSION@
-Requires: @pkg_modules@
+Requires: @link_modules@
 Libs: -L${libdir} -lnotify
 Cflags: -I${includedir}
 
diff --git a/libnotify/Makefile.am b/libnotify/Makefile.am
index ca6891c..65e54c4 100644
--- a/libnotify/Makefile.am
+++ b/libnotify/Makefile.am
@@ -31,7 +31,7 @@ libnotify_la_SOURCES = \
 	notify-marshal.c
 
 libnotify_la_LIBADD = \
-	$(PACKAGE_LIBS)
+	$(LINKS_LIBS)
 
 libnotify_la_LDFLAGS = \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
diff --git a/libnotify/notify.c b/libnotify/notify.c
index eaa0205..a24a5fd 100644
--- a/libnotify/notify.c
+++ b/libnotify/notify.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <unistd.h>
+#include <gmodule.h>
 
 #include "notify.h"
 #include "internal.h"
@@ -39,6 +40,25 @@ static GList           *_active_notifications = NULL;
 static int              _spec_version_major = 0;
 static int              _spec_version_minor = 0;
 
+/* For the GTK+ and gdk-pixbuf functions */
+static GModule *module = NULL;
+static struct GtkDlMapping {
+        const char *function_name;
+        gpointer function_ptr;
+} gtk_dl_mapping [] = {
+#define MAP(a) { #a, (gpointer *)&a }
+        MAP(gdk_screen_make_display_name),
+        MAP(gdk_window_get_origin),
+        MAP(gtk_status_icon_get_geometry),
+        MAP(gtk_status_icon_get_x11_window_id),
+        MAP(gtk_widget_get_allocation),
+        MAP(gtk_widget_get_has_window),
+        MAP(gtk_widget_get_screen),
+        MAP(gtk_widget_get_window)
+#undef MAP
+};
+
+
 gboolean
 _notify_check_spec_version (int major,
                             int minor)
@@ -80,16 +100,39 @@ _notify_update_spec_version (void)
 gboolean
 notify_init (const char *app_name)
 {
+        guint i;
+
         g_return_val_if_fail (app_name != NULL, FALSE);
         g_return_val_if_fail (*app_name != '\0', FALSE);
 
         if (_initted)
                 return TRUE;
 
+        g_free (_app_name);
         _app_name = g_strdup (app_name);
 
         g_type_init ();
 
+        /* Look up the symbols for the GTK+ and GDK
+         * functions we use */
+        module = g_module_open (NULL, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+        if (module == NULL) {
+                g_warning ("Failed to get our own symbols: '%s'",
+                           g_module_error ());
+                return FALSE;
+        }
+        for (i = 0; i < G_N_ELEMENTS (gtk_dl_mapping); i++) {
+                if (!g_module_symbol (module,
+                                      gtk_dl_mapping[i].function_name,
+                                      &gtk_dl_mapping[i].function_ptr)) {
+                        g_warning ("Missing symbol '%s'",
+                                   gtk_dl_mapping[i].function_name);
+                        g_module_close (module);
+                        module = NULL;
+                        return FALSE;
+                }
+        }
+
         _initted = TRUE;
 
         return TRUE;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e80e79d..087fb58 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,12 +13,12 @@ noinst_PROGRAMS = \
 	test-urgency \
 	test-xy \
 	test-xy-actions \
-	test-xy-stress
+	test-xy-stress \
+	test-gtk3
 
 common_ldflags = \
 	$(top_builddir)/libnotify/libnotify.la \
-	$(PACKAGE_LIBS) \
-	$(GDK_LIBS)
+	$(PACKAGE_LIBS)
 
 test_replace_SOURCES = test-replace.c
 test_replace_LDADD  = $(common_ldflags)
@@ -65,10 +65,13 @@ test_xy_stress_LDADD = $(common_ldflags)
 test_rtl_SOURCES = test-rtl.c
 test_rtl_LDADD = $(common_ldflags)
 
+test_gtk3_SOURCES = test-gtk3.c
+test_gtk3_LDADD = $(top_builddir)/libnotify/libnotify.la $(GTK3_LIBS)
+
 EXTRA_DIST = applet-critical.png
 
 INCLUDES = $(PACKAGE_CFLAGS)	\
-	$(GDK_CFLAGS)		\
+	$(GTK3_CFLAGS)		\
 	-I$(top_srcdir)
 
 -include $(top_srcdir)/git.mk
diff --git a/tests/test-gtk3.c b/tests/test-gtk3.c
new file mode 100644
index 0000000..8127b9c
--- /dev/null
+++ b/tests/test-gtk3.c
@@ -0,0 +1,77 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * @file tests/test-gtk3.c Unit test: gtk3 symbols
+ *
+ * @Copyright (C) 2004 Mike Hearn <mike at navi.cx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA  02111-1307, USA.
+ */
+
+#include <libnotify/notify.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main ()
+{
+        NotifyNotification *n;
+
+        notify_init ("Basics");
+
+        /* Long summary */
+        n = notify_notification_new ("Summary that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
+                                     "Content",
+                                     NULL,
+                                     NULL);
+        notify_notification_set_timeout (n, 3000);      //3 seconds
+
+        if (!notify_notification_show (n, NULL)) {
+                fprintf (stderr, "failed to send notification\n");
+                return 1;
+        }
+
+        g_object_unref (G_OBJECT (n));
+
+        /* Long message */
+        n = notify_notification_new ("Summary",
+                                     "Content that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
+                                     NULL,
+                                     NULL);
+        notify_notification_set_timeout (n, 3000);      //3 seconds
+
+        if (!notify_notification_show (n, NULL)) {
+                fprintf (stderr, "failed to send notification\n");
+                return 1;
+        }
+
+        g_object_unref (G_OBJECT (n));
+
+        /* Summary only */
+        n = notify_notification_new ("Summary only there is no message content",
+                                     NULL,
+                                     NULL,
+                                     NULL);
+        notify_notification_set_timeout (n, 3000);      //3 seconds
+
+        if (!notify_notification_show (n, NULL)) {
+                fprintf (stderr, "failed to send notification\n");
+                return 1;
+        }
+
+        g_object_unref (G_OBJECT (n));
+
+        return 0;
+}
-- 
1.7.0.1



Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/libnotify/devel/.cvsignore,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- .cvsignore	23 Nov 2008 02:14:02 -0000	1.10
+++ .cvsignore	28 Jun 2010 22:25:50 -0000	1.11
@@ -1 +1 @@
-libnotify-0.4.5.tar.bz2
+libnotify-0.5.0.tar.bz2


Index: libnotify.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libnotify/devel/libnotify.spec,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- libnotify.spec	12 Nov 2009 02:15:09 -0000	1.41
+++ libnotify.spec	28 Jun 2010 22:25:51 -0000	1.42
@@ -7,23 +7,24 @@
 
 Summary: Desktop notification library 
 Name: libnotify 
-Version: 0.4.5
-Release: 4%{?dist}
+Version: 0.5.0
+Release: 1%{?dist}
 URL: http://www.galago-project.org/specs/notification/ 
 Source0: http://www.galago-project.org/files/releases/source/%{name}/%{name}-%{version}.tar.bz2 
 License: LGPLv2+
 Group: System Environment/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
-BuildPreReq: libtool
+BuildRequires: libtool
 BuildRequires: glib2-devel >= %{glib2_version} 
 BuildRequires: dbus-devel >= %{dbus_version} 
 BuildRequires: dbus-glib-devel >= %{dbus_glib_version}
 BuildRequires: gtk2-devel >= %{gtk2_version}
+BuildRequires: gtk3-devel
 Requires: glib2 >= %{glib2_version}
 Requires: desktop-notification-daemon
 
-# http://trac.galago-project.org/ticket/194
-Patch0: nondefault-actions.patch
+BuildRequires: automake autoconf libtool
+Patch0: 0001-Don-t-link-against-a-particular-version-of-GTK.patch
 
 %description
 libnotify is a library for sending desktop notifications to a notification 
@@ -47,10 +48,10 @@ development of programs using %{name}.
 
 %prep
 %setup -q
-%patch0 -p1 -b .nondefault-actions
+%patch0 -p1 -b .gtk3
 
 %build
-
+autoreconf -f
 %configure
 make
 
@@ -88,6 +89,9 @@ rm -rf $RPM_BUILD_ROOT 
 %{_datadir}/gtk-doc/html/libnotify/*
 
 %changelog
+* Mon Jun 28 2010 Bastien Nocera <bnocera at redhat.com> 0.5.0-1
+- Update to 0.5.0
+
 * Wed Nov 11 2009 Matthias Clasen <mclasen at redhat.com> - 0.4.5-4
 - Close notifications with non-default actions on uninit
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/libnotify/devel/sources,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -r1.11 -r1.12
--- sources	23 Nov 2008 02:14:02 -0000	1.11
+++ sources	28 Jun 2010 22:25:51 -0000	1.12
@@ -1 +1 @@
-6a8388f93309dbe336bbe5fc0677de6b  libnotify-0.4.5.tar.bz2
+9aa027e78d3c0141600c659f02740100  libnotify-0.5.0.tar.bz2


--- nondefault-actions.patch DELETED ---



More information about the scm-commits mailing list