summaryrefslogtreecommitdiff
path: root/panels/sound
diff options
context:
space:
mode:
authorMarco Melorio <marco.melorio@protonmail.com>2023-01-06 19:02:58 +0100
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2023-01-09 21:03:41 +0000
commit62ae77ce29b5f11a8a795c33a27027b10c3f6c62 (patch)
tree1a3795bf24908a881df56704acb7398e9cedf857 /panels/sound
parenta5833612b87e9db9c53a0ce18ea9135873c940c7 (diff)
downloadgnome-control-center-62ae77ce29b5f11a8a795c33a27027b10c3f6c62.tar.gz
sound: Make CcVolumeSlider subclass from GtkWidget
Diffstat (limited to 'panels/sound')
-rw-r--r--panels/sound/cc-volume-slider.c14
-rw-r--r--panels/sound/cc-volume-slider.h2
-rw-r--r--panels/sound/cc-volume-slider.ui3
3 files changed, 14 insertions, 5 deletions
diff --git a/panels/sound/cc-volume-slider.c b/panels/sound/cc-volume-slider.c
index 5c377654c..b604aaee1 100644
--- a/panels/sound/cc-volume-slider.c
+++ b/panels/sound/cc-volume-slider.c
@@ -26,7 +26,7 @@
struct _CcVolumeSlider
{
- GtkBox parent_instance;
+ GtkWidget parent_instance;
GtkToggleButton *mute_button;
GtkAdjustment *volume_adjustment;
@@ -39,7 +39,7 @@ struct _CcVolumeSlider
guint notify_is_muted_handler_id;
};
-G_DEFINE_TYPE (CcVolumeSlider, cc_volume_slider, GTK_TYPE_BOX)
+G_DEFINE_TYPE (CcVolumeSlider, cc_volume_slider, GTK_TYPE_WIDGET)
static void
update_volume_icon (CcVolumeSlider *self)
@@ -150,6 +150,9 @@ cc_volume_slider_dispose (GObject *object)
{
CcVolumeSlider *self = CC_VOLUME_SLIDER (object);
+ g_clear_pointer ((GtkWidget **) &self->volume_scale, gtk_widget_unparent);
+ g_clear_pointer ((GtkWidget **) &self->mute_button, gtk_widget_unparent);
+
g_clear_object (&self->mixer_control);
g_clear_object (&self->stream);
@@ -172,14 +175,21 @@ cc_volume_slider_class_init (CcVolumeSliderClass *klass)
gtk_widget_class_bind_template_callback (widget_class, mute_button_toggled_cb);
gtk_widget_class_bind_template_callback (widget_class, volume_changed_cb);
+
+ gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
}
void
cc_volume_slider_init (CcVolumeSlider *self)
{
+ GtkLayoutManager *box_layout;
+
g_resources_register (cc_sound_get_resource ());
gtk_widget_init_template (GTK_WIDGET (self));
+
+ box_layout = gtk_widget_get_layout_manager (GTK_WIDGET (self));
+ gtk_box_layout_set_spacing (GTK_BOX_LAYOUT (box_layout), 6);
}
void
diff --git a/panels/sound/cc-volume-slider.h b/panels/sound/cc-volume-slider.h
index b0385906a..f2d593e2c 100644
--- a/panels/sound/cc-volume-slider.h
+++ b/panels/sound/cc-volume-slider.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
#define CC_TYPE_VOLUME_SLIDER (cc_volume_slider_get_type ())
-G_DECLARE_FINAL_TYPE (CcVolumeSlider, cc_volume_slider, CC, VOLUME_SLIDER, GtkBox)
+G_DECLARE_FINAL_TYPE (CcVolumeSlider, cc_volume_slider, CC, VOLUME_SLIDER, GtkWidget)
void cc_volume_slider_set_mixer_control (CcVolumeSlider *slider,
GvcMixerControl *mixer_control);
diff --git a/panels/sound/cc-volume-slider.ui b/panels/sound/cc-volume-slider.ui
index a3de46313..fe13a838d 100644
--- a/panels/sound/cc-volume-slider.ui
+++ b/panels/sound/cc-volume-slider.ui
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <template class="CcVolumeSlider" parent="GtkBox">
- <property name="spacing">6</property>
+ <template class="CcVolumeSlider" parent="GtkWidget">
<child>
<object class="GtkScale" id="volume_scale">
<property name="visible">True</property>