From 77aa984d1b67e06cf757510c80da2e3e51fc9ec1 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Wed, 9 Jan 2008 15:10:48 +0000 Subject: ** Fix for bug #492702 2008-01-09 Srinivasa Ragavan ** Fix for bug #492702 * configure.in: Just disable the dbus message part of mail notification if dbus isn't there. Also remove new-mail-notify plugin. svn path=/trunk/; revision=34784 --- ChangeLog | 7 + configure.in | 44 +++--- plugins/mail-notification/ChangeLog | 10 ++ plugins/mail-notification/Makefile.am | 18 ++- plugins/mail-notification/mail-notification.c | 22 ++- plugins/new-mail-notify/ChangeLog | 149 ------------------ plugins/new-mail-notify/Makefile.am | 23 --- plugins/new-mail-notify/new-mail-notify.c | 170 --------------------- .../org-gnome-new-mail-notify.eplug.xml | 24 --- po/ChangeLog | 4 + po/POTFILES.in | 2 - 11 files changed, 74 insertions(+), 399 deletions(-) delete mode 100644 plugins/new-mail-notify/ChangeLog delete mode 100644 plugins/new-mail-notify/Makefile.am delete mode 100644 plugins/new-mail-notify/new-mail-notify.c delete mode 100644 plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.xml diff --git a/ChangeLog b/ChangeLog index 69a2a66724..158dd1af73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-01-09 Srinivasa Ragavan + + ** Fix for bug #492702 + + * configure.in: Just disable the dbus message part of mail + notification if dbus isn't there. Also remove new-mail-notify plugin. + 2008-01-06 Michael Monreal ** Fix for bug #492188 diff --git a/configure.in b/configure.in index 5dd76d9ebb..d5275b4076 100644 --- a/configure.in +++ b/configure.in @@ -1697,11 +1697,11 @@ plugins_base_always="calendar-file calendar-http calendar-weather itip-formatter plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN" all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono" -plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task mark-calendar-offline audio-inline mailing-list-actions new-mail-notify default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face" +plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task mark-calendar-offline audio-inline mailing-list-actions default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face backup-restore" plugins_standard="$plugins_standard_always" all_plugins_standard="$plugins_standard" -plugins_experimental_always="backup-restore folder-unsubscribe mail-to-meeting save-attachments external-editor" +plugins_experimental_always="folder-unsubscribe mail-to-meeting save-attachments external-editor" plugins_experimental="$plugins_experimental_always $IPOD_SYNC $TNEF_ATTACHMENTS" all_plugins_experimental="$plugins_experimental_always ipod-sync tnef-attachments" @@ -1767,24 +1767,27 @@ then fi fi -if echo ${plugins_enabled} | grep "new-mail-notify" > /dev/null ; then - if ${PKG_CONFIG} --exists dbus-glib-1 ; then - dnl ************************************************** - dnl * New Mail Notify plugin - dnl ************************************************** - 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." - fi +if ${PKG_CONFIG} --exists dbus-glib-1 ; then + dnl ************************************************** + dnl * Mail Notification plugin's DBus messages + dnl ************************************************** + 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) + AC_DEFINE(HAVE_DBUS,1,[Define if you have DBUS support]) + AC_SUBST(HAVE_DBUS) + AM_CONDITIONAL(ENABLE_DBUS, true) + +else + echo "warning: dbus-glib-1 was not found, Mail notification plugins's dbus message support not built" + AM_CONDITIONAL(ENABLE_DBUS, false) + fi if echo ${plugins_enabled} | grep "exchange-operations" > /dev/null ; then @@ -1964,7 +1967,6 @@ plugins/mail-notification/Makefile plugins/mail-to-meeting/Makefile plugins/mail-to-task/Makefile plugins/mono/Makefile -plugins/new-mail-notify/Makefile plugins/subject-thread/Makefile plugins/save-attachments/Makefile plugins/save-calendar/Makefile diff --git a/plugins/mail-notification/ChangeLog b/plugins/mail-notification/ChangeLog index 6769229333..cbab0377ab 100644 --- a/plugins/mail-notification/ChangeLog +++ b/plugins/mail-notification/ChangeLog @@ -1,3 +1,13 @@ +2008-01-09 Srinivasa Ragavan + + ** Fix for bug #492702 + + * Makefile.am: + * mail-notification.c: (org_gnome_mail_new_notify), + (org_gnome_mail_read_notify), (e_plugin_lib_enable), + (e_plugin_lib_get_configure_widget): Make the dbus portion of the + plugin conditional if it is there. + 2008-01-02 Srinivasa Ragavan * mail-notification.c: (new_notify_status): Show the actual displayed diff --git a/plugins/mail-notification/Makefile.am b/plugins/mail-notification/Makefile.am index 8b93fe3e3c..38b4f051f7 100644 --- a/plugins/mail-notification/Makefile.am +++ b/plugins/mail-notification/Makefile.am @@ -1,10 +1,13 @@ INCLUDES = \ -I$(top_srcdir) \ - -DDBUS_API_SUBJECT_TO_CHANGE=1 \ - -DDBUS_VERSION=$(DBUS_VERSION) \ $(EVOLUTION_MAIL_CFLAGS) \ - $(LIBNOTIFY_CFLAGS) \ - $(NMN_CFLAGS) + $(LIBNOTIFY_CFLAGS) + +if ENABLE_DBUS +INCLUDES += -DDBUS_API_SUBJECT_TO_CHANGE=1 \ + -DDBUS_VERSION=$(DBUS_VERSION) \ + $(NMN_CFLAGS) +endif @EVO_PLUGIN_RULE@ @@ -14,8 +17,11 @@ plugin_LTLIBRARIES = liborg-gnome-mail-notification.la liborg_gnome_mail_notification_la_SOURCES = mail-notification.c liborg_gnome_mail_notification_la_LDFLAGS = \ -module -avoid-version \ - $(LIBNOTIFY_LIBS) \ - $(NMN_LIBS) + $(LIBNOTIFY_LIBS) + +if ENABLE_DBUS +liborg_gnome_mail_notification_la_LDFLAGS += $(NMN_LIBS) +endif schemadir = $(GCONF_SCHEMA_FILE_DIR) schema_in_files = apps-evolution-mail-notification.schemas.in diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index 6ad9b7f20b..c2b1f59410 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -29,8 +29,12 @@ #include #include #include + +#ifdef HAVE_DBUS #include #include +#endif + #include #include "e-util/e-config.h" @@ -111,6 +115,8 @@ set_part_enabled (const gchar *gconf_key, gboolean enable) /* DBUS part */ /* ------------------------------------------------------------------- */ +#ifdef HAVE_DBUS + #define DBUS_PATH "/org/gnome/evolution/mail/newmail" #define DBUS_INTERFACE "org.gnome.evolution.mail.dbus.Signal" @@ -254,6 +260,8 @@ get_config_widget_dbus (void) return w; } +#endif + /* ------------------------------------------------------------------- */ /* Notification area part */ /* ------------------------------------------------------------------- */ @@ -700,9 +708,10 @@ org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t) g_static_mutex_lock (&mlock); +#ifdef HAVE_DBUS if (is_part_enabled (GCONF_KEY_ENABLED_DBUS)) new_notify_dbus (t); - +#endif if (is_part_enabled (GCONF_KEY_ENABLED_STATUS)) new_notify_status (t); @@ -722,9 +731,10 @@ org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t) g_static_mutex_lock (&mlock); +#ifdef HAVE_DBUS if (is_part_enabled (GCONF_KEY_ENABLED_DBUS)) read_notify_dbus (t); - +#endif if (is_part_enabled (GCONF_KEY_ENABLED_STATUS)) read_notify_status (t); @@ -738,9 +748,10 @@ int e_plugin_lib_enable (EPluginLib *ep, int enable) { if (enable) { +#ifdef HAVE_DBUS if (is_part_enabled (GCONF_KEY_ENABLED_DBUS)) enable_dbus (enable); - +#endif if (is_part_enabled (GCONF_KEY_ENABLED_STATUS)) enable_status (enable); @@ -749,7 +760,9 @@ e_plugin_lib_enable (EPluginLib *ep, int enable) enabled = TRUE; } else { +#ifdef HAVE_DBUS enable_dbus (enable); +#endif enable_status (enable); enable_sound (enable); @@ -772,10 +785,11 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) gtk_widget_show (check); gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); +#ifdef HAVE_DBUS cfg = get_config_widget_dbus (); if (cfg) gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0); - +#endif cfg = get_config_widget_status (); if (cfg) gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0); diff --git a/plugins/new-mail-notify/ChangeLog b/plugins/new-mail-notify/ChangeLog deleted file mode 100644 index b58264d28c..0000000000 --- a/plugins/new-mail-notify/ChangeLog +++ /dev/null @@ -1,149 +0,0 @@ -2007-11-11 Gilles Dartiguelongue - - ** Fix bug #487318 - - * org-gnome-new-mail-notify.eplug.xml: - Fix typo in D-Bus - -2007-09-27 Matthew Barnes - - * org-gnome-new-mail-notify.eplug.xml: - Use consistent terminology for mail messages (#480621). - -2007-05-14 Srinivasa Ragavan - - ** Fix for bug #414195 from Loïc Minier - - * Makefile.am: - -2007-05-14 Hiroyuki Ikezoe - - ** Fixes bug #324982 - - * org-gnome-new-mail-notify.eplug.xml: Removed needless section. - - -2007-05-03 Srinivasa Ragavan - - * new-mail-notify.c (send_dbus_message), - (org_gnome_message_reading_notify), (org_gnome_new_mail_notify): Send - the number of new mails via the dbus message. - -2007-04-02 Sankar P - - * Committed on behalf of Gilles Dartiguelongue - - * org-gnome-new-mail-notify.eplug.xml: - Cleanup. - Fixes part of #301149 - -2006-08-21 Srinivasa Ragavan - - ** Fix for bug #308271 Patch by Johannes Berg - - * new-mail-notify.c: (send_dbus_message), - (org_gnome_message_reading_notify), (org_gnome_new_mail_notify): Send - the folder name also in the message. - -2006-04-18 Jeffrey Stedfast - - * new-mail-notify.c (org_gnome_message_reading_notify): Don't try - and send a dbus message if the bus is down. - (org_gnome_new_mail_notify): Same. - (init_dbus): New function to init the dbus connection and setup - handlers for when the bus gets unexpectedly disconnected. - (e_plugin_lib_enable): When the plugin gets disabled, unref the - dbus connection and reset it back to NULL. - -2005-08-23 Not Zed - - * new-mail-notify.c: forward-define e_plugin_lib_enable, remove - some unecessary headers. - (send_dbus_message): remove spurious check for bus==NULL. - -2005-07-11 Vivek Jain - - * new-mail-notify.c (send_dbus_message): check whether memory - could be allocated. Return if the message is NULL so that we don't - unref it again, will save crash. **Fixes #274329 sort of bugs, in - case reported even after david's fix. - -2005-05-11 Not Zed - - * Makefile.am: added built_sources/cleanfiles - -2005-05-06 Not Zed - - * new-mail-notify.c: make the bus connection global and keep track - of the gconf state directly too. - (org_gnome_new_mail_config): removed configuration section, - implicitly enabled by enabling the plugin now. - -2005-04-06 Timo Hoenig - - * new-mail-notify.c (send_dbus_message): added two checks to prevent - Evolution to crash if the D-BUS session bus is not running or if - D-BUS is not able to allocate memory for the message - * new-mail-notify.c (e_plugin_lib_enable): refuse to load the plugin - if the address of the D-BUS session bus can not be determined - * new-mail-notify.c (e_plugin_lib_enable): new function - -2005-05-06 Not Zed - - * Makefile.am: - * org-gnome-new-mail-notify.eplug.xml: s/.in/.xml/ & i18n. - -2005-03-11 David Malcolm - - * 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örn Torkelsson - - * org-gnome-new-mail-notify.eplug.in: Added id for mail preferences. - -2005-01-13 Not Zed - - * new-mail-notify.c: added prototypes for exported functions, - re-arranged slightly to staticise internal functions. - - * new-mail-notify.h: removed. - -2005-01-12 Miguel Angel Lopez Hernandez - - * new-mail-notify.[ch]: Fix author's name, changes in code - to maintain coding style - (org_gnome_new_mail_notify): Now sends the dbus message using - the send_dbus_message function - (org_gnome_message_reading_notify): Added function, called when - a message.reading event is fired - (send_dbus_message): Added function, generic function to send - dbus messages - - * org-gnome-new-mail-notify.eplug.in: define the message reading - event - -2005-01-11 JP Rosevear - - * Makefile.am: add new-mail-notify.h so it gets disted - -2005-01-11 Not Zed - - * new-mail-notify.c (org_gnome_new_mail_config) - (org_gnome_new_mail_notify): renamed slightly for - namespace/consistency. - (org_gnome_new_mail_notify): fixed signature. - (org_gnome_new_mail_notify): fixed some warnings & formatting. - -2004-12-30 Miguel Angel Lopez Hernandez - - * new-mail-notify.[ch]: Plugin implementation - - * org-gnome-new-mail-notify.eplug.in: define the - new mail notify plugin - - * Makefile.am: build the new mail notify plugin - diff --git a/plugins/new-mail-notify/Makefile.am b/plugins/new-mail-notify/Makefile.am deleted file mode 100644 index abce10f27e..0000000000 --- a/plugins/new-mail-notify/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -INCLUDES = \ - -I$(top_builddir)/composer \ - -I$(top_srcdir) \ - -DDBUS_API_SUBJECT_TO_CHANGE=1 \ - -DDBUS_VERSION=$(DBUS_VERSION) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(NMN_CFLAGS) - -LIBS = \ - $(NMN_LIBS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-new-mail-notify.eplug -plugin_LTLIBRARIES = liborg-gnome-new-mail-notify.la - -liborg_gnome_new_mail_notify_la_SOURCES = new-mail-notify.c -liborg_gnome_new_mail_notify_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-new-mail-notify.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/new-mail-notify/new-mail-notify.c b/plugins/new-mail-notify/new-mail-notify.c deleted file mode 100644 index 139838b64a..0000000000 --- a/plugins/new-mail-notify/new-mail-notify.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Author: Miguel Angel Lopez Hernandez - * - * Copyright 2004 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DBUS_PATH "/org/gnome/evolution/mail/newmail" -#define DBUS_INTERFACE "org.gnome.evolution.mail.dbus.Signal" - -int e_plugin_lib_enable (EPluginLib *ep, int enable); -void org_gnome_new_mail_notify (EPlugin *ep, EMEventTargetFolder *t); -void org_gnome_message_reading_notify (EPlugin *ep, EMEventTargetMessage *t); - -static gboolean init_dbus (void); - -static DBusConnection *bus = NULL; -static gboolean enabled = FALSE; - -static void -send_dbus_message (const char *name, const char *data, guint new) -{ - DBusMessage *message; - - /* Create a new message on the DBUS_INTERFACE */ - if (!(message = dbus_message_new_signal (DBUS_PATH, DBUS_INTERFACE, name))) - return; - - /* 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); - - if (new) { - char * display_name = em_utils_folder_name_from_uri(data); - dbus_message_append_args (message, -#if DBUS_VERSION >= 310 - DBUS_TYPE_STRING, &display_name, DBUS_TYPE_UINT32, &new, -#else - DBUS_TYPE_STRING, display_name, DBUS_TYPE_UINT32, new, -#endif - DBUS_TYPE_INVALID); - - } - - /* Sends the message */ - dbus_connection_send (bus, message, NULL); - - /* Frees the message */ - dbus_message_unref (message); -} - -void -org_gnome_message_reading_notify (EPlugin *ep, EMEventTargetMessage *t) -{ - if (bus != NULL) - send_dbus_message ("MessageReading", t->folder->name, 0); -} - -void -org_gnome_new_mail_notify (EPlugin *ep, EMEventTargetFolder *t) -{ - if (bus != NULL) - send_dbus_message ("Newmail", t->uri, t->new); -} - - -static gboolean -reinit_dbus (gpointer user_data) -{ - if (!enabled || init_dbus ()) - return FALSE; - - /* keep trying to re-establish dbus connection */ - - return TRUE; -} - -static DBusHandlerResult -filter_function (DBusConnection *connection, DBusMessage *message, void *user_data) -{ - if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected") && - strcmp (dbus_message_get_path (message), DBUS_PATH_LOCAL) == 0) { - dbus_connection_unref (bus); - bus = NULL; - - g_timeout_add (3000, reinit_dbus, NULL); - - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -static gboolean -init_dbus (void) -{ - DBusError error; - - if (bus != NULL) - return TRUE; - - dbus_error_init (&error); - if (!(bus = dbus_bus_get (DBUS_BUS_SESSION, &error))) { - g_warning ("could not get system bus: %s\n", error.message); - dbus_error_free (&error); - return FALSE; - } - - dbus_connection_setup_with_g_main (bus, NULL); - dbus_connection_set_exit_on_disconnect (bus, FALSE); - - dbus_connection_add_filter (bus, filter_function, NULL, NULL); - - return TRUE; -} - - -int -e_plugin_lib_enable (EPluginLib *ep, int enable) -{ - if (enable) { - if (!init_dbus ()) - return -1; - - enabled = TRUE; - } else { - if (bus != NULL) { - dbus_connection_unref (bus); - bus = NULL; - } - - enabled = FALSE; - } - - return 0; -} - diff --git a/plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.xml b/plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.xml deleted file mode 100644 index aabf503366..0000000000 --- a/plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - <_description>Generates a D-Bus message when new mail messages arrive. - - - - - - - - - - - diff --git a/po/ChangeLog b/po/ChangeLog index 5850da03c6..cca990ab7c 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2008-01-09 Srinivasa Ragavan + + * POTFILES.in: Remove new-mail-notify's files. + 2008-01-09 Jorge Gonzalez * es.po: Updated Spanish translation. diff --git a/po/POTFILES.in b/po/POTFILES.in index 91dd6a78f9..ecacdf50a7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -373,8 +373,6 @@ plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml plugins/mark-calendar-offline/org-gnome-mark-calendar-offline.eplug.xml plugins/mono/org-gnome-evolution-mono.eplug.xml -plugins/new-mail-notify/new-mail-notify.c -plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.xml plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml plugins/plugin-manager/org-gnome-plugin-manager.xml plugins/plugin-manager/plugin-manager.c -- cgit v1.2.3