Merge pull request #179 from hlechner/hide-degrees-option

add an option to hide/show the degrees celsius or degrees fahrenheit on panel
This commit is contained in:
Vasilii
2020-07-28 08:54:01 +03:00
committed by GitHub
3 changed files with 17 additions and 2 deletions

View File

@@ -98,6 +98,7 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
this._settingChangedSignals = [];
this._addSettingChangedSignal('update-time', this._updateTimeChanged.bind(this));
this._addSettingChangedSignal('unit', this._querySensors.bind(this));
this._addSettingChangedSignal('show-degrees-on-panel', this._updateUI.bind(this));
this._addSettingChangedSignal('show-icon-on-panel', this._showIconOnPanelChanged.bind(this));
this._addSettingChangedSignal('hot-sensors', this._querySensors.bind(this));
this._addSettingChangedSignal('show-decimal-value', this._querySensors.bind(this));
@@ -623,7 +624,12 @@ const FreonMenuButton = GObject.registerClass(class Freon_FreonMenuButton extend
format = '%.0f';
}
format += '%s';
return format.format(value, (this._settings.get_string('unit')=='fahrenheit') ? "\u00b0F" : "\u00b0C");
if(this._settings.get_boolean('show-degrees-on-panel')){
return format.format(value, (this._settings.get_string('unit')=='fahrenheit') ? "\u00b0F" : "\u00b0C" );
} else {
return format.format(value, "");
}
}
get positionInPanel(){

View File

@@ -51,7 +51,10 @@ var FreonPrefsWidget = new GObject.registerClass(class Freon_FreonPrefsWidget ex
let panelBoxIndex = Gtk.SpinButton.new_with_range (-1, 20, 1);
this.attach(panelBoxIndex, 2, i, 1, 1);
this._settings.bind('panel-box-index', panelBoxIndex, 'value', Gio.SettingsBindFlags.DEFAULT);
this._addSwitch({key : 'show-degrees-on-panel', y : i++, x : 3,
label : _('Show \u00b0C/\u00b0F on Panel')});
this._addSwitch({key : 'show-icon-on-panel', y : i++, x : 3,
label : _('Show Icon on Panel')});

View File

@@ -14,6 +14,12 @@
<summary>Unit</summary>
<description>The unit ('centigrade' or 'fahrenheit') the extension should display the temperature in</description>
</key>
<key type="b" name="show-degrees-on-panel">
<default>true</default>
<summary>Show degrees celsius/fahrenheit on Panel</summary>
<description>Show degrees celsius/fahrenheit on Panel</description>
</key>
<key type="b" name="show-icon-on-panel">
<default>true</default>