[gnome-control-center/sound-upate-sound-alerts: 3/4] sound: Update sound alerts




commit 209e27d9e3c7d10b7e6b183ab7237a8ff1245811
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Aug 4 12:36:54 2022 +0200

    sound: Update sound alerts
    
    Old sound alerts set by users will be migrated to the "click"
    sound alert.
    
    Fixes #264

 panels/sound/cc-alert-chooser.c  |  67 +++++++++++++++++++++++----------------
 panels/sound/cc-alert-chooser.ui |  24 +++++++++-----
 panels/sound/meson.build         |   8 ++---
 panels/sound/sounds/bark.ogg     | Bin 13322 -> 0 bytes
 panels/sound/sounds/click.ogg    | Bin 0 -> 50484 bytes
 panels/sound/sounds/drip.ogg     | Bin 8495 -> 0 bytes
 panels/sound/sounds/glass.ogg    | Bin 18999 -> 0 bytes
 panels/sound/sounds/hum.ogg      | Bin 0 -> 49692 bytes
 panels/sound/sounds/sonar.ogg    | Bin 20011 -> 0 bytes
 panels/sound/sounds/string.ogg   | Bin 0 -> 45767 bytes
 panels/sound/sounds/swing.ogg    | Bin 0 -> 50180 bytes
 11 files changed, 59 insertions(+), 40 deletions(-)
---
diff --git a/panels/sound/cc-alert-chooser.c b/panels/sound/cc-alert-chooser.c
index 55d1bdcb7..2ccadcecc 100644
--- a/panels/sound/cc-alert-chooser.c
+++ b/panels/sound/cc-alert-chooser.c
@@ -29,9 +29,10 @@ struct _CcAlertChooser
 {
   GtkBox         parent_instance;
 
-  GtkToggleButton *drip_button;
-  GtkToggleButton *glass_button;
-  GtkToggleButton *sonar_button;
+  GtkToggleButton *click_button;
+  GtkToggleButton *hum_button;
+  GtkToggleButton *string_button;
+  GtkToggleButton *swing_button;
 
   GSoundContext *context;
   GSettings     *sound_settings;
@@ -214,20 +215,24 @@ static void
 clicked_cb (CcAlertChooser *self,
             GtkToggleButton  *button)
 {
-  if (button == self->drip_button)
-    select_sound (self, "drip");
-  else if (button == self->glass_button)
-    select_sound (self, "glass");
-  else if (button == self->sonar_button)
-    select_sound (self, "sonar");
+  if (button == self->click_button)
+    select_sound (self, "click");
+  else if (button == self->hum_button)
+    select_sound (self, "hum");
+  else if (button == self->string_button)
+    select_sound (self, "string");
+  else if (button == self->swing_button)
+    select_sound (self, "swing");
 
   set_button (self, button, TRUE);
-  if (button != self->drip_button)
-    set_button (self, self->drip_button, FALSE);
-  if (button != self->glass_button)
-    set_button (self, self->glass_button, FALSE);
-  if (button != self->sonar_button)
-    set_button (self, self->sonar_button, FALSE);
+  if (button != self->click_button)
+    set_button (self, self->click_button, FALSE);
+  if (button != self->hum_button)
+    set_button (self, self->hum_button, FALSE);
+  if (button != self->string_button)
+    set_button (self, self->string_button, FALSE);
+  if (button != self->swing_button)
+    set_button (self, self->swing_button, FALSE);
 }
 
 static void
@@ -251,9 +256,10 @@ cc_alert_chooser_class_init (CcAlertChooserClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/sound/cc-alert-chooser.ui");
 
-  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, drip_button);
-  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, glass_button);
-  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, sonar_button);
+  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, click_button);
+  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, hum_button);
+  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, string_button);
+  gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, swing_button);
 
   gtk_widget_class_bind_template_callback (widget_class, clicked_cb);
 }
@@ -276,20 +282,25 @@ cc_alert_chooser_init (CcAlertChooser *self)
 
   alert_name = get_alert_name ();
 
-  /* If user has selected the old dog bark theme, migrate them to drip. */
-  if (g_strcmp0 (alert_name, "bark") == 0)
+  /* If user has selected an old sound alert, migrate them to click. */
+  if (g_strcmp0 (alert_name, "click") != 0 ||
+      g_strcmp0 (alert_name, "hum") != 0 ||
+      g_strcmp0 (alert_name, "string") != 0 ||
+      g_strcmp0 (alert_name, "swing") != 0)
     {
-      set_custom_theme (self, "drip");
+      set_custom_theme (self, "click");
       g_free (alert_name);
-      alert_name = g_strdup ("drip");
+      alert_name = g_strdup ("click");
     }
 
-  if (g_strcmp0 (alert_name, "drip") == 0)
-    set_button (self, self->drip_button, TRUE);
-  else if (g_strcmp0 (alert_name, "glass") == 0)
-    set_button (self, self->glass_button, TRUE);
-  else if (g_strcmp0 (alert_name, "sonar") == 0)
-    set_button (self, self->sonar_button, TRUE);
+  if (g_strcmp0 (alert_name, "click") == 0)
+    set_button (self, self->click_button, TRUE);
+  else if (g_strcmp0 (alert_name, "hum") == 0)
+    set_button (self, self->string_button, TRUE);
+  else if (g_strcmp0 (alert_name, "string") == 0)
+    set_button (self, self->swing_button, TRUE);
+  else if (g_strcmp0 (alert_name, "swing") == 0)
+    set_button (self, self->swing_button, TRUE);
   else if (alert_name != NULL)
     g_warning ("Current alert sound has unknown name %s", alert_name);
 }
diff --git a/panels/sound/cc-alert-chooser.ui b/panels/sound/cc-alert-chooser.ui
index 6ce494df0..603aff911 100644
--- a/panels/sound/cc-alert-chooser.ui
+++ b/panels/sound/cc-alert-chooser.ui
@@ -7,25 +7,33 @@
       <class name="linked"/>
     </style>
     <child>
-      <object class="GtkToggleButton" id="drip_button">
+      <object class="GtkToggleButton" id="click_button">
         <property name="visible">True</property>
-        <property name="label" translatable="yes">Drip</property>
+        <property name="label" translatable="yes">Click</property>
         <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
       </object>
     </child>
     <child>
-      <object class="GtkToggleButton" id="glass_button">
+      <object class="GtkToggleButton" id="string_button">
         <property name="visible">True</property>
-        <property name="group">drip_button</property>
-        <property name="label" translatable="yes">Glass</property>
+        <property name="group">click_button</property>
+        <property name="label" translatable="yes">String</property>
         <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
       </object>
     </child>
     <child>
-      <object class="GtkToggleButton" id="sonar_button">
+      <object class="GtkToggleButton" id="swing_button">
         <property name="visible">True</property>
-        <property name="group">drip_button</property>
-        <property name="label" translatable="yes">Sonar</property>
+        <property name="group">click_button</property>
+        <property name="label" translatable="yes">Swing</property>
+        <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
+      </object>
+    </child>
+    <child>
+      <object class="GtkToggleButton" id="hum_button">
+        <property name="visible">True</property>
+        <property name="group">click_button</property>
+        <property name="label" translatable="yes">Hum</property>
         <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
       </object>
     </child>
diff --git a/panels/sound/meson.build b/panels/sound/meson.build
index dd8d0b675..458377d49 100644
--- a/panels/sound/meson.build
+++ b/panels/sound/meson.build
@@ -95,10 +95,10 @@ panels_libs += static_library(
 )
 
 sound_data = files(
-  'sounds/bark.ogg',
-  'sounds/drip.ogg',
-  'sounds/glass.ogg',
-  'sounds/sonar.ogg'
+  'sounds/click.ogg',
+  'sounds/hum.ogg',
+  'sounds/string.ogg',
+  'sounds/swing.ogg'
 )
 
 install_data(
diff --git a/panels/sound/sounds/click.ogg b/panels/sound/sounds/click.ogg
new file mode 100644
index 000000000..d43875160
Binary files /dev/null and b/panels/sound/sounds/click.ogg differ
diff --git a/panels/sound/sounds/hum.ogg b/panels/sound/sounds/hum.ogg
new file mode 100644
index 000000000..fbdd72f2b
Binary files /dev/null and b/panels/sound/sounds/hum.ogg differ
diff --git a/panels/sound/sounds/string.ogg b/panels/sound/sounds/string.ogg
new file mode 100644
index 000000000..ef8096663
Binary files /dev/null and b/panels/sound/sounds/string.ogg differ
diff --git a/panels/sound/sounds/swing.ogg b/panels/sound/sounds/swing.ogg
new file mode 100644
index 000000000..b6f0d2fe9
Binary files /dev/null and b/panels/sound/sounds/swing.ogg differ


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