[gnome-control-center/wip/jimmac/sound-panel-symbols] sound: Remove CcSoundButton in favor of a simple GtkToggleButton
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/jimmac/sound-panel-symbols] sound: Remove CcSoundButton in favor of a simple GtkToggleButton
- Date: Fri, 4 Feb 2022 11:06:43 +0000 (UTC)
commit da0c8bb359c90844861d44a4715250f3760f1f13
Author: Felipe Borges <felipeborges gnome org>
Date: Fri Feb 4 12:01:46 2022 +0100
sound: Remove CcSoundButton in favor of a simple GtkToggleButton
Without the custom image allocation, we can simply use a simple
button instead.
Fixes #1583
panels/sound/cc-alert-chooser.c | 17 +++----
panels/sound/cc-alert-chooser.ui | 19 ++++----
panels/sound/cc-sound-button.c | 100 ---------------------------------------
panels/sound/cc-sound-button.h | 28 -----------
panels/sound/cc-sound-button.ui | 21 --------
panels/sound/meson.build | 2 -
panels/sound/sound.gresource.xml | 1 -
7 files changed, 18 insertions(+), 170 deletions(-)
---
diff --git a/panels/sound/cc-alert-chooser.c b/panels/sound/cc-alert-chooser.c
index 8e60659f1..4d56f5849 100644
--- a/panels/sound/cc-alert-chooser.c
+++ b/panels/sound/cc-alert-chooser.c
@@ -21,7 +21,6 @@
#include "config.h"
#include "cc-alert-chooser.h"
-#include "cc-sound-button.h"
#include "cc-sound-resources.h"
#define KEY_SOUNDS_SCHEMA "org.gnome.desktop.sound"
@@ -30,17 +29,17 @@ struct _CcAlertChooser
{
GtkBox parent_instance;
- CcSoundButton *bark_button;
- CcSoundButton *drip_button;
- CcSoundButton *glass_button;
- CcSoundButton *sonar_button;
+ GtkToggleButton *bark_button;
+ GtkToggleButton *drip_button;
+ GtkToggleButton *glass_button;
+ GtkToggleButton *sonar_button;
GSoundContext *context;
GSettings *sound_settings;
};
static void clicked_cb (CcAlertChooser *self,
- CcSoundButton *button);
+ GtkToggleButton *button);
G_DEFINE_TYPE (CcAlertChooser, cc_alert_chooser, GTK_TYPE_BOX)
@@ -185,7 +184,7 @@ select_sound (CcAlertChooser *self,
static void
set_button (CcAlertChooser *self,
- CcSoundButton *button,
+ GtkToggleButton *button,
gboolean active)
{
g_signal_handlers_block_by_func (button, clicked_cb, self);
@@ -195,7 +194,7 @@ set_button (CcAlertChooser *self,
static void
clicked_cb (CcAlertChooser *self,
- CcSoundButton *button)
+ GtkToggleButton *button)
{
if (button == self->bark_button)
select_sound (self, "bark");
@@ -244,8 +243,6 @@ cc_alert_chooser_class_init (CcAlertChooserClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcAlertChooser, sonar_button);
gtk_widget_class_bind_template_callback (widget_class, clicked_cb);
-
- g_type_ensure (CC_TYPE_SOUND_BUTTON);
}
void
diff --git a/panels/sound/cc-alert-chooser.ui b/panels/sound/cc-alert-chooser.ui
index c6737117d..cd97c25eb 100644
--- a/panels/sound/cc-alert-chooser.ui
+++ b/panels/sound/cc-alert-chooser.ui
@@ -7,31 +7,34 @@
<class name="linked"/>
</style>
<child>
- <object class="CcSoundButton" id="bark_button">
+ <object class="GtkToggleButton" id="bark_button">
<property name="visible">True</property>
<property name="label" translatable="yes">Bark</property>
- <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
+ <signal name="toggled" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
</object>
</child>
<child>
- <object class="CcSoundButton" id="drip_button">
+ <object class="GtkToggleButton" id="drip_button">
<property name="visible">True</property>
+ <property name="group">bark_button</property>
<property name="label" translatable="yes">Drip</property>
- <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
+ <signal name="toggled" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
</object>
</child>
<child>
- <object class="CcSoundButton" id="glass_button">
+ <object class="GtkToggleButton" id="glass_button">
<property name="visible">True</property>
+ <property name="group">bark_button</property>
<property name="label" translatable="yes">Glass</property>
- <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
+ <signal name="toggled" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
</object>
</child>
<child>
- <object class="CcSoundButton" id="sonar_button">
+ <object class="GtkToggleButton" id="sonar_button">
<property name="visible">True</property>
+ <property name="group">bark_button</property>
<property name="label" translatable="yes">Sonar</property>
- <signal name="clicked" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
+ <signal name="toggled" handler="clicked_cb" object="CcAlertChooser" swapped="yes"/>
</object>
</child>
</template>
diff --git a/panels/sound/meson.build b/panels/sound/meson.build
index cbaaae118..dd8d0b675 100644
--- a/panels/sound/meson.build
+++ b/panels/sound/meson.build
@@ -37,7 +37,6 @@ sources = files(
'cc-level-bar.c',
'cc-output-test-dialog.c',
'cc-profile-combo-box.c',
- 'cc-sound-button.c',
'cc-sound-panel.c',
'cc-speaker-test-button.c',
'cc-stream-list-box.c',
@@ -72,7 +71,6 @@ resource_data = files(
'cc-fade-slider.ui',
'cc-output-test-dialog.ui',
'cc-profile-combo-box.ui',
- 'cc-sound-button.ui',
'cc-sound-panel.ui',
'cc-speaker-test-button.ui',
'cc-stream-row.ui',
diff --git a/panels/sound/sound.gresource.xml b/panels/sound/sound.gresource.xml
index 3ec0b5f85..cdac713e4 100644
--- a/panels/sound/sound.gresource.xml
+++ b/panels/sound/sound.gresource.xml
@@ -7,7 +7,6 @@
<file preprocess="xml-stripblanks">cc-fade-slider.ui</file>
<file preprocess="xml-stripblanks">cc-output-test-dialog.ui</file>
<file preprocess="xml-stripblanks">cc-profile-combo-box.ui</file>
- <file preprocess="xml-stripblanks">cc-sound-button.ui</file>
<file preprocess="xml-stripblanks">cc-sound-panel.ui</file>
<file preprocess="xml-stripblanks">cc-speaker-test-button.ui</file>
<file preprocess="xml-stripblanks">cc-stream-list-box.ui</file>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]