From 99923ac6121f60ee3ca4a6a0b19e42084253de56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Wed, 26 Apr 2023 12:34:17 +0200 Subject: [PATCH] screenshot: Handle screencast errors properly Send a notification and remove the screencast inidicator when we hear about a screencast error from the dbus service. Part-of: --- js/ui/screenshot.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 9acc07494..d50a4f046 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -1037,6 +1037,9 @@ var ScreenshotUI = GObject.registerClass({ this._castButton.visible = this._screencastSupported; }); + this._screencastProxy.connectSignal('Error', + () => this._screencastFailed()); + this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' }); // The full-screen screenshot has a separate container so that we can @@ -1913,6 +1916,18 @@ var ScreenshotUI = GObject.registerClass({ return; } + // Translators: notification title. + this._showNotification(_('Screencast recorded')); + } + + _screencastFailed() { + this._setScreencastInProgress(false); + + // Translators: notification title. + this._showNotification(_('Screencast ended unexpectedly')); + } + + _showNotification(title) { // Show a notification. const file = Gio.file_new_for_path(this._screencastPath); @@ -1923,8 +1938,7 @@ var ScreenshotUI = GObject.registerClass({ ); const notification = new MessageTray.Notification( source, - // Translators: notification title. - _('Screencast recorded'), + title, // Translators: notification body when a screencast was recorded. _('Click here to view the video.') );