[gnome-shell] screenshot-ui: Add a screencast in progress property
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] screenshot-ui: Add a screencast in progress property
- Date: Sat, 29 Jan 2022 14:48:37 +0000 (UTC)
commit fc0bff5e480068e0f309d8f660d8d0f3969f8cbf
Author: Ivan Molodetskikh <yalterz gmail com>
Date: Sat Nov 27 10:41:24 2021 +0300
screenshot-ui: Add a screencast in progress property
The screen recording menu entry will use this to check if a screencast
is currently active and to stop the screencast.
Use a GObject property so we can bind to notify; specifically we'll bind
the visibility of a screencast area indicator.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2103>
js/ui/screenshot.js | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index ce6ff26a2e..7417376239 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -995,8 +995,16 @@ class UIWindowSelector extends St.Widget {
}
});
-var ScreenshotUI = GObject.registerClass(
-class ScreenshotUI extends St.Widget {
+var ScreenshotUI = GObject.registerClass({
+ Properties: {
+ 'screencast-in-progress': GObject.ParamSpec.boolean(
+ 'screencast-in-progress',
+ 'screencast-in-progress',
+ 'screencast-in-progress',
+ GObject.ParamFlags.READABLE,
+ false),
+ },
+}, class ScreenshotUI extends St.Widget {
_init() {
super._init({
name: 'screenshot-ui',
@@ -1010,6 +1018,8 @@ class ScreenshotUI extends St.Widget {
reactive: true,
});
+ this._screencastInProgress = false;
+
this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' });
// The full-screen screenshot has a separate container so that we can
@@ -1820,6 +1830,30 @@ class ScreenshotUI extends St.Widget {
}
}
+ stopScreencast() {
+ if (!this._screencastInProgress)
+ return;
+
+ // Set this before calling the method as the screen recording indicator
+ // will check it before the success callback fires.
+ this._setScreencastInProgress(false);
+ }
+
+ get screencast_in_progress() {
+ if (!('_screencastInProgress' in this))
+ return false;
+
+ return this._screencastInProgress;
+ }
+
+ _setScreencastInProgress(inProgress) {
+ if (this._screencastInProgress === inProgress)
+ return;
+
+ this._screencastInProgress = inProgress;
+ this.notify('screencast-in-progress');
+ }
+
vfunc_key_press_event(event) {
const symbol = event.keyval;
if (symbol === Clutter.KEY_Return || symbol === Clutter.KEY_space ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]