[geary/mjog/plugin-support] Remove Play Sounds preference



commit de6071ef6060a31f77996611da2579665a9d8d02
Author: Michael Gratton <mike vee net>
Date:   Fri Sep 27 20:42:58 2019 +1000

    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.

 .gitlab-ci.yml                                     | 32 +++++-----
 INSTALL                                            | 16 ++---
 desktop/org.gnome.Geary.gschema.xml                |  6 --
 meson.build                                        |  1 -
 src/client/application/application-controller.vala | 15 +----
 .../application-notification-context.vala          |  5 ++
 src/client/application/geary-config.vala           |  5 --
 src/client/dialogs/preferences-dialog.vala         |  4 --
 src/client/meson.build                             |  1 -
 ui/preferences-dialog.ui                           | 69 ++++------------------
 10 files changed, 41 insertions(+), 113 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0dbb7578..61530bd6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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:
diff --git a/INSTALL b/INSTALL
index 43ed6e33..f77f3b52 100644
--- a/INSTALL
+++ b/INSTALL
@@ -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 \
diff --git a/desktop/org.gnome.Geary.gschema.xml b/desktop/org.gnome.Geary.gschema.xml
index cfae778b..fafb6ba2 100644
--- a/desktop/org.gnome.Geary.gschema.xml
+++ b/desktop/org.gnome.Geary.gschema.xml
@@ -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>
diff --git a/meson.build b/meson.build
index 61864e47..98d4527f 100644
--- a/meson.build
+++ b/meson.build
@@ -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')
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index 1edf05e3..22f22758 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -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 {
diff --git a/src/client/application/application-notification-context.vala 
b/src/client/application/application-notification-context.vala
index 4aa30911..cf78ca9c 100644
--- a/src/client/application/application-notification-context.vala
+++ b/src/client/application/application-notification-context.vala
@@ -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,
diff --git a/src/client/application/geary-config.vala b/src/client/application/geary-config.vala
index 99917b76..03074088 100644
--- a/src/client/application/geary-config.vala
+++ b/src/client/application/geary-config.vala
@@ -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); }
diff --git a/src/client/dialogs/preferences-dialog.vala b/src/client/dialogs/preferences-dialog.vala
index fe9c02a0..72459c1c 100644
--- a/src/client/dialogs/preferences-dialog.vala
+++ b/src/client/dialogs/preferences-dialog.vala
@@ -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");
     }
 
diff --git a/src/client/meson.build b/src/client/meson.build
index 37666c42..8b760907 100644
--- a/src/client/meson.build
+++ b/src/client/meson.build
@@ -124,7 +124,6 @@ geary_client_dependencies = [
   gtk,
   javascriptcoregtk,
   json_glib,
-  libcanberra,
   libhandy,
   libmath,
   libpeas,
diff --git a/ui/preferences-dialog.ui b/ui/preferences-dialog.ui
index 37e0c72f..dc6cd9d0 100644
--- a/ui/preferences-dialog.ui
+++ b/ui/preferences-dialog.ui
@@ -38,30 +38,14 @@
           <object class="GtkGrid">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <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">Reading</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">0</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkCheckButton" id="autoselect">
                 <property name="label" translatable="yes">_Automatically select next message</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>
@@ -72,7 +56,7 @@
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
+                <property name="top_attach">0</property>
               </packing>
             </child>
             <child>
@@ -81,6 +65,8 @@
                 <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>
@@ -91,7 +77,7 @@
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
+                <property name="top_attach">1</property>
               </packing>
             </child>
             <child>
@@ -100,6 +86,8 @@
                 <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>
@@ -110,44 +98,7 @@
               </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>
+                <property name="top_attach">2</property>
               </packing>
             </child>
             <child>
@@ -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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]