GSConnect support and more safety checks
This commit is contained in:
parent
8a6d8754a5
commit
11a5deca1b
@ -19,6 +19,7 @@ const SETTING_SHOW_BLUETOOTH_INDICATOR = 'show-bluetooth-indicator';
|
||||
const SETTING_SHOW_POWER_INDICATOR = 'show-power-indicator';
|
||||
const SETTING_SHOW_POWER_PERCENTAGE_LABEL = 'show-power-percentage-label';
|
||||
const SETTING_SHOW_NIGHTLIGHT_INDICATOR = 'show-nightlight-indicator';
|
||||
const SETTING_SHOW_GSCONNECT_INDICATOR = 'show-gsconnect-indicator';
|
||||
const SETTING_REMOVE_ROUNDED_CORNERS = 'remove-rounded-corners';
|
||||
|
||||
function init() {
|
||||
@ -51,6 +52,7 @@ function disable() {
|
||||
show_status_area_component_indicator('aggregateMenu', '_power', '_indicator');
|
||||
show_status_area_component_indicator('aggregateMenu', '_power', '_percentageLabel');
|
||||
show_status_area_component_indicator('aggregateMenu', '_nightLight', '_indicator');
|
||||
show_status_area_component_indicator('aggregateMenu', '_gsconnect', '_indicator');
|
||||
|
||||
restore_rounded_corners();
|
||||
}
|
||||
@ -73,6 +75,7 @@ function auto() {
|
||||
auto_status_area_component_indicator('aggregateMenu', '_power', '_indicator', SETTING_SHOW_POWER_INDICATOR);
|
||||
auto_status_area_component_indicator('aggregateMenu', '_power', '_percentageLabel', SETTING_SHOW_POWER_PERCENTAGE_LABEL);
|
||||
auto_status_area_component_indicator('aggregateMenu', '_nightLight', '_indicator', SETTING_SHOW_NIGHTLIGHT_INDICATOR);
|
||||
auto_status_area_component_indicator('aggregateMenu', '_gsconnect', '_indicator', SETTING_SHOW_GSCONNECT_INDICATOR);
|
||||
|
||||
auto_rounded_corners();
|
||||
}
|
||||
@ -130,63 +133,86 @@ function show_status_area(areaName) {
|
||||
function hide_status_area_component(areaName, componentName) {
|
||||
|
||||
let area = Topbar.statusArea[areaName];
|
||||
let component = area[componentName];
|
||||
|
||||
if (component != null) {
|
||||
component.hide();
|
||||
if (area != null) {
|
||||
let component = area[componentName];
|
||||
|
||||
if (component != null) {
|
||||
component.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_status_area_component(areaName, componentName) {
|
||||
|
||||
let area = Topbar.statusArea[areaName];
|
||||
let component = area[componentName];
|
||||
|
||||
if (component != null) {
|
||||
component.show();
|
||||
if (area != null) {
|
||||
let component = area[componentName];
|
||||
|
||||
if (component != null) {
|
||||
component.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hide_status_area_component_indicator(areaName, componentName, indicatorName) {
|
||||
|
||||
let area = Topbar.statusArea[areaName];
|
||||
let component = area[componentName];
|
||||
let indicator = component[indicatorName];
|
||||
|
||||
if (indicator != null) {
|
||||
indicator.hide();
|
||||
if (area != null) {
|
||||
let component = area[componentName];
|
||||
if (component != null) {
|
||||
let indicator = component[indicatorName];
|
||||
if (indicator != null) {
|
||||
indicator.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_status_area_component_indicator(areaName, componentName, indicatorName) {
|
||||
|
||||
let area = Topbar.statusArea[areaName];
|
||||
let component = area[componentName];
|
||||
let indicator = component[indicatorName];
|
||||
|
||||
if (indicator != null) {
|
||||
indicator.show();
|
||||
if (area != null) {
|
||||
let component = area[componentName];
|
||||
if (component != null) {
|
||||
let indicator = component[indicatorName];
|
||||
if (indicator != null) {
|
||||
indicator.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove_rounded_corners() {
|
||||
|
||||
let leftCorner = Topbar._leftCorner.actor;
|
||||
|
||||
if (leftCorner != null) {
|
||||
leftCorner.add_style_class_name('straight-panel-corner');
|
||||
}
|
||||
|
||||
let rightCorner = Topbar._rightCorner.actor;
|
||||
|
||||
if (leftCorner != null && rightCorner != null) {
|
||||
leftCorner.add_style_class_name('straight-panel-corner');
|
||||
if (rightCorner != null) {
|
||||
rightCorner.add_style_class_name('straight-panel-corner');
|
||||
}
|
||||
}
|
||||
|
||||
function restore_rounded_corners() {
|
||||
|
||||
|
||||
let leftCorner = Topbar._leftCorner.actor;
|
||||
|
||||
if (leftCorner != null) {
|
||||
leftCorner.remove_style_class_name('straight-panel-corner');
|
||||
}
|
||||
|
||||
let rightCorner = Topbar._rightCorner.actor;
|
||||
|
||||
if (leftCorner != null && rightCorner != null) {
|
||||
leftCorner.remove_style_class_name('straight-panel-corner');
|
||||
if (rightCorner != null) {
|
||||
rightCorner.remove_style_class_name('straight-panel-corner');
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ const SETTING_SHOW_BLUETOOTH_INDICATOR = 'show-bluetooth-indicator';
|
||||
const SETTING_SHOW_POWER_INDICATOR = 'show-power-indicator';
|
||||
const SETTING_SHOW_POWER_PERCENTAGE_LABEL = 'show-power-percentage-label';
|
||||
const SETTING_SHOW_NIGHTLIGHT_INDICATOR = 'show-nightlight-indicator';
|
||||
const SETTING_SHOW_GSCONNECT_INDICATOR = 'show-gsconnect-indicator';
|
||||
const SETTING_REMOVE_ROUNDED_CORNERS = 'remove-rounded-corners';
|
||||
|
||||
const PowerfulTopbarPrefsWidget = new GObject.Class({
|
||||
@ -54,6 +55,7 @@ const PowerfulTopbarPrefsWidget = new GObject.Class({
|
||||
this._create_switch(SETTING_SHOW_BLUETOOTH_INDICATOR);
|
||||
this._create_switch(SETTING_SHOW_POWER_INDICATOR);
|
||||
this._create_switch(SETTING_SHOW_NIGHTLIGHT_INDICATOR);
|
||||
this._create_switch(SETTING_SHOW_GSCONNECT_INDICATOR);
|
||||
this._create_switch(SETTING_SHOW_POWER_PERCENTAGE_LABEL);
|
||||
this._create_switch(SETTING_REMOVE_ROUNDED_CORNERS);
|
||||
|
||||
|
@ -61,6 +61,11 @@
|
||||
<summary>Show nightlight's indicator</summary>
|
||||
<description>Show nightlight's indicator</description>
|
||||
</key>
|
||||
<key name="show-gsconnect-indicator" type="b">
|
||||
<default>false</default>
|
||||
<summary>Show GSConnect's indicator</summary>
|
||||
<description>Show GSConnect's indicator</description>
|
||||
</key>
|
||||
<key name="show-power-percentage-label" type="b">
|
||||
<default>false</default>
|
||||
<summary>Show power's percentage</summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user