Remove Play Sounds preference

This no longer makes sense since we don't have control over it for
notifications any more, and hence was only being used for sent mail.

Replace it with a NotificationContext signal so that a plugin could be
written to play a sound instead.
This commit is contained in:
Michael Gratton 2019-09-27 20:42:58 +10:00
parent 73fd7e72f5
commit de6071ef60
10 changed files with 49 additions and 121 deletions

View file

@ -21,26 +21,24 @@ variables:
INSTALL_CMD: ninja -v -C $BUILD_DIR install
# Fedora packages
FEDORA_DEPS: meson vala
desktop-file-utils enchant2-devel folks-devel gcr-devel
glib2-devel gmime-devel gnome-online-accounts-devel
gspell-devel gtk3-devel iso-codes-devel json-glib-devel
itstool libappstream-glib-devel libcanberra-devel
libgee-devel libhandy-devel libpeas-devel
libsecret-devel libunwind-devel libxml2-devel
libytnef-devel sqlite-devel webkitgtk4-devel
FEDORA_DEPS:
meson vala desktop-file-utils enchant2-devel folks-devel gcr-devel
glib2-devel gmime-devel gnome-online-accounts-devel gspell-devel
gtk3-devel iso-codes-devel json-glib-devel itstool
libappstream-glib-devel libgee-devel libhandy-devel libpeas-devel
libsecret-devel libunwind-devel libxml2-devel libytnef-devel
sqlite-devel webkitgtk4-devel
FEDORA_TEST_DEPS: Xvfb tar xz
# Ubuntu packages
UBUNTU_DEPS: meson build-essential valac
desktop-file-utils gettext iso-codes itstool
libappstream-glib-dev libcanberra-dev libenchant-dev
libfolks-dev libgcr-3-dev libgee-0.8-dev libglib2.0-dev
libgmime-2.6-dev libgoa-1.0-dev libgspell-1-dev
libgtk-3-dev libhandy-0.0-dev libjson-glib-dev
libmessaging-menu-dev libpeas-dev libsecret-1-dev
libsqlite3-dev libunity-dev libunwind-dev
libwebkit2gtk-4.0-dev libxml2-dev libytnef0-dev
UBUNTU_DEPS:
meson build-essential valac desktop-file-utils gettext iso-codes
itstool libappstream-glib-dev libenchant-dev libfolks-dev
libgcr-3-dev libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev
libgoa-1.0-dev libgspell-1-dev libgtk-3-dev libhandy-0.0-dev
libjson-glib-dev libmessaging-menu-dev libpeas-dev libsecret-1-dev
libsqlite3-dev libunity-dev libunwind-dev libwebkit2gtk-4.0-dev
libxml2-dev libytnef0-dev
UBUNTU_TEST_DEPS: xauth xvfb
# fedora:

16
INSTALL
View file

@ -39,13 +39,13 @@ Installing dependencies on Fedora
Install them by running this command:
sudo yum install meson vala \
desktop-file-utils enchant2-devel folks-devel gcr-devel \
glib2-devel gmime-devel gnome-online-accounts-devel \
gspell-devel gtk3-devel iso-codes-devel json-glib-devel \
libappstream-glib-devel libcanberra-devel libgee-devel \
libhandy-devel libpeas-devel libsecret-devel libunwind-devel \
libxml2-devel libytnef-devel sqlite-devel webkitgtk4-devel
sudo yum install meson vala desktop-file-utils enchant2-devel \
folks-devel gcr-devel glib2-devel gmime-devel \
gnome-online-accounts-devel gspell-devel gtk3-devel \
iso-codes-devel json-glib-devel libappstream-glib-devel \
libgee-devel libhandy-devel libpeas-devel libsecret-devel \
libunwind-devel libxml2-devel libytnef-devel sqlite-devel \
webkitgtk4-devel
Installing dependencies on Ubuntu/Debian
----------------------------------------
@ -53,7 +53,7 @@ Installing dependencies on Ubuntu/Debian
Install them by running this command:
sudo apt-get install meson build-essential valac \
desktop-file-utils iso-codes gettext itstool libcanberra-dev \
desktop-file-utils iso-codes gettext itstool \
libappstream-glib-dev libenchant-dev libfolks-dev libgcr-3-dev \
libgee-0.8-dev libglib2.0-dev libgmime-2.6-dev libgoa-1.0-dev \
libgspell-1-dev libgtk-3-dev libjson-glib-dev libhandy-0.0-dev \

View file

@ -77,12 +77,6 @@
<description>List of languages that are always displayed in the popover of the spell checker.</description>
</key>
<key name="play-sounds" type="b">
<default>true</default>
<summary>Enable notification sounds</summary>
<description>True to play sounds for notifications and sending.</description>
</key>
<key name="startup-notifications" type="b">
<default>false</default>
<summary>Notify of new mail at startup</summary>

View file

@ -88,7 +88,6 @@ gthread = dependency('gthread-2.0', version: '>=' + target_glib)
iso_codes = dependency('iso-codes')
javascriptcoregtk = dependency('javascriptcoregtk-4.0', version: '>=' + target_webkit)
json_glib = dependency('json-glib-1.0', version: '>= 1.0')
libcanberra = dependency('libcanberra', version: '>= 0.28')
libhandy = dependency('libhandy-0.0', version: '>= 0.0.9', required: false)
libmath = cc.find_library('m')
libpeas = dependency('libpeas-1.0', version: '>= 1.24.0')

View file

@ -144,7 +144,6 @@ public class Application.Controller : Geary.BaseObject {
private UpgradeDialog upgrade_dialog;
private Folks.IndividualAggregator folks;
private Canberra.Context sound_context;
private PluginManager plugin_manager;
@ -251,8 +250,6 @@ public class Application.Controller : Geary.BaseObject {
error("Error loading web resources: %s", err.message);
}
Canberra.Context.create(out this.sound_context);
this.folks = Folks.IndividualAggregator.dup();
if (!this.folks.is_prepared) {
// Do this in the background since it can take a long time
@ -2448,16 +2445,16 @@ public class Application.Controller : Geary.BaseObject {
this.main_window.conversation_list_view.grab_focus();
}
private void on_sent(Geary.RFC822.Message rfc822) {
private void on_sent(Geary.Account account, Geary.RFC822.Message sent) {
// Translators: The label for an in-app notification. The
// string substitution is a list of recipients of the email.
string message = _(
"Successfully sent mail to %s."
).printf(Util.Email.to_short_recipient_display(rfc822.to));
).printf(Util.Email.to_short_recipient_display(sent.to));
Components.InAppNotification notification =
new Components.InAppNotification(message);
this.main_window.add_notification(notification);
this.play_sound("message-sent-email");
this.plugin_manager.notifications.email_sent(account, sent);
}
private void on_conversation_view_added(ConversationListBox list) {
@ -2687,12 +2684,6 @@ public class Application.Controller : Geary.BaseObject {
return false;
}
public void play_sound(string sound) {
if (this.application.config.play_sounds) {
this.sound_context.play(0, Canberra.PROP_EVENT_ID, sound);
}
}
private void on_account_available(Geary.AccountInformation info) {
Geary.Account? account = null;
try {

View file

@ -89,6 +89,11 @@ public class Application.NotificationContext : Geary.BaseObject {
/** Emitted when a folder has been cleared of new messages. */
public signal void new_messages_retired(Geary.Folder parent, int total);
/** Emitted when an email has been sent. */
public signal void email_sent(Geary.Account account,
Geary.RFC822.Message sent);
/** Constructs a new context instance. */
internal NotificationContext(AvatarStore avatars,
GetContactStore contact_store_delegate,

View file

@ -19,7 +19,6 @@ public class Configuration {
public const string MESSAGES_PANE_POSITION_KEY = "messages-pane-position";
public const string AUTOSELECT_KEY = "autoselect";
public const string DISPLAY_PREVIEW_KEY = "display-preview";
public const string PLAY_SOUNDS_KEY = "play-sounds";
public const string STARTUP_NOTIFICATIONS_KEY = "startup-notifications";
public const string ASK_OPEN_ATTACHMENT_KEY = "ask-open-attachment";
public const string COMPOSE_AS_HTML_KEY = "compose-as-html";
@ -154,10 +153,6 @@ public class Configuration {
}
}
public bool play_sounds {
get { return settings.get_boolean(PLAY_SOUNDS_KEY); }
}
public bool startup_notifications {
get { return settings.get_boolean(STARTUP_NOTIFICATIONS_KEY); }
set { set_boolean(STARTUP_NOTIFICATIONS_KEY, value); }

View file

@ -16,9 +16,6 @@ public class PreferencesDialog : Gtk.Dialog {
[GtkChild]
private Gtk.CheckButton three_pane_view;
[GtkChild]
private Gtk.CheckButton play_sounds;
[GtkChild]
private Gtk.CheckButton startup_notifications;
@ -36,7 +33,6 @@ public class PreferencesDialog : Gtk.Dialog {
config.bind(Configuration.AUTOSELECT_KEY, autoselect, "active");
config.bind(Configuration.DISPLAY_PREVIEW_KEY, display_preview, "active");
config.bind(Configuration.FOLDER_LIST_PANE_HORIZONTAL_KEY, three_pane_view, "active");
config.bind(Configuration.PLAY_SOUNDS_KEY, play_sounds, "active");
config.bind(Configuration.STARTUP_NOTIFICATIONS_KEY, startup_notifications, "active");
}

View file

@ -124,7 +124,6 @@ geary_client_dependencies = [
gtk,
javascriptcoregtk,
json_glib,
libcanberra,
libhandy,
libmath,
libpeas,

View file

@ -39,17 +39,20 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<object class="GtkCheckButton" id="autoselect">
<property name="label" translatable="yes">_Automatically select next message</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_left">12</property>
<property name="margin_right">5</property>
<property name="margin_start">12</property>
<property name="margin_end">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Reading</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
@ -57,11 +60,13 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="autoselect">
<property name="label" translatable="yes">_Automatically select next message</property>
<object class="GtkCheckButton" id="display_preview">
<property name="label" translatable="yes">_Display conversation preview</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_left">12</property>
<property name="margin_right">5</property>
<property name="margin_start">12</property>
<property name="margin_end">5</property>
<property name="margin_top">5</property>
@ -76,11 +81,13 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="display_preview">
<property name="label" translatable="yes">_Display conversation preview</property>
<object class="GtkCheckButton" id="three_pane_view">
<property name="label" translatable="yes">Use _three pane view</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_left">12</property>
<property name="margin_right">5</property>
<property name="margin_start">12</property>
<property name="margin_end">5</property>
<property name="margin_top">5</property>
@ -94,62 +101,6 @@
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="three_pane_view">
<property name="label" translatable="yes">Use _three pane view</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_start">12</property>
<property name="margin_end">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_end">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Notifications</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="play_sounds">
<property name="label" translatable="yes">_Play notification sounds</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_start">12</property>
<property name="margin_end">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="startup_notifications">
<property name="label" translatable="yes">_Watch for new mail when closed</property>
@ -169,7 +120,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>