dependencies: Migrate to ES module and organize dependencies
gi modules are always loaded (there is no API for "set version without loading"), so we need to break dependencies.js into three sections: - Required - Compile-time optional - Runtime optional Required dependencies are always imported, compile-time optional dependencies are loaded if gnome-shell is compiled with support for them, and for runtime optional dependencies we catch any errors when attempting to load them. If runtime optional dependencies fail to load we log a debug-level message. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
This commit is contained in:
parent
7a5f1e5c9e
commit
c2c4d84fc1
@ -6,6 +6,7 @@ overrides:
|
||||
- js/ui/init.js
|
||||
- js/ui/environment.js
|
||||
- js/ui/scripting.js
|
||||
- js/misc/dependencies.js
|
||||
- js/dbusServices/**
|
||||
- js/portalHelper/**
|
||||
- subprojects/extensions-app/**
|
||||
|
@ -1,35 +1,74 @@
|
||||
imports.gi.versions.AccountsService = '1.0';
|
||||
imports.gi.versions.Atk = '1.0';
|
||||
imports.gi.versions.Atspi = '2.0';
|
||||
imports.gi.versions.Gcr = '4';
|
||||
imports.gi.versions.Gdk = '4.0';
|
||||
imports.gi.versions.Gdm = '1.0';
|
||||
imports.gi.versions.Geoclue = '2.0';
|
||||
imports.gi.versions.Gio = '2.0';
|
||||
imports.gi.versions.GDesktopEnums = '3.0';
|
||||
imports.gi.versions.GdkPixbuf = '2.0';
|
||||
imports.gi.versions.GnomeBluetooth = '3.0';
|
||||
imports.gi.versions.GnomeBG = '4.0';
|
||||
imports.gi.versions.GnomeDesktop = '4.0';
|
||||
imports.gi.versions.Graphene = '1.0';
|
||||
imports.gi.versions.GWeather = '4.0';
|
||||
imports.gi.versions.IBus = '1.0';
|
||||
imports.gi.versions.Malcontent = '0';
|
||||
imports.gi.versions.NM = '1.0';
|
||||
imports.gi.versions.NMA4 = '1.0';
|
||||
imports.gi.versions.Pango = '1.0';
|
||||
imports.gi.versions.Polkit = '1.0';
|
||||
imports.gi.versions.PolkitAgent = '1.0';
|
||||
imports.gi.versions.Rsvg = '2.0';
|
||||
imports.gi.versions.Soup = '3.0';
|
||||
imports.gi.versions.TelepathyGLib = '0.12';
|
||||
imports.gi.versions.TelepathyLogger = '0.2';
|
||||
imports.gi.versions.UPowerGlib = '1.0';
|
||||
import gi from 'gi';
|
||||
|
||||
/**
|
||||
* Required dependencies
|
||||
*/
|
||||
|
||||
import 'gi://AccountsService?version=1.0';
|
||||
import 'gi://Atk?version=1.0';
|
||||
import 'gi://Atspi?version=2.0';
|
||||
import 'gi://Gcr?version=4';
|
||||
import 'gi://Gdk?version=4.0';
|
||||
import 'gi://Gdm?version=1.0';
|
||||
import 'gi://Geoclue?version=2.0';
|
||||
import 'gi://Gio?version=2.0';
|
||||
import 'gi://GDesktopEnums?version=3.0';
|
||||
import 'gi://GdkPixbuf?version=2.0';
|
||||
import 'gi://GnomeBG?version=4.0';
|
||||
import 'gi://GnomeDesktop?version=4.0';
|
||||
import 'gi://Graphene?version=1.0';
|
||||
import 'gi://GWeather?version=4.0';
|
||||
import 'gi://IBus?version=1.0';
|
||||
import 'gi://Pango?version=1.0';
|
||||
import 'gi://Polkit?version=1.0';
|
||||
import 'gi://PolkitAgent?version=1.0';
|
||||
import 'gi://Rsvg?version=2.0';
|
||||
import 'gi://Soup?version=3.0';
|
||||
import 'gi://UPowerGlib?version=1.0';
|
||||
|
||||
const Config = imports.misc.config;
|
||||
|
||||
imports.gi.versions.Meta = Config.LIBMUTTER_API_VERSION;
|
||||
imports.gi.versions.Clutter = Config.LIBMUTTER_API_VERSION;
|
||||
imports.gi.versions.Cogl = Config.LIBMUTTER_API_VERSION;
|
||||
imports.gi.versions.Shell = Config.LIBMUTTER_API_VERSION;
|
||||
imports.gi.versions.St = Config.LIBMUTTER_API_VERSION;
|
||||
// Meta-related dependencies use a shared version
|
||||
// from the compile-time config.
|
||||
gi.require('Meta', Config.LIBMUTTER_API_VERSION);
|
||||
gi.require('Clutter', Config.LIBMUTTER_API_VERSION);
|
||||
gi.require('Cogl', Config.LIBMUTTER_API_VERSION);
|
||||
gi.require('Shell', Config.LIBMUTTER_API_VERSION);
|
||||
gi.require('St', Config.LIBMUTTER_API_VERSION);
|
||||
|
||||
/**
|
||||
* Compile-time optional dependencies
|
||||
*/
|
||||
|
||||
if (Config.HAVE_BLUETOOTH)
|
||||
gi.require('GnomeBluetooth', '3.0');
|
||||
else
|
||||
console.debug('GNOME Shell was compiled without GNOME Bluetooth support');
|
||||
|
||||
|
||||
if (Config.HAVE_NETWORKMANAGER) {
|
||||
gi.require('NM', '1.0');
|
||||
gi.require('NMA4', '1.0');
|
||||
} else {
|
||||
console.debug('GNOME Shell was compiled without Network Manager support');
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime optional dependencies
|
||||
*/
|
||||
|
||||
try {
|
||||
// Malcontent is optional, so catch any errors loading it
|
||||
gi.require('Malcontent', '0');
|
||||
} catch {
|
||||
console.debug('Malcontent is not available, parental controls integration will be disabled.');
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// Telepathy is optional, so catch any errors loading it
|
||||
gi.require('TelepathyGLib', '0.12');
|
||||
gi.require('TelepathyLogger', '0.2');
|
||||
} catch {
|
||||
console.debug('Telepathy is not available, chat integration will be disabled.');
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ try {
|
||||
Gio._promisify(Tp.TextChannel.prototype, 'send_message_async');
|
||||
Gio._promisify(Tp.ChannelDispatchOperation.prototype, 'claim_with_async');
|
||||
Gio._promisify(Tpl.LogManager.prototype, 'get_filtered_events_async');
|
||||
} catch (e) {
|
||||
log('Telepathy is not available, chat integration will be disabled.');
|
||||
} catch {
|
||||
console.debug('Skipping chat support, telepathy not found');
|
||||
}
|
||||
|
||||
const History = imports.misc.history;
|
||||
|
Loading…
Reference in New Issue
Block a user