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
This commit is contained in:

committed by
Jeffrey Stedfast

parent
6fe06db13a
commit
b265717d39
@ -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>
|
2001-12-17 Jon Trowbridge <trow@ximian.com>
|
||||||
|
|
||||||
* mail-format.c (handle_text_plain_flowed): Set citation color to
|
* mail-format.c (handle_text_plain_flowed): Set citation color to
|
||||||
|
@ -682,6 +682,31 @@ images_radio_toggled (GtkWidget *radio, gpointer data)
|
|||||||
mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER);
|
mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
empty_trash_toggled (GtkWidget *toggle, gpointer data)
|
empty_trash_toggled (GtkWidget *toggle, gpointer data)
|
||||||
{
|
{
|
||||||
@ -782,7 +807,7 @@ static void
|
|||||||
construct (MailAccountsDialog *dialog)
|
construct (MailAccountsDialog *dialog)
|
||||||
{
|
{
|
||||||
GladeXML *gui;
|
GladeXML *gui;
|
||||||
GtkWidget *notebook, *menu;
|
GtkWidget *notebook, *menu, *entry;
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
|
gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
|
||||||
@ -956,6 +981,27 @@ construct (MailAccountsDialog *dialog)
|
|||||||
gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled",
|
gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled",
|
||||||
GTK_SIGNAL_FUNC (confirm_expunge_toggled), dialog);
|
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 */
|
/* now to fill in the clists */
|
||||||
dialog->accounts_row = -1;
|
dialog->accounts_row = -1;
|
||||||
dialog->accounts = mail_config_get_accounts ();
|
dialog->accounts = mail_config_get_accounts ();
|
||||||
|
@ -93,6 +93,10 @@ struct _MailAccountsDialog {
|
|||||||
GtkToggleButton *filter_log;
|
GtkToggleButton *filter_log;
|
||||||
GnomeFileEntry *filter_log_path;
|
GnomeFileEntry *filter_log_path;
|
||||||
GtkToggleButton *confirm_expunge;
|
GtkToggleButton *confirm_expunge;
|
||||||
|
GtkToggleButton *notify_not;
|
||||||
|
GtkToggleButton *notify_beep;
|
||||||
|
GtkToggleButton *notify_exec;
|
||||||
|
GnomeFileEntry *command_line;
|
||||||
|
|
||||||
/* PGP page */
|
/* PGP page */
|
||||||
GnomeFileEntry *pgp_path;
|
GnomeFileEntry *pgp_path;
|
||||||
|
@ -107,7 +107,7 @@ typedef struct {
|
|||||||
gboolean filter_log;
|
gboolean filter_log;
|
||||||
char *filter_log_path;
|
char *filter_log_path;
|
||||||
|
|
||||||
MailConfigNewMailNotification notify;
|
MailConfigNewMailNotify notify;
|
||||||
char *notify_command;
|
char *notify_command;
|
||||||
} MailConfig;
|
} MailConfig;
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ config_read (void)
|
|||||||
/* New Mail Notification */
|
/* New Mail Notification */
|
||||||
config->notify = bonobo_config_get_long_with_default (
|
config->notify = bonobo_config_get_long_with_default (
|
||||||
config->db, "/Mail/Notify/new_mail_notification",
|
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->notify_command = bonobo_config_get_string (
|
||||||
config->db, "/Mail/Notify/new_mail_notification_command", NULL);
|
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);
|
config->default_charset = g_strdup (charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
MailConfigNewMailNotification
|
MailConfigNewMailNotify
|
||||||
mail_config_get_new_mail_notification (void)
|
mail_config_get_new_mail_notify (void)
|
||||||
{
|
{
|
||||||
return config->notify;
|
return config->notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mail_config_set_new_mail_notification (MailConfigNewMailNotification type)
|
mail_config_set_new_mail_notify (MailConfigNewMailNotify type)
|
||||||
{
|
{
|
||||||
config->notify = type;
|
config->notify = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
mail_config_get_new_mail_notification_command (void)
|
mail_config_get_new_mail_notify_command (void)
|
||||||
{
|
{
|
||||||
return config->notify_command;
|
return config->notify_command;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
g_free (config->notify_command);
|
||||||
config->notify_command = g_strdup (command);
|
config->notify_command = g_strdup (command);
|
||||||
|
@ -3125,6 +3125,124 @@ Quoted
|
|||||||
<fill>False</fill>
|
<fill>False</fill>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</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>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
|
@ -88,10 +88,10 @@ typedef enum {
|
|||||||
} MailConfigDisplayStyle;
|
} MailConfigDisplayStyle;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MAIL_CONFIG_NEW_MAIL_NOTIFICATION_NONE,
|
MAIL_CONFIG_NOTIFY_NOT,
|
||||||
MAIL_CONFIG_NEW_MAIL_NOTIFICATION_BEEP,
|
MAIL_CONFIG_NOTIFY_BEEP,
|
||||||
MAIL_CONFIG_NEW_MAIL_NOTIFICATION_COMMAND,
|
MAIL_CONFIG_NOTIFY_EXEC,
|
||||||
} MailConfigNewMailNotification;
|
} MailConfigNewMailNotify;
|
||||||
|
|
||||||
/* Identities */
|
/* Identities */
|
||||||
MailConfigIdentity *identity_copy (const MailConfigIdentity *id);
|
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);
|
MailConfigDisplayStyle mail_config_get_message_display_style (void);
|
||||||
void mail_config_set_message_display_style (MailConfigDisplayStyle style);
|
void mail_config_set_message_display_style (MailConfigDisplayStyle style);
|
||||||
|
|
||||||
MailConfigNewMailNotification mail_config_get_new_mail_notification (void);
|
MailConfigNewMailNotify mail_config_get_new_mail_notify (void);
|
||||||
void mail_config_set_new_mail_notification (MailConfigNewMailNotification type);
|
void mail_config_set_new_mail_notify (MailConfigNewMailNotify type);
|
||||||
const char *mail_config_get_new_mail_notification_command (void);
|
const char *mail_config_get_new_mail_notify_command (void);
|
||||||
void mail_config_set_new_mail_notification_command (const char *command);
|
void mail_config_set_new_mail_notify_command (const char *command);
|
||||||
|
|
||||||
const char *mail_config_get_default_charset (void);
|
const char *mail_config_get_default_charset (void);
|
||||||
void mail_config_set_default_charset (const char *charset);
|
void mail_config_set_default_charset (const char *charset);
|
||||||
|
@ -145,7 +145,7 @@ static void
|
|||||||
filter_folder_free (struct _mail_msg *mm)
|
filter_folder_free (struct _mail_msg *mm)
|
||||||
{
|
{
|
||||||
struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm;
|
struct _filter_mail_msg *m = (struct _filter_mail_msg *)mm;
|
||||||
int i;
|
int count, i;
|
||||||
|
|
||||||
if (m->source_folder)
|
if (m->source_folder)
|
||||||
camel_object_unref (CAMEL_OBJECT (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)
|
if (m->destination)
|
||||||
camel_object_unref (CAMEL_OBJECT (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)
|
if (m->driver)
|
||||||
camel_object_unref (CAMEL_OBJECT (m->driver));
|
camel_object_unref (CAMEL_OBJECT (m->driver));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user