Set show desktop button label with panel position

This commit is contained in:
Charles Gagnon
2019-09-15 17:00:55 -04:00
parent e692cba8ef
commit 26e2c7b8fe
3 changed files with 19 additions and 10 deletions

View File

@@ -3927,7 +3927,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Show Desktop button width (px)</property>
<property name="xalign">0</property>
</object>
<packing>

View File

@@ -969,9 +969,8 @@ var dtpPanel = Utils.defineClass({
this._setShowDesktopButtonSize();
this._signalsHandler.add([this._showDesktopButton, 'button-press-event', () => this._onShowDesktopButtonPress()]);
this._signalsHandler.add([this._showDesktopButton, 'enter-event', () => {
this._showDesktopButton.connect('button-press-event', () => this._onShowDesktopButtonPress());
this._showDesktopButton.connect('enter-event', () => {
this._showDesktopButton.add_style_class_name('showdesktop-button-hovered');
if (Me.settings.get_boolean('show-showdesktop-hover')) {
@@ -981,9 +980,9 @@ var dtpPanel = Utils.defineClass({
this._showDesktopTimeoutId = 0;
});
}
}]);
});
this._signalsHandler.add([this._showDesktopButton, 'leave-event', () => {
this._showDesktopButton.connect('leave-event', () => {
this._showDesktopButton.remove_style_class_name('showdesktop-button-hovered');
if (Me.settings.get_boolean('show-showdesktop-hover')) {
@@ -994,7 +993,7 @@ var dtpPanel = Utils.defineClass({
this._toggleWorkspaceWindows(false, this._hiddenDesktopWorkspace);
}
 }
}]);
});
this._rightBox.insert_child_at_index(this._showDesktopButton, this._rightBox.get_children().length);
} else {

View File

@@ -201,6 +201,7 @@ const Settings = new Lang.Class({
let isVertical = position == 'LEFT' || position == 'RIGHT';
let taskbarLocationCombo = this._builder.get_object('taskbar_position_combo');
let clockLocationCombo = this._builder.get_object('location_clock_combo');
let showDesktopWidthLabel = this._builder.get_object('show_showdesktop_width_label');
taskbarLocationCombo.remove_all();
clockLocationCombo.remove_all();
@@ -221,9 +222,11 @@ const Settings = new Lang.Class({
['TASKBARLEFT', isVertical ? _('Top of taskbar') : _('Left of taskbar')],
['TASKBARRIGHT', isVertical ? _('Bottom of taskbar') : _('Right of taskbar')]
].forEach(cl => clockLocationCombo.append.apply(clockLocationCombo, cl));
taskbarLocationCombo.set_active_id(this._settings.get_string('taskbar-position'));
clockLocationCombo.set_active_id(this._settings.get_string('location-clock'));
showDesktopWidthLabel.set_text(isVertical ? _('Show Desktop button height (px)') : _('Show Desktop button width (px)'));
},
_bindSettings: function() {
@@ -252,10 +255,18 @@ const Settings = new Lang.Class({
this._updateVerticalRelatedOptions();
this._builder.get_object('location_clock_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_string('location-clock', widget.get_active_id());
let activeId = widget.get_active_id();
if (activeId) {
this._settings.set_string('location-clock', activeId);
}
}));
this._builder.get_object('taskbar_position_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_string('taskbar-position', widget.get_active_id());
let activeId = widget.get_active_id();
if (activeId) {
this._settings.set_string('taskbar-position', activeId);
}
}));
// size options