diff options
author | Johnny Jacob <jjohnny@src.gnome.org> | 2007-12-15 19:59:39 +0800 |
---|---|---|
committer | Johnny Jacob <jjohnny@src.gnome.org> | 2007-12-15 19:59:39 +0800 |
commit | 6cb13b10b6c87bd6fd89454049dd9b58c1f9808c (patch) | |
tree | 7c96fa9f180a0295eea711ecef359c635143033c /mail | |
parent | 4f7d3decd1bb7f47e9d23c0514e82d002aaac752 (diff) | |
download | gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.tar gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.tar.gz gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.tar.bz2 gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.tar.lz gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.tar.xz gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.tar.zst gsoc2013-evolution-6cb13b10b6c87bd6fd89454049dd9b58c1f9808c.zip |
Part of fix for #492702 from Milan Crha : New mail notify and preferences ui movement.
svn path=/trunk/; revision=34702
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/em-mailer-prefs.c | 62 | ||||
-rw-r--r-- | mail/em-mailer-prefs.h | 6 | ||||
-rw-r--r-- | mail/em-migrate.c | 89 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in | 30 | ||||
-rw-r--r-- | mail/mail-config.glade | 235 | ||||
-rw-r--r-- | mail/mail-config.h | 6 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 67 | ||||
-rw-r--r-- | mail/mail-folder-cache.h | 3 |
9 files changed, 113 insertions, 401 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a5a9961e03..10a923c9e1 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,19 @@ +2007-12-15 Milan Crha <mcrha@redhat.com> + + ** Part of fix for bug #492702 + + * mail-config.h: + * mail-config.glade: + * evolution-mail.schemas.in: + * mail-folder-cache.h: + * mail-folder-cache.c: + * em-mailer-prefs.h: + * em-mailer-prefs.c: Moved bits of sound notification + on new messages to mail-notification plugin. + * em-migrate.c: (is_in_plugs_list), + (em_update_message_notify_settings_2_21), (em_migrate): + Migration code to move old options to new plugin options. + 2007-12-14 Sankar P <psankar@novell.com> * em-folder-tree-model.c: (emft_model_unread_count_changed), diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c index 2a4e81117d..b8c3d7fb59 100644 --- a/mail/em-mailer-prefs.c +++ b/mail/em-mailer-prefs.c @@ -702,36 +702,6 @@ http_images_changed (GtkWidget *widget, EMMailerPrefs *prefs) } -static void -notify_type_changed (GtkWidget *widget, EMMailerPrefs *prefs) -{ - int type; - - if (gtk_toggle_button_get_active (prefs->notify_not)) - type = MAIL_CONFIG_NOTIFY_NOT; - else if (gtk_toggle_button_get_active (prefs->notify_beep)) - type = MAIL_CONFIG_NOTIFY_BEEP; - else - type = MAIL_CONFIG_NOTIFY_PLAY_SOUND; - - if (type == MAIL_CONFIG_NOTIFY_PLAY_SOUND) - gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_sound_file, TRUE); - else - gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_sound_file, FALSE); - - gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/notify/type", type, NULL); -} - -static void -notify_sound_changed (GtkWidget *widget, EMMailerPrefs *prefs) -{ - const char *filename; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (prefs->notify_sound_file)); - /* When we startup the file name will be NULL*/ - gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/notify/sound", filename ? filename : "", NULL); -} - static GtkWidget * emmp_widget_glade(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data) { @@ -973,38 +943,6 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs) "/apps/evolution/mail/prompts/expunge", G_CALLBACK (toggle_button_toggled)); - /* New Mail Notification */ - locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/notify/type", NULL); - - val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/notify/type", NULL); - prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot")); - gtk_toggle_button_set_active (prefs->notify_not, val == MAIL_CONFIG_NOTIFY_NOT); - g_signal_connect (prefs->notify_not, "toggled", G_CALLBACK (notify_type_changed), prefs); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_not, FALSE); - - prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep")); - prefs->notify_sound_file = GTK_FILE_CHOOSER_BUTTON (glade_xml_get_widget (gui, "fileNotifyPlaySoundButton")); - gtk_toggle_button_set_active (prefs->notify_beep, val == MAIL_CONFIG_NOTIFY_BEEP); - g_signal_connect (prefs->notify_beep, "toggled", G_CALLBACK (notify_type_changed), prefs); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_beep, FALSE); - - prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound")); - gtk_toggle_button_set_active (prefs->notify_play_sound, val == MAIL_CONFIG_NOTIFY_PLAY_SOUND); - g_signal_connect (prefs->notify_play_sound, "toggled", G_CALLBACK (notify_type_changed), prefs); - if (locked) - gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_play_sound, FALSE); - - buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL); - if (buf && *buf) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prefs->notify_sound_file), buf); - g_signal_connect (GTK_FILE_CHOOSER_BUTTON (prefs->notify_sound_file), "selection-changed", - G_CALLBACK (notify_sound_changed), prefs); - if (val != MAIL_CONFIG_NOTIFY_PLAY_SOUND) - gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_sound_file, FALSE); - g_free (buf); - /* Mail Fonts */ font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL); prefs->font_fixed = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontFixed")); diff --git a/mail/em-mailer-prefs.h b/mail/em-mailer-prefs.h index 647da6e571..846ce151bd 100644 --- a/mail/em-mailer-prefs.h +++ b/mail/em-mailer-prefs.h @@ -87,12 +87,6 @@ struct _EMMailerPrefs { struct _GtkOptionMenu *empty_trash_days; struct _GtkToggleButton *confirm_expunge; - /* New Mail Notification */ - struct _GtkToggleButton *notify_not; - struct _GtkToggleButton *notify_beep; - struct _GtkToggleButton *notify_play_sound; - struct _GtkFileChooserButton *notify_sound_file; - /* HTML Mail tab */ struct _GtkFontButton *font_variable; struct _GtkFontButton *font_fixed; diff --git a/mail/em-migrate.c b/mail/em-migrate.c index 1c64c5e659..f038a8f640 100644 --- a/mail/em-migrate.c +++ b/mail/em-migrate.c @@ -66,6 +66,7 @@ #include "e-util/e-signature-list.h" #include "e-util/e-error.h" #include "e-util/e-util-private.h" +#include "e-util/e-plugin.h" #include "mail-config.h" #include "em-utils.h" @@ -2728,6 +2729,90 @@ emm_setup_initial(const char *evolution_dir) return 0; } +static gboolean +is_in_plugs_list (GSList *list, const gchar *value) +{ + GSList *l; + + for (l = list; l; l = l->next) { + if (l->data && !strcmp (l->data, value)) + return TRUE; + } + + return FALSE; +} + +/* + * em_update_message_notify_settings_2_21 + * DBus plugin and sound email notification was merged to mail-notification plugin, + * so move these options to new locations. + */ +static void +em_update_message_notify_settings_2_21 (void) +{ + GConfClient *client; + GConfValue *is_key; + gboolean dbus, status; + GSList *list; + gchar *str; + gint val; + + client = gconf_client_get_default (); + + is_key = gconf_client_get (client, "/apps/evolution/eplugin/mail-notification/dbus-enabled", NULL); + if (is_key) { + /* already migrated, so do not migrate again */ + gconf_value_free (is_key); + g_object_unref (client); + + return; + } + + gconf_client_set_bool (client, "/apps/evolution/eplugin/mail-notification/status-blink-icon", + gconf_client_get_bool (client, "/apps/evolution/mail/notification/blink-status-icon", NULL), NULL); + gconf_client_set_bool (client, "/apps/evolution/eplugin/mail-notification/status-notification", + gconf_client_get_bool (client, "/apps/evolution/mail/notification/notification", NULL), NULL); + + list = gconf_client_get_list (client, "/apps/evolution/eplugin/disabled", GCONF_VALUE_STRING, NULL); + dbus = !is_in_plugs_list (list, "org.gnome.evolution.new_mail_notify"); + status = !is_in_plugs_list (list, "org.gnome.evolution.mail_notification"); + + gconf_client_set_bool (client, "/apps/evolution/eplugin/mail-notification/dbus-enabled", dbus, NULL); + gconf_client_set_bool (client, "/apps/evolution/eplugin/mail-notification/status-enabled", status, NULL); + + if (!status) { + /* enable this plugin, because it holds all those other things */ + GSList *plugins, *l; + + plugins = e_plugin_list_plugins (); + + for (l = plugins; l; l = l->next) { + EPlugin *p = l->data; + + if (p && p->id && !strcmp (p->id, "org.gnome.evolution.mail_notification")) { + e_plugin_enable (p, 1); + break; + } + } + + g_slist_foreach (plugins, (GFunc)g_object_unref, NULL); + g_slist_free (plugins); + } + + g_slist_foreach (list, (GFunc) g_free, NULL); + g_slist_free (list); + + val = gconf_client_get_int (client, "/apps/evolution/mail/notify/type", NULL); + gconf_client_set_bool (client, "/apps/evolution/eplugin/mail-notification/sound-enabled", val == 1 || val == 2, NULL); + gconf_client_set_bool (client, "/apps/evolution/eplugin/mail-notification/sound-beep", val == 0 || val == 1, NULL); + + str = gconf_client_get_string (client, "/apps/evolution/mail/notify/sound", NULL); + gconf_client_set_string (client, "/apps/evolution/eplugin/mail-notification/sound-file", str ? str : "", NULL); + g_free (str); + + g_object_unref (client); +} + int em_migrate (const char *evolution_dir, int major, int minor, int revision, CamelException *ex) { @@ -2813,6 +2898,10 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel if (major < 2 || (major == 2 && minor < 12)) { em_update_accounts_2_11 (); } + + if (major < 2 || (major == 2 && minor < 22)) + em_update_message_notify_settings_2_21 (); + #endif /* !G_OS_WIN32 */ return 0; } diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index 8affc57671..ffba439eb9 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -757,36 +757,6 @@ </locale> </schema> - <!-- New Mail Notification settings --> - - <schema> - <key>/schemas/apps/evolution/mail/notify/type</key> - <applyto>/apps/evolution/mail/notify/type</applyto> - <owner>evolution-mail</owner> - <type>int</type> - <default>0</default> - <locale name="C"> - <short>New Mail Notify type</short> - <long> - Specifies the type of New Mail Notification the user wishes to use. - </long> - </locale> - </schema> - - <schema> - <key>/schemas/apps/evolution/mail/notify/sound</key> - <applyto>/apps/evolution/mail/notify/sound</applyto> - <owner>evolution-mail</owner> - <type>string</type> - <default></default> - <locale name="C"> - <short>New Mail Notify sound file</short> - <long> - Sound file to play when new mail arrives. - </long> - </locale> - </schema> - <!-- Prompt settings --> <schema> diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 4c6cc805c9..316934df1a 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -550,8 +550,8 @@ For example: "Work" or "Personal"</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <accessibility> - <atkrelation target="identity_address_label" type="labelled-by"/> <atkrelation target="label464" type="labelled-by"/> + <atkrelation target="identity_address_label" type="labelled-by"/> </accessibility> </widget> <packing> @@ -633,8 +633,8 @@ For example: "Work" or "Personal"</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <accessibility> - <atkrelation target="label464" type="labelled-by"/> <atkrelation target="identity_full_name_label" type="labelled-by"/> + <atkrelation target="label464" type="labelled-by"/> </accessibility> </widget> <packing> @@ -836,8 +836,8 @@ For example: "Work" or "Personal"</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <accessibility> - <atkrelation target="identity_organization_label" type="labelled-by"/> <atkrelation target="label466" type="labelled-by"/> + <atkrelation target="identity_organization_label" type="labelled-by"/> </accessibility> </widget> <packing> @@ -890,8 +890,8 @@ For example: "Work" or "Personal"</property> <property name="invisible_char">*</property> <property name="activates_default">False</property> <accessibility> - <atkrelation target="label466" type="labelled-by"/> <atkrelation target="reply_to_label" type="labelled-by"/> + <atkrelation target="label466" type="labelled-by"/> </accessibility> </widget> <packing> @@ -1612,7 +1612,6 @@ For example: "Work" or "Personal"</property> <property name="visible">True</property> <property name="label" translatable="yes"><span weight="bold">_Authentication Type</span></property> <property name="use_underline">True</property> - <property name="mnemonic_widget">source_auth_dropdown</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> @@ -1621,6 +1620,7 @@ For example: "Work" or "Personal"</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> + <property name="mnemonic_widget">source_auth_dropdown</property> <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> <property name="width_chars">-1</property> <property name="single_line_mode">False</property> @@ -2803,7 +2803,7 @@ For example: "Work" or "Personal"</property> <widget class="Custom" id="sent_button"> <property name="visible">True</property> <property name="creation_function">em_account_editor_folder_selector_button_new</property> - <property name="string1" translatable="yes">Select Sent Folder</property> + <property name="string1">Select Sent Folder</property> <property name="int1">0</property> <property name="int2">0</property> <property name="last_modification_time">Tue, 14 Dec 2004 17:07:09 GMT</property> @@ -2822,7 +2822,7 @@ For example: "Work" or "Personal"</property> <widget class="Custom" id="drafts_button"> <property name="visible">True</property> <property name="creation_function">em_account_editor_folder_selector_button_new</property> - <property name="string1" translatable="yes">Select Drafts Folder</property> + <property name="string1">Select Drafts Folder</property> <property name="int1">0</property> <property name="int2">0</property> <property name="last_modification_time">Tue, 14 Dec 2004 17:07:02 GMT</property> @@ -5466,227 +5466,6 @@ For example: "Work" or "Personal"</property> <property name="fill">False</property> </packing> </child> - - <child> - <widget class="GtkVBox" id="MailNotifyFrame"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label498"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold">New Message Notification</span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox185"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label543"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table25"> - <property name="visible">True</property> - <property name="n_rows">1</property> - <property name="n_columns">1</property> - <property name="homogeneous">False</property> - <property name="row_spacing">2</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkVBox" id="vboxNewMailNotify"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="radNotifyNot"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Do not notify me when new messages arrive</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">True</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radNotifyBeep"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Beep when new messages arrive</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radNotifyNot</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radNotifyPlaySound"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Play sound file when new messages arri_ve</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radNotifyNot</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox154"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="lblNotifyFilename"> - <property name="visible">True</property> - <property name="label" translatable="yes">Specify _filename:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">fileNotifyPlaySoundButton</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkFileChooserButton" id="fileNotifyPlaySoundButton"> - <property name="visible">True</property> - <property name="title" translatable="yes">Select sound file</property> - <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> - <property name="local_only">False</property> - <property name="show_hidden">False</property> - <property name="do_overwrite_confirmation">False</property> - <property name="width_chars">-1</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> </widget> <packing> <property name="tab_expand">False</property> diff --git a/mail/mail-config.h b/mail/mail-config.h index 7a2783ce65..698cb74399 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -81,12 +81,6 @@ typedef enum { } MailConfigDisplayStyle; typedef enum { - MAIL_CONFIG_NOTIFY_NOT, - MAIL_CONFIG_NOTIFY_BEEP, - MAIL_CONFIG_NOTIFY_PLAY_SOUND, -} MailConfigNewMailNotify; - -typedef enum { MAIL_CONFIG_XMAILER_NONE = 0, MAIL_CONFIG_XMAILER_EVO = 1, MAIL_CONFIG_XMAILER_OTHER = 2, diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 5433616a1b..8d9b7a2fc9 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -123,15 +123,6 @@ static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_ static guint ping_id = 0; static gboolean ping_cb (gpointer user_data); -static guint notify_id = 0; -static int notify_type = -1; - -static time_t last_notify = 0; -static time_t last_newmail = 0; -static guint notify_idle_id = 0; -static gboolean notify_idle_cb (gpointer user_data); - - /* Store to storeinfo table, active stores */ static GHashTable *stores = NULL; @@ -155,43 +146,6 @@ free_update(struct _folder_update *up) g_free(up); } -static gboolean -notify_idle_cb (gpointer user_data) -{ - GConfClient *gconf; - char *filename; - - gconf = mail_config_get_gconf_client (); - - switch (notify_type) { - case MAIL_CONFIG_NOTIFY_PLAY_SOUND: - filename = gconf_client_get_string (gconf, "/apps/evolution/mail/notify/sound", NULL); - if (filename != NULL) { - gnome_sound_play (filename); - g_free (filename); - } - break; - case MAIL_CONFIG_NOTIFY_BEEP: - gdk_beep (); - break; - default: - break; - } - - time (&last_notify); - - notify_idle_id = 0; - - return FALSE; -} - -static void -notify_type_changed (GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer user_data) -{ - notify_type = gconf_client_get_int (client, "/apps/evolution/mail/notify/type", NULL); -} - static void real_flush_updates(void *o, void *event_data, void *data) { @@ -230,21 +184,6 @@ real_flush_updates(void *o, void *event_data, void *data) /* update unread counts */ em_folder_tree_model_set_unread_count (model, up->store, up->full_name, up->unread); - /* new mail notification */ - if (notify_type == -1) { - /* need to track the user's new-mail-notification settings... */ - GConfClient *gconf; - - gconf = mail_config_get_gconf_client (); - gconf_client_add_dir (gconf, "/apps/evolution/mail/notify", - GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/notify", - notify_type_changed, NULL, NULL, NULL); - notify_type = gconf_client_get_int (gconf, "/apps/evolution/mail/notify/type", NULL); - } - - if (notify_type != 0 && up->new && notify_idle_id == 0 && (last_newmail - last_notify >= NOTIFY_THROTTLE)) - notify_idle_id = g_idle_add_full (G_PRIORITY_LOW, notify_idle_cb, NULL, NULL); if (up->uri) { EMEvent *e = em_event_peek(); @@ -474,16 +413,12 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) flags = camel_message_info_flags (info); if (((flags & CAMEL_MESSAGE_SEEN) == 0) && ((flags & CAMEL_MESSAGE_JUNK) == 0) && - ((flags & CAMEL_MESSAGE_DELETED) == 0) && - (camel_message_info_date_received (info) > last_newmail)) + ((flags & CAMEL_MESSAGE_DELETED) == 0)) new++; } } } - if (new > 0) - time (&last_newmail); - LOCK(info_lock); if (stores != NULL && (si = g_hash_table_lookup(stores, store)) != NULL diff --git a/mail/mail-folder-cache.h b/mail/mail-folder-cache.h index f4c1e1b4db..656d97135b 100644 --- a/mail/mail-folder-cache.h +++ b/mail/mail-folder-cache.h @@ -25,9 +25,6 @@ #ifndef _MAIL_FOLDER_CACHE_H #define _MAIL_FOLDER_CACHE_H -/* min no. seconds between newmail notifications */ -#define NOTIFY_THROTTLE 30 - #include <camel/camel-store.h> /* Add a store whose folders should appear in the shell |