diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-01-08 08:48:54 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-01-08 08:48:54 +0800 |
commit | 1cca6b24335a9de963ced4b6127f4558ed19cf48 (patch) | |
tree | 0484e61f01c9c16cf6e87f5f0d9558ce424d09c3 /mail/mail-session.c | |
parent | e96bfc58ca850606a7c787636bc6e787266e6598 (diff) | |
download | gsoc2013-evolution-1cca6b24335a9de963ced4b6127f4558ed19cf48.tar.gz gsoc2013-evolution-1cca6b24335a9de963ced4b6127f4558ed19cf48.tar.zst gsoc2013-evolution-1cca6b24335a9de963ced4b6127f4558ed19cf48.zip |
Renamed. (mail_config_get_new_mail_notify_sound_file): Renamed.
2002-01-07 Jeffrey Stedfast <fejj@ximian.com>
* mail-config.c (mail_config_set_new_mail_notify_sound_file): Renamed.
(mail_config_get_new_mail_notify_sound_file): Renamed.
* mail-accounts.c (notify_radio_toggled): Replace EXEC with
PLAY_SOUND.
(construct): renamed the exec_command stuff to play_sound.
* main.c (main): Init and shutdown gnome_sound.
* mail-ops.c (fetch_mail_fetch): Don't do any new-mail
notification here.
(filter_folder_filter): call camel_filter_driver_flush.
* mail-session.c (main_get_filter_driver): Set the filter-driver
exec_func here instead.
* mail-ops.c (mail_fetch_mail): Don't set the filter-driver
exec_func here.
svn path=/trunk/; revision=15263
Diffstat (limited to 'mail/mail-session.c')
-rw-r--r-- | mail/mail-session.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mail/mail-session.c b/mail/mail-session.c index f8265a12ea..98d5968364 100644 --- a/mail/mail-session.c +++ b/mail/mail-session.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-config.h> +#include <libgnome/gnome-sound.h> #include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-messagebox.h> @@ -40,6 +41,7 @@ #include "mail-session.h" #include "mail-tools.h" #include "mail-mt.h" +#include "mail-ops.h" #include "e-util/e-passwords.h" #include "e-util/e-msgport.h" @@ -806,6 +808,15 @@ get_folder (CamelFilterDriver *d, const char *uri, void *data, CamelException *e return mail_tool_uri_to_folder (uri, 0, ex); } +static void +session_play_sound (CamelFilterDriver *driver, const char *filename, gpointer user_data) +{ + if (!filename || !*filename) + gdk_beep (); + else + gnome_sound_play (filename); +} + static CamelFilterDriver * main_get_filter_driver (CamelSession *session, const char *type, CamelException *ex) { @@ -838,6 +849,9 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException camel_filter_driver_set_logfile (driver, ms->filter_logfile); } + camel_filter_driver_set_shell_exec_func (driver, mail_execute_shell_command, NULL); + camel_filter_driver_set_play_sound_func (driver, session_play_sound, NULL); + fsearch = g_string_new (""); faction = g_string_new (""); @@ -852,6 +866,31 @@ main_get_filter_driver (CamelSession *session, const char *type, CamelException fsearch->str, faction->str); } + /* FIXME: we need a way to distinguish between filtering new + mail and re-filtering a folder because both use the + "incoming" filter type */ + if (mail_config_get_new_mail_notify () && !strcmp (type, "incoming")) { + g_string_truncate (faction, 0); + + g_string_append (faction, "(only-once \"new-mail-notification\" "); + + switch (mail_config_get_new_mail_notify ()) { + case MAIL_CONFIG_NOTIFY_BEEP: + g_string_append (faction, "\"(beep)\""); + break; + case MAIL_CONFIG_NOTIFY_PLAY_SOUND: + g_string_sprintfa (faction, "\"(play-sound \\\"%s\\\")\"", + mail_config_get_new_mail_notify_sound_file ()); + break; + default: + break; + } + + g_string_append (faction, ")"); + + camel_filter_driver_add_rule (driver, "new-mail-notification", "(begin #t)", faction->str); + } + g_string_free (fsearch, TRUE); g_string_free (faction, TRUE); |