[gnome-shell] screenshot: Hide screencast button when recorder is disabled



commit b365eb99366f73c7bf16e260076033ae9072a63b
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Apr 27 15:33:40 2022 +0200

    screenshot: Hide screencast button when recorder is disabled
    
    The screencast D-Bus service that is used for the recordings
    is only installed if the necessary gstreamer and pipewire
    dependencies are found at build time.
    
    The screencast button cannot work when the service is missing,
    so don't show it in the first place.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2450
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2285>

 js/misc/config.js.in | 2 ++
 js/misc/meson.build  | 1 +
 js/ui/screenshot.js  | 5 +++++
 3 files changed, 8 insertions(+)
---
diff --git a/js/misc/config.js.in b/js/misc/config.js.in
index 776a6c6000..8cea70bc05 100644
--- a/js/misc/config.js.in
+++ b/js/misc/config.js.in
@@ -10,6 +10,8 @@ var HAVE_BLUETOOTH = @HAVE_BLUETOOTH@;
 var HAVE_NETWORKMANAGER = @HAVE_NETWORKMANAGER@;
 /* 1 if soup2 should be used instead of soup3, 0 otherwise */
 var HAVE_SOUP2 = @HAVE_SOUP2@;
+/* 1 if recorder is enabled, 0 otherwise */
+var HAVE_RECORDER = @HAVE_RECORDER@;
 /* gettext package */
 var GETTEXT_PACKAGE = '@GETTEXT_PACKAGE@';
 /* locale dir */
diff --git a/js/misc/meson.build b/js/misc/meson.build
index 5825627111..43d6d99c6c 100644
--- a/js/misc/meson.build
+++ b/js/misc/meson.build
@@ -6,6 +6,7 @@ jsconf.set('LIBMUTTER_API_VERSION', mutter_api_version)
 jsconf.set10('HAVE_BLUETOOTH', bt_dep.found())
 jsconf.set10('HAVE_NETWORKMANAGER', have_networkmanager)
 jsconf.set10('HAVE_SOUP2', have_soup2)
+jsconf.set10('HAVE_RECORDER', enable_recorder)
 jsconf.set('datadir', datadir)
 jsconf.set('libexecdir', libexecdir)
 
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 63069d2162..98cfec4685 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -3,6 +3,7 @@
 
 const { Clutter, Cogl, Gio, GObject, GLib, Graphene, Gtk, Meta, Shell, St } = imports.gi;
 
+const Config = imports.misc.config;
 const GrabHelper = imports.ui.grabHelper;
 const Layout = imports.ui.layout;
 const Lightbox = imports.ui.lightbox;
@@ -1212,6 +1213,7 @@ var ScreenshotUI = GObject.registerClass({
         this._castButton = new St.Button({
             style_class: 'screenshot-ui-shot-cast-button',
             toggle_mode: true,
+            visible: Config.HAVE_RECORDER,
         });
         this._castButton.set_child(new St.Icon({ icon_name: 'camera-web-symbolic' }));
         this._castButton.connect('notify::checked',
@@ -1429,6 +1431,9 @@ var ScreenshotUI = GObject.registerClass({
         if (this._screencastInProgress)
             return;
 
+        if (mode === UIMode.SCREENCAST && !Config.HAVE_RECORDER)
+            return;
+
         this._castButton.checked = mode === UIMode.SCREENCAST;
 
         if (!this.visible) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]