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;
}
var Application = GObject.registerClass({
GTypeName: 'ExtensionPrefs_Application'
}, class Application extends Gtk.Application {
var Application = GObject.registerClass(
class Application extends Gtk.Application {
_init() {
GLib.set_prgname('gnome-shell-extension-prefs');
super._init({

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,9 +17,8 @@ const RfkillManagerProxy = Gio.DBusProxy.makeProxyWrapper(RfkillManagerInterface
const HAD_BLUETOOTH_DEVICES_SETUP = 'had-bluetooth-devices-setup';
var Indicator = GObject.registerClass({
GTypeName: 'Bluetooth_Indicator'
}, class Indicator extends PanelMenu.SystemIndicator {
var Indicator = GObject.registerClass(
class Indicator extends PanelMenu.SystemIndicator {
_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 BrightnessProxy = Gio.DBusProxy.makeProxyWrapper(BrightnessInterface);
var Indicator = GObject.registerClass({
GTypeName: 'Brightness_Indicator'
}, class Indicator extends PanelMenu.SystemIndicator {
var Indicator = GObject.registerClass(
class Indicator extends PanelMenu.SystemIndicator {
_init() {
super._init();
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 Indicator = GObject.registerClass({
GTypeName: 'Location_Indicator'
}, class Indicator extends PanelMenu.SystemIndicator {
var Indicator = GObject.registerClass(
class Indicator extends PanelMenu.SystemIndicator {
_init() {
super._init();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -347,9 +347,8 @@ var VolumeMenu = class extends PopupMenu.PopupMenuSection {
}
};
var Indicator = GObject.registerClass({
GTypeName: 'Volume_Indicator'
}, class Indicator extends PanelMenu.SystemIndicator {
var Indicator = GObject.registerClass(
class Indicator extends PanelMenu.SystemIndicator {
_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) 2008,2009 Red Hat, Inc.
var Avatar = GObject.registerClass({
GTypeName: 'UserWidget_Avatar'
}, class Avatar extends St.Bin {
var Avatar = GObject.registerClass(
class Avatar extends St.Bin {
_init(user, params) {
let themeContext = St.ThemeContext.get_for_stage(global.stage);
params = Params.parse(params, { reactive: false,

View File

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

View File

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