aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-01-08 08:48:54 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-01-08 08:48:54 +0800
commit1cca6b24335a9de963ced4b6127f4558ed19cf48 (patch)
tree0484e61f01c9c16cf6e87f5f0d9558ce424d09c3 /mail
parente96bfc58ca850606a7c787636bc6e787266e6598 (diff)
downloadgsoc2013-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')
-rw-r--r--mail/ChangeLog21
-rw-r--r--mail/component-factory.c2
-rw-r--r--mail/mail-accounts.c27
-rw-r--r--mail/mail-accounts.h4
-rw-r--r--mail/mail-config.c20
-rw-r--r--mail/mail-config.glade8
-rw-r--r--mail/mail-config.h6
-rw-r--r--mail/mail-ops.c20
-rw-r--r--mail/mail-session.c39
-rw-r--r--mail/main.c8
10 files changed, 102 insertions, 53 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 91c1567b8b..962845a38b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,24 @@
+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.
+
2002-01-03 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (composer_get_message): Add an Organization
diff --git a/mail/component-factory.c b/mail/component-factory.c
index f77f76fa1b..e6d04129d9 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -826,7 +826,7 @@ handle_external_uri_cb (EvolutionShellComponent *shell_component,
g_warning ("Invalid URI requested to mail component -- %s", uri);
return;
}
-
+
/* FIXME: Sigh. This shouldn't be here. But the code is messy, so
I'll just put it here anyway. */
send_to_url (uri);
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 0d3eb4bc63..f00be07739 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -695,16 +695,16 @@ notify_radio_toggled (GtkWidget *radio, gpointer data)
else if (radio == (GtkWidget *) dialog->notify_beep)
mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_BEEP);
else
- mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_EXEC);
+ mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_PLAY_SOUND);
}
static void
-notify_command_changed (GtkWidget *entry, gpointer data)
+notify_sound_file_changed (GtkWidget *entry, gpointer data)
{
- char *command;
+ char *filename;
- command = gtk_entry_get_text (GTK_ENTRY (entry));
- mail_config_set_new_mail_notify_command (command);
+ filename = gtk_entry_get_text (GTK_ENTRY (entry));
+ mail_config_set_new_mail_notify_sound_file (filename);
}
static void
@@ -991,16 +991,17 @@ construct (MailAccountsDialog *dialog)
gtk_signal_connect (GTK_OBJECT (dialog->notify_beep), "toggled",
GTK_SIGNAL_FUNC (notify_radio_toggled), dialog);
- dialog->notify_exec = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyExec"));
- gtk_toggle_button_set_active (dialog->notify_exec, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_EXEC);
- gtk_signal_connect (GTK_OBJECT (dialog->notify_exec), "toggled",
+ dialog->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyPlaySound"));
+ gtk_toggle_button_set_active (dialog->notify_play_sound,
+ mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_PLAY_SOUND);
+ gtk_signal_connect (GTK_OBJECT (dialog->notify_play_sound), "toggled",
GTK_SIGNAL_FUNC (notify_radio_toggled), dialog);
- dialog->command_line = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyExecCommandLine"));
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->command_line)),
- mail_config_get_new_mail_notify_command ());
- gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->command_line)),
- "changed", GTK_SIGNAL_FUNC (notify_command_changed), dialog);
+ dialog->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound"));
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->notify_sound_file)),
+ mail_config_get_new_mail_notify_sound_file ());
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->notify_sound_file)),
+ "changed", GTK_SIGNAL_FUNC (notify_sound_file_changed), dialog);
/* now to fill in the clists */
dialog->accounts_row = -1;
diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h
index bb29819343..83134fc6d4 100644
--- a/mail/mail-accounts.h
+++ b/mail/mail-accounts.h
@@ -95,8 +95,8 @@ struct _MailAccountsDialog {
GtkToggleButton *confirm_expunge;
GtkToggleButton *notify_not;
GtkToggleButton *notify_beep;
- GtkToggleButton *notify_exec;
- GnomeFileEntry *command_line;
+ GtkToggleButton *notify_play_sound;
+ GnomeFileEntry *notify_sound_file;
/* PGP page */
GnomeFileEntry *pgp_path;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 4151c0c3a7..d1e322bb0b 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -108,7 +108,7 @@ typedef struct {
char *filter_log_path;
MailConfigNewMailNotify notify;
- char *notify_command;
+ char *notify_filename;
} MailConfig;
static MailConfig *config = NULL;
@@ -650,8 +650,8 @@ config_read (void)
config->db, "/Mail/Notify/new_mail_notification",
MAIL_CONFIG_NOTIFY_NOT, NULL);
- config->notify_command = bonobo_config_get_string (
- config->db, "/Mail/Notify/new_mail_notification_command", NULL);
+ config->notify_filename = bonobo_config_get_string (
+ config->db, "/Mail/Notify/new_mail_notification_sound_file", NULL);
}
#define bonobo_config_set_string_wrapper(db, path, val, ev) bonobo_config_set_string (db, path, val ? val : "", ev)
@@ -954,8 +954,8 @@ mail_config_write_on_exit (void)
bonobo_config_set_long (config->db, "/Mail/Notify/new_mail_notification",
config->notify, NULL);
- bonobo_config_set_string_wrapper (config->db, "/Mail/Notify/new_mail_notification_command",
- config->notify_command, NULL);
+ bonobo_config_set_string_wrapper (config->db, "/Mail/Notify/new_mail_notification_sound_file",
+ config->notify_filename, NULL);
if (config->threaded_hash)
g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads");
@@ -1693,16 +1693,16 @@ mail_config_set_new_mail_notify (MailConfigNewMailNotify type)
}
const char *
-mail_config_get_new_mail_notify_command (void)
+mail_config_get_new_mail_notify_sound_file (void)
{
- return config->notify_command;
+ return config->notify_filename;
}
void
-mail_config_set_new_mail_notify_command (const char *command)
+mail_config_set_new_mail_notify_sound_file (const char *filename)
{
- g_free (config->notify_command);
- config->notify_command = g_strdup (command);
+ g_free (config->notify_filename);
+ config->notify_filename = g_strdup (filename);
}
gboolean
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 1991576d0a..f098c3442f 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -3317,9 +3317,9 @@ Quoted
<widget>
<class>GtkRadioButton</class>
- <name>radioNotifyExec</name>
+ <name>radioNotifyPlaySound</name>
<can_focus>True</can_focus>
- <label>Execute command line when new mail arrives</label>
+ <label>Play sound file when new mail arrives</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>new_mail_notify</group>
@@ -3344,7 +3344,7 @@ Quoted
<widget>
<class>GtkLabel</class>
<name>label54</name>
- <label>Specify command:</label>
+ <label>Specify filename:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -3360,7 +3360,7 @@ Quoted
<widget>
<class>GnomeFileEntry</class>
- <name>fileNotifyExecCommandLine</name>
+ <name>fileNotifyPlaySound</name>
<max_saved>10</max_saved>
<title>Execute Command...</title>
<directory>False</directory>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 2575f8b817..fb8082a919 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -95,7 +95,7 @@ typedef enum {
typedef enum {
MAIL_CONFIG_NOTIFY_NOT,
MAIL_CONFIG_NOTIFY_BEEP,
- MAIL_CONFIG_NOTIFY_EXEC,
+ MAIL_CONFIG_NOTIFY_PLAY_SOUND,
} MailConfigNewMailNotify;
/* Identities */
@@ -188,8 +188,8 @@ void mail_config_set_message_display_style (MailConfigDisplayS
MailConfigNewMailNotify mail_config_get_new_mail_notify (void);
void mail_config_set_new_mail_notify (MailConfigNewMailNotify type);
-const char *mail_config_get_new_mail_notify_command (void);
-void mail_config_set_new_mail_notify_command (const char *command);
+const char *mail_config_get_new_mail_notify_sound_file (void);
+void mail_config_set_new_mail_notify_sound_file (const char *filename);
const char *mail_config_get_default_charset (void);
void mail_config_set_default_charset (const char *charset);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 8a3b4076df..a8b515c832 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -120,6 +120,7 @@ filter_folder_filter (struct _mail_msg *mm)
folder_uids = uids = camel_folder_get_uids (folder);
camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &mm->ex);
+ camel_filter_driver_flush (m->driver, &mm->ex);
if (folder_uids)
camel_folder_free_uids (folder, folder_uids);
@@ -255,7 +256,7 @@ fetch_mail_fetch (struct _mail_msg *mm)
{
struct _fetch_mail_msg *m = (struct _fetch_mail_msg *)mm;
struct _filter_mail_msg *fm = (struct _filter_mail_msg *)mm;
- int count, i;
+ int i;
if (m->cancel)
camel_operation_register (m->cancel);
@@ -347,22 +348,6 @@ fetch_mail_fetch (struct _mail_msg *mm)
if (m->cancel)
camel_operation_unregister (m->cancel);
- count = camel_filter_driver_get_filtered_count (fm->driver);
- camel_filter_driver_reset_filtered_count (fm->driver);
-
- if (count > 0) {
- switch (mail_config_get_new_mail_notify ()) {
- case MAIL_CONFIG_NOTIFY_BEEP:
- gdk_beep ();
- break;
- case MAIL_CONFIG_NOTIFY_EXEC:
- mail_execute_shell_command (fm->driver, mail_config_get_new_mail_notify_command (), NULL);
- break;
- default:
- break;
- }
- }
-
/* we unref this here as it may have more work to do (syncing
folders and whatnot) before we are really done */
/* should this be cancellable too? (i.e. above unregister above) */
@@ -422,7 +407,6 @@ mail_fetch_mail (const char *source, int keep, const char *type, CamelOperation
fm->driver = camel_session_get_filter_driver (session, type, NULL);
camel_filter_driver_set_folder_func (fm->driver, get_folder, get_data);
- camel_filter_driver_set_shell_exec_func (fm->driver, mail_execute_shell_command, NULL);
if (status)
camel_filter_driver_set_status_func (fm->driver, status, status_data);
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);
diff --git a/mail/main.c b/mail/main.c
index 10497a145d..b3daea3f99 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -103,7 +103,7 @@ main (int argc, char *argv [])
gnome_init_with_popt_table ("evolution-mail-component", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
-
+
sigaction (SIGSEGV, NULL, &osa);
if (osa.sa_handler != SIG_DFL) {
sa.sa_flags = 0;
@@ -144,6 +144,8 @@ main (int argc, char *argv [])
mail_config_init ();
mail_msg_init ();
+ gnome_sound_init ("localhost");
+
component_factory_init ();
evolution_composer_factory_init (composer_send_cb,
composer_postpone_cb);
@@ -163,6 +165,8 @@ main (int argc, char *argv [])
mail_config_write_on_exit ();
e_passwords_shutdown ();
-
+
+ gnome_sound_shutdown ();
+
return 0;
}