js: Port to modules
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
This commit is contained in:

committed by
Florian Müllner

parent
d9198317ae
commit
a751e213f6
@ -1,23 +1,22 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Component */
|
||||
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const Params = imports.misc.params;
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import * as Params from '../../misc/params.js';
|
||||
|
||||
const GnomeSession = imports.misc.gnomeSession;
|
||||
const Main = imports.ui.main;
|
||||
const ShellMountOperation = imports.ui.shellMountOperation;
|
||||
import * as GnomeSession from '../../misc/gnomeSession.js';
|
||||
import * as Main from '../main.js';
|
||||
import * as ShellMountOperation from '../shellMountOperation.js';
|
||||
|
||||
var GNOME_SESSION_AUTOMOUNT_INHIBIT = 16;
|
||||
const GNOME_SESSION_AUTOMOUNT_INHIBIT = 16;
|
||||
|
||||
// GSettings keys
|
||||
const SETTINGS_SCHEMA = 'org.gnome.desktop.media-handling';
|
||||
const SETTING_ENABLE_AUTOMOUNT = 'automount';
|
||||
|
||||
var AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
|
||||
const AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
|
||||
|
||||
var AutomountManager = class {
|
||||
class AutomountManager {
|
||||
constructor() {
|
||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||
this._activeOperations = new Map();
|
||||
@ -253,5 +252,6 @@ var AutomountManager = class {
|
||||
volume._allowAutorunExpireId = id;
|
||||
GLib.Source.set_name_by_id(id, '[gnome-shell] volume.allowAutorun');
|
||||
}
|
||||
};
|
||||
var Component = AutomountManager;
|
||||
}
|
||||
|
||||
export {AutomountManager as Component};
|
||||
|
@ -1,18 +1,17 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Component */
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GObject = imports.gi.GObject;
|
||||
const St = imports.gi.St;
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Gio from 'gi://Gio';
|
||||
import GObject from 'gi://GObject';
|
||||
import St from 'gi://St';
|
||||
|
||||
const GnomeSession = imports.misc.gnomeSession;
|
||||
const Main = imports.ui.main;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
import * as GnomeSession from '../../misc/gnomeSession.js';
|
||||
import * as Main from '../main.js';
|
||||
import * as MessageTray from '../messageTray.js';
|
||||
|
||||
Gio._promisify(Gio.Mount.prototype, 'guess_content_type');
|
||||
|
||||
const { loadInterfaceXML } = imports.misc.fileUtils;
|
||||
import {loadInterfaceXML} from '../../misc/fileUtils.js';
|
||||
|
||||
// GSettings keys
|
||||
const SETTINGS_SCHEMA = 'org.gnome.desktop.media-handling';
|
||||
@ -22,7 +21,7 @@ const SETTING_IGNORE = 'autorun-x-content-ignore';
|
||||
const SETTING_OPEN_FOLDER = 'autorun-x-content-open-folder';
|
||||
|
||||
/** @enum {number} */
|
||||
var AutorunSetting = {
|
||||
const AutorunSetting = {
|
||||
RUN: 0,
|
||||
IGNORE: 1,
|
||||
FILES: 2,
|
||||
@ -86,7 +85,7 @@ function HotplugSniffer() {
|
||||
'/org/gnome/Shell/HotplugSniffer');
|
||||
}
|
||||
|
||||
var ContentTypeDiscoverer = class {
|
||||
class ContentTypeDiscoverer {
|
||||
constructor() {
|
||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||
}
|
||||
@ -127,9 +126,9 @@ var ContentTypeDiscoverer = class {
|
||||
|
||||
return [apps, contentTypes];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var AutorunManager = class {
|
||||
class AutorunManager {
|
||||
constructor() {
|
||||
this._session = new GnomeSession.SessionManager();
|
||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||
@ -161,9 +160,9 @@ var AutorunManager = class {
|
||||
_onMountRemoved(monitor, mount) {
|
||||
this._dispatcher.removeMount(mount);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var AutorunDispatcher = class {
|
||||
class AutorunDispatcher {
|
||||
constructor(manager) {
|
||||
this._manager = manager;
|
||||
this._sources = [];
|
||||
@ -255,9 +254,9 @@ var AutorunDispatcher = class {
|
||||
// destroy the notification source
|
||||
source.destroy();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var AutorunSource = GObject.registerClass(
|
||||
const AutorunSource = GObject.registerClass(
|
||||
class AutorunSource extends MessageTray.Source {
|
||||
_init(manager, mount, apps) {
|
||||
super._init(mount.get_name());
|
||||
@ -282,7 +281,7 @@ class AutorunSource extends MessageTray.Source {
|
||||
}
|
||||
});
|
||||
|
||||
var AutorunNotification = GObject.registerClass(
|
||||
const AutorunNotification = GObject.registerClass(
|
||||
class AutorunNotification extends MessageTray.Notification {
|
||||
_init(manager, source) {
|
||||
super._init(source, source.title);
|
||||
@ -346,4 +345,4 @@ class AutorunNotification extends MessageTray.Notification {
|
||||
}
|
||||
});
|
||||
|
||||
var Component = AutorunManager;
|
||||
export {AutorunManager as Component};
|
||||
|
@ -1,21 +1,20 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Component */
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Gcr = imports.gi.Gcr;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GObject = imports.gi.GObject;
|
||||
const Pango = imports.gi.Pango;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Gcr from 'gi://Gcr';
|
||||
import Gio from 'gi://Gio';
|
||||
import GObject from 'gi://GObject';
|
||||
import Pango from 'gi://Pango';
|
||||
import Shell from 'gi://Shell';
|
||||
import St from 'gi://St';
|
||||
|
||||
const Dialog = imports.ui.dialog;
|
||||
const ModalDialog = imports.ui.modalDialog;
|
||||
const ShellEntry = imports.ui.shellEntry;
|
||||
const CheckBox = imports.ui.checkBox;
|
||||
const {wiggle} = imports.misc.animationUtils;
|
||||
import * as Dialog from '../dialog.js';
|
||||
import * as ModalDialog from '../modalDialog.js';
|
||||
import * as ShellEntry from '../shellEntry.js';
|
||||
import * as CheckBox from '../checkBox.js';
|
||||
import {wiggle} from '../misc/animationUtils.js';
|
||||
|
||||
var KeyringDialog = GObject.registerClass(
|
||||
const KeyringDialog = GObject.registerClass(
|
||||
class KeyringDialog extends ModalDialog.ModalDialog {
|
||||
_init() {
|
||||
super._init({ styleClass: 'prompt-dialog' });
|
||||
@ -184,7 +183,7 @@ class KeyringDialog extends ModalDialog.ModalDialog {
|
||||
}
|
||||
});
|
||||
|
||||
var KeyringDummyDialog = class {
|
||||
class KeyringDummyDialog {
|
||||
constructor() {
|
||||
this.prompt = new Shell.KeyringPrompt();
|
||||
this.prompt.connect('show-password', this._cancelPrompt.bind(this));
|
||||
@ -194,9 +193,9 @@ var KeyringDummyDialog = class {
|
||||
_cancelPrompt() {
|
||||
this.prompt.cancel();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var KeyringPrompter = GObject.registerClass(
|
||||
const KeyringPrompter = GObject.registerClass(
|
||||
class KeyringPrompter extends Gcr.SystemPrompter {
|
||||
_init() {
|
||||
super._init();
|
||||
@ -232,4 +231,4 @@ class KeyringPrompter extends Gcr.SystemPrompter {
|
||||
}
|
||||
});
|
||||
|
||||
var Component = KeyringPrompter;
|
||||
export {KeyringPrompter as Component};
|
||||
|
@ -1,28 +1,27 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Component */
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
const NM = imports.gi.NM;
|
||||
const Pango = imports.gi.Pango;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
const Signals = imports.misc.signals;
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
import NM from 'gi://NM';
|
||||
import Pango from 'gi://Pango';
|
||||
import Shell from 'gi://Shell';
|
||||
import St from 'gi://St';
|
||||
import * as Signals from '../../misc/signals.js';
|
||||
|
||||
const Dialog = imports.ui.dialog;
|
||||
const Main = imports.ui.main;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const ModalDialog = imports.ui.modalDialog;
|
||||
const ShellEntry = imports.ui.shellEntry;
|
||||
import * as Dialog from '../dialog.js';
|
||||
import * as Main from '../main.js';
|
||||
import * as MessageTray from '../messageTray.js';
|
||||
import * as ModalDialog from '../modalDialog.js';
|
||||
import * as ShellEntry from '../shellEntry.js';
|
||||
|
||||
Gio._promisify(Shell.NetworkAgent.prototype, 'init_async');
|
||||
Gio._promisify(Shell.NetworkAgent.prototype, 'search_vpn_plugin');
|
||||
|
||||
const VPN_UI_GROUP = 'VPN Plugin UI';
|
||||
|
||||
var NetworkSecretDialog = GObject.registerClass(
|
||||
const NetworkSecretDialog = GObject.registerClass(
|
||||
class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
||||
_init(agent, requestId, connection, settingName, hints, flags, contentOverride) {
|
||||
super._init({ styleClass: 'prompt-dialog' });
|
||||
@ -418,7 +417,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
|
||||
}
|
||||
});
|
||||
|
||||
var VPNRequestHandler = class extends Signals.EventEmitter {
|
||||
class VPNRequestHandler extends Signals.EventEmitter {
|
||||
constructor(agent, requestId, authHelper, serviceType, connection, hints, flags) {
|
||||
super();
|
||||
|
||||
@ -676,9 +675,9 @@ var VPNRequestHandler = class extends Signals.EventEmitter {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var NetworkAgent = class {
|
||||
class NetworkAgent {
|
||||
constructor() {
|
||||
this._native = new Shell.NetworkAgent({
|
||||
identifier: 'org.gnome.Shell.NetworkAgent',
|
||||
@ -880,5 +879,6 @@ var NetworkAgent = class {
|
||||
externalUIMode: ['true', 'yes', 'on', '1'].includes(trimmedProp),
|
||||
};
|
||||
}
|
||||
};
|
||||
var Component = NetworkAgent;
|
||||
}
|
||||
|
||||
export {NetworkAgent as Component};
|
||||
|
@ -1,22 +1,21 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Component */
|
||||
|
||||
const AccountsService = imports.gi.AccountsService;
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
const Pango = imports.gi.Pango;
|
||||
const PolkitAgent = imports.gi.PolkitAgent;
|
||||
const Polkit = imports.gi.Polkit;
|
||||
const Shell = imports.gi.Shell;
|
||||
const St = imports.gi.St;
|
||||
import AccountsService from 'gi://AccountsService';
|
||||
import Clutter from 'gi://Clutter';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
import Pango from 'gi://Pango';
|
||||
import PolkitAgent from 'gi://PolkitAgent';
|
||||
import Polkit from 'gi://Polkit';
|
||||
import Shell from 'gi://Shell';
|
||||
import St from 'gi://St';
|
||||
|
||||
const Dialog = imports.ui.dialog;
|
||||
const Main = imports.ui.main;
|
||||
const ModalDialog = imports.ui.modalDialog;
|
||||
const ShellEntry = imports.ui.shellEntry;
|
||||
const UserWidget = imports.ui.userWidget;
|
||||
const {wiggle} = imports.misc.animationUtils;
|
||||
import * as Dialog from '../dialog.js';
|
||||
import * as Main from '../main.js';
|
||||
import * as ModalDialog from '../modalDialog.js';
|
||||
import * as ShellEntry from '../shellEntry.js';
|
||||
import * as UserWidget from '../userWidget.js';
|
||||
import {wiggle} from '../misc/animationUtils.js';
|
||||
|
||||
/** @enum {number} */
|
||||
const DialogMode = {
|
||||
@ -28,7 +27,7 @@ const DIALOG_ICON_SIZE = 64;
|
||||
|
||||
const DELAYED_RESET_TIMEOUT = 200;
|
||||
|
||||
var AuthenticationDialog = GObject.registerClass({
|
||||
const AuthenticationDialog = GObject.registerClass({
|
||||
Signals: { 'done': { param_types: [GObject.TYPE_BOOLEAN] } },
|
||||
}, class AuthenticationDialog extends ModalDialog.ModalDialog {
|
||||
_init(actionId, description, cookie, userNames) {
|
||||
@ -414,7 +413,7 @@ var AuthenticationDialog = GObject.registerClass({
|
||||
}
|
||||
});
|
||||
|
||||
var AuthenticationAgent = GObject.registerClass(
|
||||
const AuthenticationAgent = GObject.registerClass(
|
||||
class AuthenticationAgent extends Shell.PolkitAuthenticationAgent {
|
||||
_init() {
|
||||
super._init();
|
||||
@ -474,4 +473,4 @@ class AuthenticationAgent extends Shell.PolkitAuthenticationAgent {
|
||||
}
|
||||
});
|
||||
|
||||
var Component = AuthenticationAgent;
|
||||
export {AuthenticationAgent as Component};
|
||||
|
@ -1,16 +1,15 @@
|
||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
/* exported Component */
|
||||
import Clutter from 'gi://Clutter';
|
||||
import Gio from 'gi://Gio';
|
||||
import GLib from 'gi://GLib';
|
||||
import GObject from 'gi://GObject';
|
||||
import St from 'gi://St';
|
||||
|
||||
const Clutter = imports.gi.Clutter;
|
||||
const Gio = imports.gi.Gio;
|
||||
const GLib = imports.gi.GLib;
|
||||
const GObject = imports.gi.GObject;
|
||||
const St = imports.gi.St;
|
||||
|
||||
var Tpl = null;
|
||||
var Tp = null;
|
||||
let Tpl = null;
|
||||
let Tp = null;
|
||||
try {
|
||||
({ TelepathyGLib: Tp, TelepathyLogger: Tpl } = imports.gi);
|
||||
({default: Tp} = await import('gi://TelepathyGlib'));
|
||||
({default: Tpl} = await import('gi://TelepathyLogger'));
|
||||
|
||||
Gio._promisify(Tp.Channel.prototype, 'close_async');
|
||||
Gio._promisify(Tp.TextChannel.prototype, 'send_message_async');
|
||||
@ -20,30 +19,30 @@ try {
|
||||
console.debug('Skipping chat support, telepathy not found');
|
||||
}
|
||||
|
||||
const History = imports.misc.history;
|
||||
const Main = imports.ui.main;
|
||||
const MessageList = imports.ui.messageList;
|
||||
const MessageTray = imports.ui.messageTray;
|
||||
const Params = imports.misc.params;
|
||||
const Util = imports.misc.util;
|
||||
import * as History from '../../misc/history.js';
|
||||
import * as Main from '../main.js';
|
||||
import * as MessageList from '../messageList.js';
|
||||
import * as MessageTray from '../messageTray.js';
|
||||
import * as Params from '../../misc/params.js';
|
||||
import * as Util from '../../misc/util.js';
|
||||
|
||||
const HAVE_TP = Tp != null && Tpl != null;
|
||||
|
||||
// See Notification.appendMessage
|
||||
var SCROLLBACK_IMMEDIATE_TIME = 3 * 60; // 3 minutes
|
||||
var SCROLLBACK_RECENT_TIME = 15 * 60; // 15 minutes
|
||||
var SCROLLBACK_RECENT_LENGTH = 20;
|
||||
var SCROLLBACK_IDLE_LENGTH = 5;
|
||||
const SCROLLBACK_IMMEDIATE_TIME = 3 * 60; // 3 minutes
|
||||
const SCROLLBACK_RECENT_TIME = 15 * 60; // 15 minutes
|
||||
const SCROLLBACK_RECENT_LENGTH = 20;
|
||||
const SCROLLBACK_IDLE_LENGTH = 5;
|
||||
|
||||
// See Source._displayPendingMessages
|
||||
var SCROLLBACK_HISTORY_LINES = 10;
|
||||
const SCROLLBACK_HISTORY_LINES = 10;
|
||||
|
||||
// See Notification._onEntryChanged
|
||||
var COMPOSING_STOP_TIMEOUT = 5;
|
||||
const COMPOSING_STOP_TIMEOUT = 5;
|
||||
|
||||
var CHAT_EXPAND_LINES = 12;
|
||||
const CHAT_EXPAND_LINES = 12;
|
||||
|
||||
var NotificationDirection = {
|
||||
const NotificationDirection = {
|
||||
SENT: 'chat-sent',
|
||||
RECEIVED: 'chat-received',
|
||||
};
|
||||
@ -101,7 +100,7 @@ const ChatMessage = HAVE_TP ? GObject.registerClass({
|
||||
}) : null;
|
||||
|
||||
|
||||
var TelepathyComponent = class {
|
||||
class TelepathyComponent {
|
||||
constructor() {
|
||||
this._client = null;
|
||||
|
||||
@ -131,9 +130,9 @@ var TelepathyComponent = class {
|
||||
|
||||
this._client.unregister();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var TelepathyClient = HAVE_TP ? GObject.registerClass(
|
||||
const TelepathyClient = HAVE_TP ? GObject.registerClass(
|
||||
class TelepathyClient extends Tp.BaseClient {
|
||||
_init() {
|
||||
// channel path -> ChatSource
|
||||
@ -306,7 +305,7 @@ class TelepathyClient extends Tp.BaseClient {
|
||||
}
|
||||
}) : null;
|
||||
|
||||
var ChatSource = HAVE_TP ? GObject.registerClass(
|
||||
const ChatSource = HAVE_TP ? GObject.registerClass(
|
||||
class ChatSource extends MessageTray.Source {
|
||||
_init(account, conn, channel, contact, client) {
|
||||
this._account = account;
|
||||
@ -666,7 +665,7 @@ class ChatNotificationMessage extends GObject.Object {
|
||||
}
|
||||
}) : null;
|
||||
|
||||
var ChatNotification = HAVE_TP ? GObject.registerClass({
|
||||
const ChatNotification = HAVE_TP ? GObject.registerClass({
|
||||
Signals: {
|
||||
'message-removed': { param_types: [ChatNotificationMessage.$gtype] },
|
||||
'message-added': { param_types: [ChatNotificationMessage.$gtype] },
|
||||
@ -841,7 +840,7 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
|
||||
}
|
||||
}) : null;
|
||||
|
||||
var ChatLineBox = GObject.registerClass(
|
||||
const ChatLineBox = GObject.registerClass(
|
||||
class ChatLineBox extends St.BoxLayout {
|
||||
vfunc_get_preferred_height(forWidth) {
|
||||
let [, natHeight] = super.vfunc_get_preferred_height(forWidth);
|
||||
@ -849,7 +848,7 @@ class ChatLineBox extends St.BoxLayout {
|
||||
}
|
||||
});
|
||||
|
||||
var ChatNotificationBanner = GObject.registerClass(
|
||||
const ChatNotificationBanner = GObject.registerClass(
|
||||
class ChatNotificationBanner extends MessageTray.NotificationBanner {
|
||||
_init(notification) {
|
||||
super._init(notification);
|
||||
@ -1020,4 +1019,4 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
|
||||
}
|
||||
});
|
||||
|
||||
var Component = TelepathyComponent;
|
||||
export const Component = TelepathyComponent;
|
||||
|
Reference in New Issue
Block a user