[evolution-patches] Fix for Evolution's new-mail-notify plugin to track changes to DBus API



(cross-posted to evolution-patches and to the FreeDesktop dbus list)

Attached is a patch to Evolution that extracts the version of the DBus
API at configuration time as a preprocessor macro, and then uses it in
the new-mail-notify plugin to hack in an extra level of indirection in
the call to dbus_message_append_args if the DBus version is >=0.31

Somewhat ugly (but then Dbus doesn't yet offer an API stability
guarantee).

It multiplies the output from pkgconfig by 1000 since preprocessor
defines can't have decimal points in them - is there a saner way to do
this?

Dave Malcolm
? tmp
? mail/default/zh_CN/Makefile
? mail/default/zh_CN/Makefile.in
? plugins/addressbook-file/Makefile
? plugins/addressbook-file/Makefile.in
? plugins/addressbook-groupwise/Makefile
? plugins/addressbook-groupwise/Makefile.in
? plugins/default-source/Makefile
? plugins/default-source/Makefile.in
? plugins/exchange-account-setup/Makefile
? plugins/exchange-account-setup/Makefile.in
? plugins/groupwise-account-setup/Makefile
? plugins/groupwise-account-setup/Makefile.in
? plugins/groupwise-send-options/Makefile
? plugins/groupwise-send-options/Makefile.in
? plugins/groupwise-status-tracking/Makefile
? plugins/groupwise-status-tracking/Makefile.in
? plugins/new-mail-notify/Makefile
? plugins/new-mail-notify/Makefile.in
? plugins/new-mail-notify/org-gnome-new-mail-notify.eplug
? plugins/send-options/Makefile
? plugins/send-options/Makefile.in
? plugins/shared-folder/Makefile
? plugins/shared-folder/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1445
diff -u -p -r1.1445 ChangeLog
--- ChangeLog	1 Mar 2005 06:15:32 -0000	1.1445
+++ ChangeLog	12 Mar 2005 01:10:08 -0000
@@ -1,3 +1,8 @@
+2005-03-11  David Malcolm  <dmalcolm redhat com>
+
+	* configure.in: set up DBUS_VERSION for use in the new-mail-notify
+	plugin 
+
 2005-02-28  JP Rosevear  <jpr novell com>
 
 	* configure.in: bump version, requires
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.789
diff -u -p -r1.789 configure.in
--- configure.in	1 Mar 2005 06:17:18 -0000	1.789
+++ configure.in	12 Mar 2005 01:10:08 -0000
@@ -1393,6 +1393,12 @@ if echo ${plugins_enabled} | grep -q "ne
 		PKG_CHECK_MODULES(NMN, dbus-glib-1)
 		AC_SUBST(NMN_CFLAGS)
 		AC_SUBST(NMN_LIBS)
+
+		# Get the version of the DBus API, so we can hack around API changes until the API stabilises:
+		# multiply by 1000 to convert decimal to integer; so e.g. 0.31 become 310
+		# since preprocessor values must be integral
+		DBUS_VERSION="`$PKG_CONFIG --modversion dbus-1 | awk '{print 1000 * $1}'`"
+		AC_SUBST(DBUS_VERSION)
 	else
 		plugins_enabled=`echo $plugins_enabled | sed -e "s/new-mail-notify//g"`
 		echo "warning: dbus-glib-1 was not found, new-mail-notify plugin will not be built."
@@ -1622,7 +1628,8 @@ echo "\
 	Dot Locking:	  $msg_dot
 	File Locking:	  $msg_file
 	Plugins:	  $msg_plugins
-	Gtk-doc:	  $enable_gtk_doc"
+	Gtk-doc:	  $enable_gtk_doc
+	DBus API version  $DBUS_VERSION"
 
 if test x$enable_gtk_doc = xyes; then
 echo "
Index: plugins/new-mail-notify/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/new-mail-notify/ChangeLog,v
retrieving revision 1.5
diff -u -p -r1.5 ChangeLog
--- plugins/new-mail-notify/ChangeLog	25 Feb 2005 15:54:23 -0000	1.5
+++ plugins/new-mail-notify/ChangeLog	12 Mar 2005 01:10:08 -0000
@@ -1,3 +1,11 @@
+2005-03-11  David Malcolm  <dmalcolm redhat com>
+
+	* new-mail-notify.c: preprocessor hackery using the value of
+	DBUS_VERSION to cope with changes to the semantics of
+	dbus_message_append_args
+	
+	* Makefile.am: define the DBUS_VERSION in the preprocessor
+
 2005-02-24  Bj�Torkelsson  <torkel acc umu se>
 
 	* org-gnome-new-mail-notify.eplug.in: Added id for mail preferences.
Index: plugins/new-mail-notify/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/plugins/new-mail-notify/Makefile.am,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile.am
--- plugins/new-mail-notify/Makefile.am	13 Jan 2005 00:55:22 -0000	1.3
+++ plugins/new-mail-notify/Makefile.am	12 Mar 2005 01:10:08 -0000
@@ -1,6 +1,7 @@
 INCLUDES =						\
 	-I$(top_srcdir)					\
 	-DDBUS_API_SUBJECT_TO_CHANGE=1		\
+	-DDBUS_VERSION=$(DBUS_VERSION)          \
 	$(EVOLUTION_MAIL_CFLAGS)				\
 	$(NMN_CFLAGS)						
 
Index: plugins/new-mail-notify/new-mail-notify.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/new-mail-notify/new-mail-notify.c,v
retrieving revision 1.3
diff -u -p -r1.3 new-mail-notify.c
--- plugins/new-mail-notify/new-mail-notify.c	13 Jan 2005 00:55:22 -0000	1.3
+++ plugins/new-mail-notify/new-mail-notify.c	12 Mar 2005 01:10:08 -0000
@@ -113,7 +113,11 @@ send_dbus_message (const char *message_n
 
 		/* Appends the data as an argument to the message */
 		dbus_message_append_args (message,
+#if DBUS_VERSION >= 310
+					  DBUS_TYPE_STRING, &data,
+#else
 					  DBUS_TYPE_STRING, data,
+#endif
 					  DBUS_TYPE_INVALID);
 
 		/* Sends the message */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]