aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2008-01-09 23:10:48 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2008-01-09 23:10:48 +0800
commit77aa984d1b67e06cf757510c80da2e3e51fc9ec1 (patch)
treec82df11e60eb045b207379fa5180328774ba58af /plugins
parent959b1463cb7e51bf68cfa8d8654af006ed2ffbcf (diff)
downloadgsoc2013-evolution-77aa984d1b67e06cf757510c80da2e3e51fc9ec1.tar.gz
gsoc2013-evolution-77aa984d1b67e06cf757510c80da2e3e51fc9ec1.tar.zst
gsoc2013-evolution-77aa984d1b67e06cf757510c80da2e3e51fc9ec1.zip
** Fix for bug #492702
2008-01-09 Srinivasa Ragavan <sragavan@novell.com> ** 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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mail-notification/ChangeLog10
-rw-r--r--plugins/mail-notification/Makefile.am18
-rw-r--r--plugins/mail-notification/mail-notification.c22
-rw-r--r--plugins/new-mail-notify/ChangeLog149
-rw-r--r--plugins/new-mail-notify/Makefile.am23
-rw-r--r--plugins/new-mail-notify/new-mail-notify.c170
-rw-r--r--plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.xml24
7 files changed, 40 insertions, 376 deletions
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 <sragavan@novell.com>
+
+ ** 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 <sragavan@novell.com>
* 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 <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include <libgnome/libgnome.h>
+
+#ifdef HAVE_DBUS
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#endif
+
#include <time.h>
#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 <gdartigu@svn.gnome.org>
-
- ** Fix bug #487318
-
- * org-gnome-new-mail-notify.eplug.xml:
- Fix typo in D-Bus
-
-2007-09-27 Matthew Barnes <mbarnes@redhat.com>
-
- * org-gnome-new-mail-notify.eplug.xml:
- Use consistent terminology for mail messages (#480621).
-
-2007-05-14 Srinivasa Ragavan <sragavan@novell.com>
-
- ** Fix for bug #414195 from Loïc Minier
-
- * Makefile.am:
-
-2007-05-14 Hiroyuki Ikezoe <poincare@ikezoe.net>
-
- ** Fixes bug #324982
-
- * org-gnome-new-mail-notify.eplug.xml: Removed needless section.
-
-
-2007-05-03 Srinivasa Ragavan <sragavan@novell.com>
-
- * 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 <psankar@novell.com>
-
- * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr>
-
- * org-gnome-new-mail-notify.eplug.xml:
- Cleanup.
- Fixes part of #301149
-
-2006-08-21 Srinivasa Ragavan <sragavan@novell.com>
-
- ** 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 <fejj@novell.com>
-
- * 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 <NotZed@Ximian.com>
-
- * 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 <jvivek@novell.com>
-
- * 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 <NotZed@Ximian.com>
-
- * Makefile.am: added built_sources/cleanfiles
-
-2005-05-06 Not Zed <NotZed@Ximian.com>
-
- * 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 <thoenig@novell.com>
-
- * 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 <NotZed@Ximian.com>
-
- * Makefile.am:
- * org-gnome-new-mail-notify.eplug.xml: s/.in/.xml/ & i18n.
-
-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örn Torkelsson <torkel@acc.umu.se>
-
- * org-gnome-new-mail-notify.eplug.in: Added id for mail preferences.
-
-2005-01-13 Not Zed <NotZed@Ximian.com>
-
- * 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 <miguel@gulev.org.mx>
-
- * 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 <jpr@novell.com>
-
- * Makefile.am: add new-mail-notify.h so it gets disted
-
-2005-01-11 Not Zed <NotZed@Ximian.com>
-
- * 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 <miguel@gulev.org.mx>
-
- * 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 <miguel@gulev.org.mx>
- *
- * 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 <config.h>
-#endif
-
-#include <string.h>
-#include <glib.h>
-#include <gconf/gconf-client.h>
-#include <e-util/e-config.h>
-#include <mail/em-utils.h>
-#include <mail/em-event.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <camel/camel-folder.h>
-
-#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 @@
-<e-plugin-list>
- <e-plugin
- id="org.gnome.evolution.new_mail_notify"
- type="shlib"
- _name="New Mail Notification"
- location="@PLUGINDIR@/liborg-gnome-new-mail-notify@SOEXT@">
-
- <_description>Generates a D-Bus message when new mail messages arrive.</_description>
- <author name="Miguel Angel López Hernández" email="miguel@gulev.org.mx"/>
-
- <hook class="org.gnome.evolution.mail.events:1.0">
- <event id="folder.changed"
- enable="newmail"
- handle="org_gnome_new_mail_notify"
- target="folder"/>
- </hook>
-
- <hook class="org.gnome.evolution.mail.events:1.0">
- <event id="message.reading"
- handle="org_gnome_message_reading_notify"
- target="message"/>
- </hook>
- </e-plugin>
-</e-plugin-list>