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;
}
// eslint-disable-next-line camelcase
get operator_name() {
get operatorName() {
return this._operatorName;
}
// eslint-disable-next-line camelcase
get signal_quality() {
get signalQuality() {
return this._signalQuality;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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