Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
fix(deprecation warnings): update deprecated calls (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyui authored Jun 28, 2020
1 parent 10c040d commit ed57dcb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ const NightLightSlider = GObject.registerClass(
icon_name: "night-light-symbolic",
style_class: "popup-menu-icon",
});
this._item.actor.add(this._icon);
this._item.add(this._icon);
}

// Slider
this._slider = new Slider.Slider(0);
this._slider.connect("notify::value", this._sliderChanged.bind(this));
this._slider.actor.accessible_name = "Temperature";
this._item.actor.add(this._slider.actor, { expand: true });
this._slider.accessible_name = "Temperature";
this._item.add(this._slider, { expand: true });

// Connect events
this._item.actor.connect("button-press-event", (actor, event) =>
this._item.connect("button-press-event", (o, event) =>
this._slider.startDragging(event)
);
this._item.actor.connect("key-press-event", (actor, event) =>
this._item.connect("key-press-event", (o, event) =>
this._slider.onKeyPressEvent(actor, event)
);

Expand Down Expand Up @@ -161,9 +161,7 @@ class NightLightExtension {

// Night light icon
this._icon = Main.panel.statusArea.aggregateMenu._nightLight;
// This will be defined if icon is set to hide
this._indicator = null;
this._indicators = null;
this._construct = () =>
new Error("[night-light-slider] View construct stub not set up!");
this._deconstruct = () =>
Expand Down Expand Up @@ -213,13 +211,16 @@ class NightLightExtension {
// Hide status icon if set to disable
if (!settings.get_boolean("show-status-icon") && this._icon) {
log(`[night-light-slider] Hiding status icon`);
this._indicators = this._icon.indicators;
this._icon.indicators.hide();
this._icon.indicators = new St.BoxLayout();
this._icon.hide();

// TODO: Rewrite the extension
this._hackyShowCallback = this._icon.connect("show", () => {
this._icon.hide();
});
}

// When scrolling the indicator, change night light intensity
this._icon.indicators.connect("scroll-event", (actor, event) => {
this._icon.connect("scroll-event", (o, event) => {
this._indicator._scroll(event);
return true;
});
Expand Down Expand Up @@ -261,16 +262,15 @@ class NightLightExtension {
}

disable() {
// TODO: Figure out the proper way to disconnect signals
if (this._hackyShowCallback) {
this._icon.disconnect(this._hackyShowCallback);
this._icon.show();
}

// Run deconstruct function
this._deconstruct();

// Restore default status icon behaviour
if (this._indicators) {
Main.panel.statusArea.aggregateMenu._nightLight.indicators.destroy();
Main.panel.statusArea.aggregateMenu._nightLight.indicators = this._indicators;
Main.panel.statusArea.aggregateMenu._nightLight.indicators.show();
}

// Disable updater loop
this._scheduleUpdater._disableLoop();
}
Expand Down
2 changes: 1 addition & 1 deletion [email protected]/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Change night light temperature",
"settings-schema": "org.gnome.shell.extensions.nightlightslider",
"uuid": "[email protected]",
"version": 14,
"version": 15,
"url": "https://github.com/kiyui/gnome-shell-night-light-slider-extension",
"shell-version": ["3.36"]
}

0 comments on commit ed57dcb

Please sign in to comment.