Skip to content

Commit

Permalink
Output: use event controller
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Oct 14, 2023
1 parent ffe03fd commit eef5e9d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/OutputPanel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ public class Sound.OutputPanel : Gtk.Box {

var volume_label = new Granite.HeaderLabel (_("Volume"));

var legacy_controller = new Gtk.EventControllerLegacy ();

volume_scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 100, 5) {
draw_value = false,
hexpand = true
};
volume_scale.adjustment.page_increment = 5;
volume_scale.add_controller (legacy_controller);

volume_switch = new Gtk.Switch () {
valign = Gtk.Align.CENTER,
Expand Down Expand Up @@ -174,17 +177,14 @@ public class Sound.OutputPanel : Gtk.Box {
screen_reader_label.secondary_text = screenreader_shortcut_label;
});

// volume_scale.button_release_event.connect (e => {
// notify_change ();
// return false;
// });

// volume_scale.scroll_event.connect (e => {
// if (volume_scale.get_value () < 100) {
// notify_change ();
// }
// return false;
// });
legacy_controller.event.connect ((e) => {
var event_type = e.get_event_type ();
if (event_type == SCROLL || event_type == BUTTON_RELEASE) {
notify_change ();
}

return Gdk.EVENT_PROPAGATE;
});
}

private void default_changed () {
Expand Down

0 comments on commit eef5e9d

Please sign in to comment.