js: Use Gjs GTypeName computation for all classes

As per previous commit we can remove the explicit GTypeName definitions
and use gjs auto computation for all the GObject registered classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/790
This commit is contained in:
Marco Trevisan (Treviño) 2019-10-28 19:35:33 +01:00 committed by Florian Müllner
parent 91707f4f82
commit 39e6fc9e9d
26 changed files with 34 additions and 73 deletions

View File

@ -23,9 +23,8 @@ function stripPrefix(string, prefix) {
return string; return string;
} }
var Application = GObject.registerClass({ var Application = GObject.registerClass(
GTypeName: 'ExtensionPrefs_Application' class Application extends Gtk.Application {
}, class Application extends Gtk.Application {
_init() { _init() {
GLib.set_prgname('gnome-shell-extension-prefs'); GLib.set_prgname('gnome-shell-extension-prefs');
super._init({ super._init({

View File

@ -39,7 +39,6 @@ const _LOGO_ICON_HEIGHT = 48;
const _MAX_BOTTOM_MENU_ITEMS = 5; const _MAX_BOTTOM_MENU_ITEMS = 5;
var UserListItem = GObject.registerClass({ var UserListItem = GObject.registerClass({
GTypeName: 'LoginDialog_UserListItem',
Signals: { 'activate': {} } Signals: { 'activate': {} }
}, class UserListItem extends St.Button { }, class UserListItem extends St.Button {
_init(user) { _init(user) {
@ -155,7 +154,6 @@ var UserListItem = GObject.registerClass({
}); });
var UserList = GObject.registerClass({ var UserList = GObject.registerClass({
GTypeName: 'LoginDialog_UserList',
Signals: { Signals: {
'activate': { param_types: [UserListItem.$gtype] }, 'activate': { param_types: [UserListItem.$gtype] },
'item-added': { param_types: [UserListItem.$gtype] }, 'item-added': { param_types: [UserListItem.$gtype] },
@ -303,7 +301,6 @@ var UserList = GObject.registerClass({
}); });
var SessionMenuButton = GObject.registerClass({ var SessionMenuButton = GObject.registerClass({
GTypeName: 'LoginDialog_SessionMenuButton',
Signals: { 'session-activated': { param_types: [GObject.TYPE_STRING] } } Signals: { 'session-activated': { param_types: [GObject.TYPE_STRING] } }
}, class SessionMenuButton extends St.Bin { }, class SessionMenuButton extends St.Bin {
_init() { _init() {

View File

@ -647,9 +647,8 @@ class WindowCyclerPopup extends CyclerPopup {
} }
}); });
var AppIcon = GObject.registerClass({ var AppIcon = GObject.registerClass(
GTypeName: 'AltTab_AppIcon' class AppIcon extends St.BoxLayout {
}, class AppIcon extends St.BoxLayout {
_init(app) { _init(app) {
super._init({ style_class: 'alt-tab-app', super._init({ style_class: 'alt-tab-app',
vertical: true }); vertical: true });

View File

@ -1451,7 +1451,6 @@ class FolderView extends BaseAppView {
}); });
var FolderIcon = GObject.registerClass({ var FolderIcon = GObject.registerClass({
GTypeName: 'AppDisplay_FolderIcon',
Signals: { Signals: {
'apps-changed': {}, 'apps-changed': {},
'name-changed': {}, 'name-changed': {},
@ -1875,7 +1874,6 @@ var RenameFolderMenu = class RenameFolderMenu extends PopupMenu.PopupMenu {
Signals.addSignalMethods(RenameFolderMenu.prototype); Signals.addSignalMethods(RenameFolderMenu.prototype);
var AppFolderPopup = GObject.registerClass({ var AppFolderPopup = GObject.registerClass({
GTypeName: 'AppDisplay_AppFolderPopup',
Signals: { Signals: {
'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, 'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] },
} }
@ -2047,7 +2045,6 @@ var AppFolderPopup = GObject.registerClass({
}); });
var AppIcon = GObject.registerClass({ var AppIcon = GObject.registerClass({
GTypeName: 'AppDisplay_AppIcon',
Signals: { Signals: {
'menu-state-changed': { param_types: [GObject.TYPE_BOOLEAN] }, 'menu-state-changed': { param_types: [GObject.TYPE_BOOLEAN] },
'sync-tooltip': {}, 'sync-tooltip': {},

View File

@ -274,9 +274,8 @@ class ObjLink extends St.Button {
} }
}); });
var Result = GObject.registerClass({ var Result = GObject.registerClass(
GTypeName: 'LookingClass_Result' class Result extends St.BoxLayout {
}, class Result extends St.BoxLayout {
_init(lookingGlass, command, o, index) { _init(lookingGlass, command, o, index) {
super._init({ vertical: true }); super._init({ vertical: true });
@ -299,7 +298,6 @@ var Result = GObject.registerClass({
}); });
var WindowList = GObject.registerClass({ var WindowList = GObject.registerClass({
GTypeName: 'LookingClass_WindowList'
}, class WindowList extends St.BoxLayout { }, class WindowList extends St.BoxLayout {
_init(lookingGlass) { _init(lookingGlass) {
super._init({ name: 'Windows', vertical: true, style: 'spacing: 8px' }); super._init({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
@ -632,7 +630,6 @@ var Inspector = GObject.registerClass({
}); });
var Extensions = GObject.registerClass({ var Extensions = GObject.registerClass({
GTypeName: 'LookingClass_Extensions'
}, class Extensions extends St.BoxLayout { }, class Extensions extends St.BoxLayout {
_init(lookingGlass) { _init(lookingGlass) {
super._init({ vertical: true, name: 'lookingGlassExtensions' }); super._init({ vertical: true, name: 'lookingGlassExtensions' });

View File

@ -295,7 +295,6 @@ var LabelExpanderLayout = GObject.registerClass({
var Message = GObject.registerClass({ var Message = GObject.registerClass({
GTypeName: 'MessageList_Message',
Signals: { Signals: {
'close': {}, 'close': {},
'expanded': {}, 'expanded': {},

View File

@ -134,7 +134,6 @@ var FocusGrabber = class FocusGrabber {
// //
// A notification without a policy object will inherit the default one. // A notification without a policy object will inherit the default one.
var NotificationPolicy = GObject.registerClass({ var NotificationPolicy = GObject.registerClass({
GTypeName: 'MessageTray_NotificationPolicy',
Properties: { Properties: {
'enable': GObject.ParamSpec.boolean( 'enable': GObject.ParamSpec.boolean(
'enable', 'enable', 'enable', 'enable', 'enable', 'enable',
@ -192,7 +191,6 @@ var NotificationPolicy = GObject.registerClass({
}); });
var NotificationGenericPolicy = GObject.registerClass({ var NotificationGenericPolicy = GObject.registerClass({
GTypeName: 'MessageTray_NotificationGenericPolicy'
}, class NotificationGenericPolicy extends NotificationPolicy { }, class NotificationGenericPolicy extends NotificationPolicy {
_init() { _init() {
super._init(); super._init();
@ -223,7 +221,6 @@ var NotificationGenericPolicy = GObject.registerClass({
}); });
var NotificationApplicationPolicy = GObject.registerClass({ var NotificationApplicationPolicy = GObject.registerClass({
GTypeName: 'MessageTray_NotificationApplicationPolicy'
}, class NotificationApplicationPolicy extends NotificationPolicy { }, class NotificationApplicationPolicy extends NotificationPolicy {
_init(id) { _init(id) {
super._init(); super._init();
@ -350,7 +347,6 @@ var NotificationApplicationPolicy = GObject.registerClass({
// //
// [1] https://developer.gnome.org/notification-spec/#markup // [1] https://developer.gnome.org/notification-spec/#markup
var Notification = GObject.registerClass({ var Notification = GObject.registerClass({
GTypeName: 'MessageTray_Notification',
Properties: { Properties: {
'acknowledged': GObject.ParamSpec.boolean( 'acknowledged': GObject.ParamSpec.boolean(
'acknowledged', 'acknowledged', 'acknowledged', 'acknowledged', 'acknowledged', 'acknowledged',
@ -733,7 +729,6 @@ class SourceActorWithLabel extends SourceActor {
}); });
var Source = GObject.registerClass({ var Source = GObject.registerClass({
GTypeName: 'MessageTray_Source',
Properties: { Properties: {
'count': GObject.ParamSpec.int( 'count': GObject.ParamSpec.int(
'count', 'count', 'count', 'count', 'count', 'count',

View File

@ -89,7 +89,6 @@ var PadChooser = GObject.registerClass({
}); });
var KeybindingEntry = GObject.registerClass({ var KeybindingEntry = GObject.registerClass({
GTypeName: 'PadOsd_KeybindingEntry',
Signals: { 'keybinding-edited': {} } Signals: { 'keybinding-edited': {} }
}, class KeybindingEntry extends St.Entry { }, class KeybindingEntry extends St.Entry {
_init() { _init() {
@ -111,7 +110,6 @@ var KeybindingEntry = GObject.registerClass({
}); });
var ActionComboBox = GObject.registerClass({ var ActionComboBox = GObject.registerClass({
GTypeName: 'PadOsd_ActionComboBox',
Signals: { 'action-selected': { param_types: [GObject.TYPE_INT] } } Signals: { 'action-selected': { param_types: [GObject.TYPE_INT] } }
}, class ActionComboBox extends St.Button { }, class ActionComboBox extends St.Button {
_init() { _init() {
@ -194,7 +192,6 @@ var ActionComboBox = GObject.registerClass({
}); });
var ActionEditor = GObject.registerClass({ var ActionEditor = GObject.registerClass({
GTypeName: 'PadOsd_ActionEditor',
Signals: { 'done': {} } Signals: { 'done': {} }
}, class ActionEditor extends St.Widget { }, class ActionEditor extends St.Widget {
_init() { _init() {

View File

@ -195,9 +195,8 @@ var Button = GObject.registerClass({
* of an icon and a menu section, which will be composed into the * of an icon and a menu section, which will be composed into the
* aggregate menu. * aggregate menu.
*/ */
var SystemIndicator = GObject.registerClass({ var SystemIndicator = GObject.registerClass(
GTypeName: 'PanelMenu_SystemIndicator', class SystemIndicator extends St.BoxLayout {
}, class SystemIndicator extends St.BoxLayout {
_init() { _init() {
super._init({ super._init({
style_class: 'panel-status-indicators-box', style_class: 'panel-status-indicators-box',

View File

@ -219,7 +219,6 @@ var ScreenshotService = class {
}; };
var SelectArea = GObject.registerClass({ var SelectArea = GObject.registerClass({
GTypeName: 'Screenshot_SelectArea',
Signals: { 'finished': { param_types: [Meta.Rectangle.$gtype] } } Signals: { 'finished': { param_types: [Meta.Rectangle.$gtype] } }
}, class SelectArea extends St.Widget { }, class SelectArea extends St.Widget {
_init() { _init() {
@ -317,7 +316,6 @@ var SelectArea = GObject.registerClass({
}); });
var PickPixel = GObject.registerClass({ var PickPixel = GObject.registerClass({
GTypeName: 'Screenshot_PickPixel',
Signals: { 'finished': { param_types: [Graphene.Point.$gtype] } } Signals: { 'finished': { param_types: [Graphene.Point.$gtype] } }
}, class PickPixel extends St.Widget { }, class PickPixel extends St.Widget {
_init() { _init() {

View File

@ -44,7 +44,6 @@ function _setLabelsForMessage(content, message) {
/* -------------------------------------------------------- */ /* -------------------------------------------------------- */
var ListItem = GObject.registerClass({ var ListItem = GObject.registerClass({
GTypeName: 'ShellMountOperation_ListItem',
Signals: { 'activate': {} } Signals: { 'activate': {} }
}, class ListItem extends St.Button { }, class ListItem extends St.Button {
_init(app) { _init(app) {

View File

@ -17,9 +17,8 @@ const RfkillManagerProxy = Gio.DBusProxy.makeProxyWrapper(RfkillManagerInterface
const HAD_BLUETOOTH_DEVICES_SETUP = 'had-bluetooth-devices-setup'; const HAD_BLUETOOTH_DEVICES_SETUP = 'had-bluetooth-devices-setup';
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Bluetooth_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -15,9 +15,8 @@ const OBJECT_PATH = '/org/gnome/SettingsDaemon/Power';
const BrightnessInterface = loadInterfaceXML('org.gnome.SettingsDaemon.Power.Screen'); const BrightnessInterface = loadInterfaceXML('org.gnome.SettingsDaemon.Power.Screen');
const BrightnessProxy = Gio.DBusProxy.makeProxyWrapper(BrightnessInterface); const BrightnessProxy = Gio.DBusProxy.makeProxyWrapper(BrightnessInterface);
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Brightness_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,

View File

@ -42,9 +42,8 @@ const GeoclueManager = Gio.DBusProxy.makeProxyWrapper(GeoclueIface);
var AgentIface = loadInterfaceXML('org.freedesktop.GeoClue2.Agent'); var AgentIface = loadInterfaceXML('org.freedesktop.GeoClue2.Agent');
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Location_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -1591,9 +1591,8 @@ var DeviceCategory = class extends PopupMenu.PopupMenuSection {
} }
}; };
var NMApplet = GObject.registerClass({ var NMApplet = GObject.registerClass(
GTypeName: 'Network_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -15,9 +15,8 @@ const OBJECT_PATH = '/org/gnome/SettingsDaemon/Color';
const ColorInterface = loadInterfaceXML('org.gnome.SettingsDaemon.Color'); const ColorInterface = loadInterfaceXML('org.gnome.SettingsDaemon.Color');
const ColorProxy = Gio.DBusProxy.makeProxyWrapper(ColorInterface); const ColorProxy = Gio.DBusProxy.makeProxyWrapper(ColorInterface);
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'NightLight_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -17,9 +17,8 @@ const PowerManagerProxy = Gio.DBusProxy.makeProxyWrapper(DisplayDeviceInterface)
const SHOW_BATTERY_PERCENTAGE = 'show-battery-percentage'; const SHOW_BATTERY_PERCENTAGE = 'show-battery-percentage';
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Power_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -6,9 +6,8 @@ const { GObject, Meta } = imports.gi;
const PanelMenu = imports.ui.panelMenu; const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu; const PopupMenu = imports.ui.popupMenu;
var RemoteAccessApplet = GObject.registerClass({ var RemoteAccessApplet = GObject.registerClass(
GTypeName: 'RemoteAccess_Indicator' class RemoteAccessApplet extends PanelMenu.SystemIndicator {
}, class RemoteAccessApplet extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -61,9 +61,8 @@ function getRfkillManager() {
return _manager; return _manager;
} }
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Rfkill_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -6,9 +6,8 @@ const GObject = imports.gi.GObject;
const Main = imports.ui.main; const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu; const PanelMenu = imports.ui.panelMenu;
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Screencast_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -116,9 +116,8 @@ class AltSwitcher extends St.Bin {
} }
}); });
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'System_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -221,9 +221,8 @@ Signals.addSignalMethods(AuthRobot.prototype);
/* eof client.js */ /* eof client.js */
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Thunderbolt_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -347,9 +347,8 @@ var VolumeMenu = class extends PopupMenu.PopupMenuSection {
} }
}; };
var Indicator = GObject.registerClass({ var Indicator = GObject.registerClass(
GTypeName: 'Volume_Indicator' class Indicator extends PanelMenu.SystemIndicator {
}, class Indicator extends PanelMenu.SystemIndicator {
_init() { _init() {
super._init(); super._init();

View File

@ -14,9 +14,8 @@ var AVATAR_ICON_SIZE = 64;
// Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>. // Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
// Copyright (C) 2008,2009 Red Hat, Inc. // Copyright (C) 2008,2009 Red Hat, Inc.
var Avatar = GObject.registerClass({ var Avatar = GObject.registerClass(
GTypeName: 'UserWidget_Avatar' class Avatar extends St.Bin {
}, class Avatar extends St.Bin {
_init(user, params) { _init(user, params) {
let themeContext = St.ThemeContext.get_for_stage(global.stage); let themeContext = St.ThemeContext.get_for_stage(global.stage);
params = Params.parse(params, { reactive: false, params = Params.parse(params, { reactive: false,

View File

@ -94,7 +94,6 @@ class WindowCloneLayout extends Clutter.LayoutManager {
}); });
var WindowClone = GObject.registerClass({ var WindowClone = GObject.registerClass({
GTypeName: 'Workspace_WindowClone',
Signals: { Signals: {
'drag-begin': {}, 'drag-begin': {},
'drag-cancelled': {}, 'drag-cancelled': {},

View File

@ -44,7 +44,6 @@ class PrimaryActorLayout extends Clutter.FixedLayout {
}); });
var WindowClone = GObject.registerClass({ var WindowClone = GObject.registerClass({
GTypeName: 'WorkspaceThumbnail_WindowClone',
Signals: { Signals: {
'drag-begin': {}, 'drag-begin': {},
'drag-cancelled': {}, 'drag-cancelled': {},