screenshot-ui: Add mode argument to open()

In a subsequent commit we will add a function to open the screenshot UI
in the screencast mode. This argument will allow us to do that without
resorting to accessing private fields from the outside.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2107>
This commit is contained in:
Ivan Molodetskikh 2022-02-03 22:47:07 +03:00 committed by Marge Bot
parent 6d3dd232ad
commit b757f165a3

View File

@ -988,6 +988,11 @@ class UIWindowSelector extends St.Widget {
}
});
const UIMode = {
SCREENSHOT: 0,
SCREENCAST: 1,
};
var ScreenshotUI = GObject.registerClass({
Properties: {
'screencast-in-progress': GObject.ParamSpec.boolean(
@ -1408,13 +1413,15 @@ var ScreenshotUI = GObject.registerClass({
this._screenSelectors[Main.layoutManager.primaryIndex].checked = true;
}
async open() {
async open(mode = UIMode.SCREENSHOT) {
if (this._openingCoroutineInProgress)
return;
if (this._screencastInProgress)
return;
this._castButton.checked = mode === UIMode.SCREENCAST;
if (!this.visible) {
// Screenshot UI is opening from completely closed state
// (rather than opening back from in process of closing).