status/volume: Create global showOSD() method for StreamSlider
Abstract the Volume slider OSD display as a global method in the base class, so that can be reused in all derived classes without duplicating code. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3531>
This commit is contained in:
parent
943d35243b
commit
9f8cb2faba
@ -276,6 +276,13 @@ const StreamSlider = GObject.registerClass({
|
|||||||
|
|
||||||
return maxVolume / this._control.get_vol_max_norm();
|
return maxVolume / this._control.get_vol_max_norm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showOSD() {
|
||||||
|
const gicon = new Gio.ThemedIcon({name: this.getIcon()});
|
||||||
|
const level = this.getLevel();
|
||||||
|
const maxLevel = this.getMaxLevel();
|
||||||
|
Main.osdWindowManager.show(-1, gicon, null, level, maxLevel);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const OutputStreamSlider = GObject.registerClass(
|
const OutputStreamSlider = GObject.registerClass(
|
||||||
@ -425,10 +432,7 @@ class VolumeIndicator extends SystemIndicator {
|
|||||||
if (result === Clutter.EVENT_PROPAGATE || item.mapped)
|
if (result === Clutter.EVENT_PROPAGATE || item.mapped)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
const gicon = new Gio.ThemedIcon({name: item.getIcon()});
|
item.showOSD();
|
||||||
const level = item.getLevel();
|
|
||||||
const maxLevel = item.getMaxLevel();
|
|
||||||
Main.osdWindowManager.show(-1, gicon, null, level, maxLevel);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user