cleanup: Define GObject accessors in camelCase

gjs is smart enough to match a propertyName getter/setter to the
corresponding property-name GObject property, so use that and get
rid of the eslint camelcase rule exceptions.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1611>
This commit is contained in:
Florian Müllner 2021-01-30 02:03:07 +01:00
parent 0f1b566918
commit 252f2f5144
10 changed files with 30 additions and 60 deletions

View File

@ -117,13 +117,11 @@ var ModemBase = GObject.registerClass({
this._signalQuality = 0; this._signalQuality = 0;
} }
// eslint-disable-next-line camelcase get operatorName() {
get operator_name() {
return this._operatorName; return this._operatorName;
} }
// eslint-disable-next-line camelcase get signalQuality() {
get signal_quality() {
return this._signalQuality; return this._signalQuality;
} }

View File

@ -182,43 +182,35 @@ const SystemActions = GObject.registerClass({
this._sessionUpdated(); this._sessionUpdated();
} }
// eslint-disable-next-line camelcase get canPowerOff() {
get can_power_off() {
return this._actions.get(POWER_OFF_ACTION_ID).available; return this._actions.get(POWER_OFF_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get canRestart() {
get can_restart() {
return this._actions.get(RESTART_ACTION_ID).available; return this._actions.get(RESTART_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get canSuspend() {
get can_suspend() {
return this._actions.get(SUSPEND_ACTION_ID).available; return this._actions.get(SUSPEND_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get canLockScreen() {
get can_lock_screen() {
return this._actions.get(LOCK_SCREEN_ACTION_ID).available; return this._actions.get(LOCK_SCREEN_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get canSwitchUser() {
get can_switch_user() {
return this._actions.get(SWITCH_USER_ACTION_ID).available; return this._actions.get(SWITCH_USER_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get canLogout() {
get can_logout() {
return this._actions.get(LOGOUT_ACTION_ID).available; return this._actions.get(LOGOUT_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get canLockOrientation() {
get can_lock_orientation() {
return this._actions.get(LOCK_ORIENTATION_ACTION_ID).available; return this._actions.get(LOCK_ORIENTATION_ACTION_ID).available;
} }
// eslint-disable-next-line camelcase get orientationLockIcon() {
get orientation_lock_icon() {
return this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName; return this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName;
} }

View File

@ -60,13 +60,11 @@ var BarLevel = GObject.registerClass({
this.queue_repaint(); this.queue_repaint();
} }
// eslint-disable-next-line camelcase get maximumValue() {
get maximum_value() {
return this._maxValue; return this._maxValue;
} }
// eslint-disable-next-line camelcase set maximumValue(value) {
set maximum_value(value) {
value = Math.max(value, 1); value = Math.max(value, 1);
if (this._maxValue == value) if (this._maxValue == value)
@ -78,13 +76,11 @@ var BarLevel = GObject.registerClass({
this.queue_repaint(); this.queue_repaint();
} }
// eslint-disable-next-line camelcase get overdriveStart() {
get overdrive_start() {
return this._overdriveStart; return this._overdriveStart;
} }
// eslint-disable-next-line camelcase set overdriveStart(value) {
set overdrive_start(value) {
if (this._overdriveStart == value) if (this._overdriveStart == value)
return; return;

View File

@ -336,13 +336,11 @@ var ListSectionItem = GObject.registerClass({
this.add_child(textLayout); this.add_child(textLayout);
} }
// eslint-disable-next-line camelcase get iconActor() {
get icon_actor() {
return this._iconActorBin.get_child(); return this._iconActorBin.get_child();
} }
// eslint-disable-next-line camelcase set iconActor(actor) {
set icon_actor(actor) {
this._iconActorBin.set_child(actor); this._iconActorBin.set_child(actor);
this.notify('icon-actor'); this.notify('icon-actor');
} }

View File

@ -1090,8 +1090,7 @@ var IconGridLayout = GObject.registerClass({
return [null, DragLocation.EMPTY_SPACE]; return [null, DragLocation.EMPTY_SPACE];
} }
// eslint-disable-next-line camelcase get iconSize() {
get icon_size() {
return this._iconSize; return this._iconSize;
} }

View File

@ -79,13 +79,11 @@ var MonitorConstraint = GObject.registerClass({
this.notify('index'); this.notify('index');
} }
// eslint-disable-next-line camelcase get workArea() {
get work_area() {
return this._workArea; return this._workArea;
} }
// eslint-disable-next-line camelcase set workArea(v) {
set work_area(v) {
if (v == this._workArea) if (v == this._workArea)
return; return;
this._workArea = v; this._workArea = v;

View File

@ -322,13 +322,11 @@ var PadDiagram = GObject.registerClass({
this._initLabels(); this._initLabels();
} }
// eslint-disable-next-line camelcase get editorActor() {
get editor_actor() {
return this._editorActor; return this._editorActor;
} }
// eslint-disable-next-line camelcase set editorActor(actor) {
set editor_actor(actor) {
actor.hide(); actor.hide();
this._editorActor = actor; this._editorActor = actor;
this.add_actor(actor); this.add_actor(actor);

View File

@ -188,8 +188,7 @@ var WindowPreviewLayout = GObject.registerClass({
return [...this._windows.values()].map(i => i.metaWindow); return [...this._windows.values()].map(i => i.metaWindow);
} }
// eslint-disable-next-line camelcase get boundingBox() {
get bounding_box() {
return this._boundingBox; return this._boundingBox;
} }
}); });
@ -631,13 +630,11 @@ var WindowPreview = GObject.registerClass({
}; };
} }
// eslint-disable-next-line camelcase get overlayEnabled() {
get overlay_enabled() {
return this._overlayEnabled; return this._overlayEnabled;
} }
// eslint-disable-next-line camelcase set overlayEnabled(enabled) {
set overlay_enabled(enabled) {
if (this._overlayEnabled === enabled) if (this._overlayEnabled === enabled)
return; return;

View File

@ -851,13 +851,11 @@ var WorkspaceLayout = GObject.registerClass({
this.layout_changed(); this.layout_changed();
} }
// eslint-disable-next-line camelcase get layoutFrozen() {
get layout_frozen() {
return this._layoutFrozen; return this._layoutFrozen;
} }
// eslint-disable-next-line camelcase set layoutFrozen(f) {
set layout_frozen(f) {
if (this._layoutFrozen === f) if (this._layoutFrozen === f)
return; return;

View File

@ -334,8 +334,7 @@ var WorkspaceThumbnail = GObject.registerClass({
} }
} }
// eslint-disable-next-line camelcase set slidePosition(slidePosition) {
set slide_position(slidePosition) {
if (this._slidePosition == slidePosition) if (this._slidePosition == slidePosition)
return; return;
@ -348,13 +347,11 @@ var WorkspaceThumbnail = GObject.registerClass({
this.queue_relayout(); this.queue_relayout();
} }
// eslint-disable-next-line camelcase get slidePosition() {
get slide_position() {
return this._slidePosition; return this._slidePosition;
} }
// eslint-disable-next-line camelcase set collapseFraction(collapseFraction) {
set collapse_fraction(collapseFraction) {
if (this._collapseFraction == collapseFraction) if (this._collapseFraction == collapseFraction)
return; return;
this._collapseFraction = collapseFraction; this._collapseFraction = collapseFraction;
@ -362,8 +359,7 @@ var WorkspaceThumbnail = GObject.registerClass({
this.queue_relayout(); this.queue_relayout();
} }
// eslint-disable-next-line camelcase get collapseFraction() {
get collapse_fraction() {
return this._collapseFraction; return this._collapseFraction;
} }