From 39e6fc9e9d948897f141a83b68c206f4db9e4961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 28 Oct 2019 19:35:33 +0100 Subject: [PATCH] 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 --- js/extensionPrefs/main.js | 5 ++--- js/gdm/loginDialog.js | 3 --- js/ui/altTab.js | 5 ++--- js/ui/appDisplay.js | 3 --- js/ui/lookingGlass.js | 7 ++----- js/ui/messageList.js | 1 - js/ui/messageTray.js | 5 ----- js/ui/padOsd.js | 3 --- js/ui/panelMenu.js | 5 ++--- js/ui/screenshot.js | 2 -- js/ui/shellMountOperation.js | 1 - js/ui/status/bluetooth.js | 5 ++--- js/ui/status/brightness.js | 5 ++--- js/ui/status/location.js | 5 ++--- js/ui/status/network.js | 5 ++--- js/ui/status/nightLight.js | 5 ++--- js/ui/status/power.js | 5 ++--- js/ui/status/remoteAccess.js | 5 ++--- js/ui/status/rfkill.js | 5 ++--- js/ui/status/screencast.js | 5 ++--- js/ui/status/system.js | 5 ++--- js/ui/status/thunderbolt.js | 5 ++--- js/ui/status/volume.js | 5 ++--- js/ui/userWidget.js | 5 ++--- js/ui/workspace.js | 1 - js/ui/workspaceThumbnail.js | 1 - 26 files changed, 34 insertions(+), 73 deletions(-) diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index 86afa34ee..bd696523e 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -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({ diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 2c5834d44..1ad5c5dbc 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -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() { diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 2500a45d0..720003035 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -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 }); diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 68dbb7f87..6ff6be735 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -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': {}, diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index cadd4012d..135fa5ec5 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -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' }); diff --git a/js/ui/messageList.js b/js/ui/messageList.js index ba3b3fd2a..5cac1de75 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -295,7 +295,6 @@ var LabelExpanderLayout = GObject.registerClass({ var Message = GObject.registerClass({ - GTypeName: 'MessageList_Message', Signals: { 'close': {}, 'expanded': {}, diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 0d86fc503..2ec8a14f4 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -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', diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index edb4fbea0..1a09420a6 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -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() { diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index f98fd3b9a..8c4c26423 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -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', diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 8f2c29782..db9634364 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -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() { diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index 966a92ec7..2a4de8488 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -44,7 +44,6 @@ function _setLabelsForMessage(content, message) { /* -------------------------------------------------------- */ var ListItem = GObject.registerClass({ - GTypeName: 'ShellMountOperation_ListItem', Signals: { 'activate': {} } }, class ListItem extends St.Button { _init(app) { diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index 355312a70..957669dbb 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -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(); diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js index f33d9dd8b..1abdab47e 100644 --- a/js/ui/status/brightness.js +++ b/js/ui/status/brightness.js @@ -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, diff --git a/js/ui/status/location.js b/js/ui/status/location.js index cbdab434c..f719f7ef9 100644 --- a/js/ui/status/location.js +++ b/js/ui/status/location.js @@ -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(); diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 958473591..b18cef0a7 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -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(); diff --git a/js/ui/status/nightLight.js b/js/ui/status/nightLight.js index 8277530c9..c595c3da0 100644 --- a/js/ui/status/nightLight.js +++ b/js/ui/status/nightLight.js @@ -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(); diff --git a/js/ui/status/power.js b/js/ui/status/power.js index 8aefc5ad4..568cfa035 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -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(); diff --git a/js/ui/status/remoteAccess.js b/js/ui/status/remoteAccess.js index eba686e90..0e13c04cf 100644 --- a/js/ui/status/remoteAccess.js +++ b/js/ui/status/remoteAccess.js @@ -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(); diff --git a/js/ui/status/rfkill.js b/js/ui/status/rfkill.js index 7ba8220d4..88dc2696b 100644 --- a/js/ui/status/rfkill.js +++ b/js/ui/status/rfkill.js @@ -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(); diff --git a/js/ui/status/screencast.js b/js/ui/status/screencast.js index 124236f09..6bc162a8f 100644 --- a/js/ui/status/screencast.js +++ b/js/ui/status/screencast.js @@ -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(); diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 78079a8d5..a4e46ad9c 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -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(); diff --git a/js/ui/status/thunderbolt.js b/js/ui/status/thunderbolt.js index 3c97148d5..c212e8ecd 100644 --- a/js/ui/status/thunderbolt.js +++ b/js/ui/status/thunderbolt.js @@ -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(); diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 53b48a8da..9109121c4 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -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(); diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index 9dcc60f40..9e1f328ee 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -14,9 +14,8 @@ var AVATAR_ICON_SIZE = 64; // Copyright (C) 2004-2005 James M. Cape . // 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, diff --git a/js/ui/workspace.js b/js/ui/workspace.js index dc4c212b3..48329e18e 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -94,7 +94,6 @@ class WindowCloneLayout extends Clutter.LayoutManager { }); var WindowClone = GObject.registerClass({ - GTypeName: 'Workspace_WindowClone', Signals: { 'drag-begin': {}, 'drag-cancelled': {}, diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index ff23d9e2e..d7cd6396c 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -44,7 +44,6 @@ class PrimaryActorLayout extends Clutter.FixedLayout { }); var WindowClone = GObject.registerClass({ - GTypeName: 'WorkspaceThumbnail_WindowClone', Signals: { 'drag-begin': {}, 'drag-cancelled': {},