@@ -218,44 +218,23 @@ public class Power.Indicator : Wingpanel.Indicator {
218218 }
219219 }
220220
221- private bool show_notification () {
222- if (is_in_session) {
223- var notification = new Notify .Notification (" indicator-power" , " " , " display-brightness-symbolic" );
224- notification. set_hint (" x-canonical-private-synchronous" , new Variant .string (" indicator-power" ));
225- notification. set_hint (" value" , new Variant .int32 ((int ) (brightness_manager. get_global_brightness () * 100 )));
226- try {
227- notification. show ();
228- return true ;
229- } catch (Error e) {
230- warning (" Unable to show notification: %s " , e. message);
231- }
232-
233- }
234-
235- return false ;
236- }
237-
238221 private void setup_scroll_controller () {
239222 if (brightness_manager. present) {
240223 var scroll_controller = new Gtk .EventControllerScroll (BOTH_AXES );
241- scroll_controller. scroll. connect ((controller, dx, dy) = > {
242- if (Utils . handle_global_scroll_event (
243- (Gdk . ScrollEvent ) controller. get_current_event ())
244- ) {
245- if (popover_widget == null || ! popover_widget. is_visible ()) {
246- show_notification ();
247- }
248-
249- return true ;
250- }
251-
252- return false ;
253- });
224+ scroll_controller. scroll. connect (on_scroll);
254225 display_widget. add_controller (scroll_controller);
255226
256227 brightness_manager. monitor_brightness_changed. connect (update_tooltip);
257228 }
258229 }
230+
231+ private bool on_scroll (Gtk .EventControllerScroll controller , double dx , double dy ) {
232+ if (Utils . handle_global_scroll_event ((Gdk . ScrollEvent ) controller. get_current_event ())) {
233+ maybe_show_brightness_osd (brightness_manager. get_global_brightness ());
234+ return true ;
235+ }
236+ return false ;
237+ }
259238}
260239
261240public Wingpanel . Indicator get_indicator (Module module, Wingpanel . ServerType server_type) {
0 commit comments