diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-12-19 07:22:36 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-12-19 07:22:36 +0800 |
commit | b265717d397e190684652329e6fd28e7ae482a0d (patch) | |
tree | 900f5162f15ef8c65be7c80a4d1cc020b15441a7 | |
parent | 6fe06db13a319b36aa16d1c41e0dadd426ea5034 (diff) | |
download | gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.tar gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.tar.gz gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.tar.bz2 gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.tar.lz gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.tar.xz gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.tar.zst gsoc2013-evolution-b265717d397e190684652329e6fd28e7ae482a0d.zip |
Setup the new-mail-notification widgets. (notify_command_changed): Update
2001-12-18 Jeffrey Stedfast <fejj@ximian.com>
* mail-accounts.c (construct): Setup the new-mail-notification
widgets.
(notify_command_changed): Update the command-line for new mail
notification.
(notify_radio_toggled): Update the new-mail-notification type.
* mail-ops.c (filter_folder_free): See if we got any new mail and
"sound the alarm" if we did.
svn path=/trunk/; revision=15168
-rw-r--r-- | mail/ChangeLog | 11 | ||||
-rw-r--r-- | mail/mail-accounts.c | 50 | ||||
-rw-r--r-- | mail/mail-accounts.h | 4 | ||||
-rw-r--r-- | mail/mail-config.c | 14 | ||||
-rw-r--r-- | mail/mail-config.glade | 118 | ||||
-rw-r--r-- | mail/mail-config.h | 16 | ||||
-rw-r--r-- | mail/mail-ops.c | 18 |
7 files changed, 213 insertions, 18 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 9a080da8ce..ece98ae751 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2001-12-18 Jeffrey Stedfast <fejj@ximian.com> + + * mail-accounts.c (construct): Setup the new-mail-notification + widgets. + (notify_command_changed): Update the command-line for new mail + notification. + (notify_radio_toggled): Update the new-mail-notification type. + + * mail-ops.c (filter_folder_free): See if we got any new mail and + "sound the alarm" if we did. + 2001-12-17 Jon Trowbridge <trow@ximian.com> * mail-format.c (handle_text_plain_flowed): Set citation color to diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c index 2b386e1b11..ea82a1b815 100644 --- a/mail/mail-accounts.c +++ b/mail/mail-accounts.c @@ -683,6 +683,31 @@ images_radio_toggled (GtkWidget *radio, gpointer data) } static void +notify_radio_toggled (GtkWidget *radio, gpointer data) +{ + MailAccountsDialog *dialog = data; + + if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio))) + return; + + if (radio == (GtkWidget *) dialog->notify_not) + mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_NOT); + 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); +} + +static void +notify_command_changed (GtkWidget *file_entry, gpointer data) +{ + char *command; + + command = gnome_file_entry_get_full_path (GNOME_FILE_ENTRY (file_entry), FALSE); + mail_config_set_new_mail_notify_command (command); +} + +static void empty_trash_toggled (GtkWidget *toggle, gpointer data) { mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle))); @@ -782,7 +807,7 @@ static void construct (MailAccountsDialog *dialog) { GladeXML *gui; - GtkWidget *notebook, *menu; + GtkWidget *notebook, *menu, *entry; int num; gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL); @@ -914,7 +939,7 @@ construct (MailAccountsDialog *dialog) gtk_toggle_button_set_active (dialog->prompt_bcc_only, mail_config_get_prompt_only_bcc ()); gtk_signal_connect (GTK_OBJECT (dialog->prompt_bcc_only), "toggled", GTK_SIGNAL_FUNC (prompt_bcc_only_toggled), dialog); - + dialog->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); gtk_toggle_button_set_active (dialog->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ()); gtk_signal_connect (GTK_OBJECT (dialog->prompt_unwanted_html), "toggled", @@ -956,6 +981,27 @@ construct (MailAccountsDialog *dialog) gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled", GTK_SIGNAL_FUNC (confirm_expunge_toggled), dialog); + dialog->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyNot")); + gtk_toggle_button_set_active (dialog->notify_not, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_NOT); + gtk_signal_connect (GTK_OBJECT (dialog->notify_not), "toggled", + GTK_SIGNAL_FUNC (notify_radio_toggled), dialog); + + dialog->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioNotifyBeep")); + gtk_toggle_button_set_active (dialog->notify_beep, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_BEEP); + 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", + GTK_SIGNAL_FUNC (notify_radio_toggled), dialog); + + dialog->command_line = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyCommandLine")); + 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 (dialog->command_line), "changed", + GTK_SIGNAL_FUNC (notify_command_changed), dialog); + /* now to fill in the clists */ dialog->accounts_row = -1; dialog->accounts = mail_config_get_accounts (); diff --git a/mail/mail-accounts.h b/mail/mail-accounts.h index f2580874d3..bb29819343 100644 --- a/mail/mail-accounts.h +++ b/mail/mail-accounts.h @@ -93,6 +93,10 @@ struct _MailAccountsDialog { GtkToggleButton *filter_log; GnomeFileEntry *filter_log_path; GtkToggleButton *confirm_expunge; + GtkToggleButton *notify_not; + GtkToggleButton *notify_beep; + GtkToggleButton *notify_exec; + GnomeFileEntry *command_line; /* PGP page */ GnomeFileEntry *pgp_path; diff --git a/mail/mail-config.c b/mail/mail-config.c index 184f4fb281..a21af27d17 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -107,7 +107,7 @@ typedef struct { gboolean filter_log; char *filter_log_path; - MailConfigNewMailNotification notify; + MailConfigNewMailNotify notify; char *notify_command; } MailConfig; @@ -614,7 +614,7 @@ config_read (void) /* New Mail Notification */ config->notify = bonobo_config_get_long_with_default ( config->db, "/Mail/Notify/new_mail_notification", - MAIL_CONFIG_NEW_MAIL_NOTIFICATION_NONE, NULL); + MAIL_CONFIG_NOTIFY_NOT, NULL); config->notify_command = bonobo_config_get_string ( config->db, "/Mail/Notify/new_mail_notification_command", NULL); @@ -1628,26 +1628,26 @@ mail_config_set_default_charset (const char *charset) config->default_charset = g_strdup (charset); } -MailConfigNewMailNotification -mail_config_get_new_mail_notification (void) +MailConfigNewMailNotify +mail_config_get_new_mail_notify (void) { return config->notify; } void -mail_config_set_new_mail_notification (MailConfigNewMailNotification type) +mail_config_set_new_mail_notify (MailConfigNewMailNotify type) { config->notify = type; } const char * -mail_config_get_new_mail_notification_command (void) +mail_config_get_new_mail_notify_command (void) { return config->notify_command; } void -mail_config_set_new_mail_notification_command (const char *command) +mail_config_set_new_mail_notify_command (const char *command) { g_free (config->notify_command); config->notify_command = g_strdup (command); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 4f53b4c583..7e1953cf01 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -3125,6 +3125,124 @@ Quoted <fill>False</fill> </child> </widget> + + <widget> + <class>GtkFrame</class> + <name>frame</name> + <label>New Mail Notification</label> + <label_xalign>0</label_xalign> + <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkVBox</class> + <name>vbox66</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkRadioButton</class> + <name>radioNotifyNot</name> + <can_focus>True</can_focus> + <label>Do not notify me when new mail arrives</label> + <active>True</active> + <draw_indicator>True</draw_indicator> + <group>new_mail_notify</group> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkRadioButton</class> + <name>radioNotifyBeep</name> + <can_focus>True</can_focus> + <label>Beep when new mail arrives</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <group>new_mail_notify</group> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkRadioButton</class> + <name>radioNotifyExec</name> + <can_focus>True</can_focus> + <label>Execute command line when new mail arrives</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <group>new_mail_notify</group> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox60</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>label54</name> + <label>Specify command:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GnomeFileEntry</class> + <name>fileNotifyExecCommand</name> + <max_saved>10</max_saved> + <directory>False</directory> + <modal>False</modal> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkEntry</class> + <child_name>GnomeEntry:entry</child_name> + <name>combo-entry3</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + </widget> + </widget> + </widget> </widget> <widget> diff --git a/mail/mail-config.h b/mail/mail-config.h index 82f863dba3..c54fef4eba 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -88,10 +88,10 @@ typedef enum { } MailConfigDisplayStyle; typedef enum { - MAIL_CONFIG_NEW_MAIL_NOTIFICATION_NONE, - MAIL_CONFIG_NEW_MAIL_NOTIFICATION_BEEP, - MAIL_CONFIG_NEW_MAIL_NOTIFICATION_COMMAND, -} MailConfigNewMailNotification; + MAIL_CONFIG_NOTIFY_NOT, + MAIL_CONFIG_NOTIFY_BEEP, + MAIL_CONFIG_NOTIFY_EXEC, +} MailConfigNewMailNotify; /* Identities */ MailConfigIdentity *identity_copy (const MailConfigIdentity *id); @@ -181,10 +181,10 @@ void mail_config_set_default_forward_style (MailConfigForwardS MailConfigDisplayStyle mail_config_get_message_display_style (void); void mail_config_set_message_display_style (MailConfigDisplayStyle style); -MailConfigNewMailNotification mail_config_get_new_mail_notification (void); -void mail_config_set_new_mail_notification (MailConfigNewMailNotification type); -const char *mail_config_get_new_mail_notification_command (void); -void mail_config_set_new_mail_notification_command (const char *command); +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_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 023d1781d1..cbccb274db 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -145,7 +145,7 @@ static void filter_folder_free (struct _mail_msg *mm) { struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm; - int i; + int count, i; if (m->source_folder) camel_object_unref (CAMEL_OBJECT (m->source_folder)); @@ -163,6 +163,22 @@ filter_folder_free (struct _mail_msg *mm) if (m->destination) camel_object_unref (CAMEL_OBJECT (m->destination)); + count = camel_filter_driver_get_filtered_count (m->driver); + camel_filter_driver_reset_filtered_count (m->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 (m->driver, mail_config_get_new_mail_notify_command (), NULL); + break; + default: + break; + } + } + if (m->driver) camel_object_unref (CAMEL_OBJECT (m->driver)); } |