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>
This commit is contained in:
Florian Müllner 2022-04-27 15:33:40 +02:00 committed by Marge Bot
parent 82d336211a
commit b365eb9936
3 changed files with 8 additions and 0 deletions

View File

@ -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 */

View File

@ -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)

View File

@ -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) {