From 26e2c7b8fe2ae62dffcba7d8db022fe7e7c84b56 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 15 Sep 2019 17:00:55 -0400 Subject: [PATCH] Set show desktop button label with panel position --- Settings.ui | 1 - panel.js | 11 +++++------ prefs.js | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Settings.ui b/Settings.ui index 5fea6ca..c5bc2f7 100644 --- a/Settings.ui +++ b/Settings.ui @@ -3927,7 +3927,6 @@ True False True - Show Desktop button width (px) 0 diff --git a/panel.js b/panel.js index 0d47bd0..f14dae3 100644 --- a/panel.js +++ b/panel.js @@ -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 { diff --git a/prefs.js b/prefs.js index 08d06ec..fa44b1b 100644 --- a/prefs.js +++ b/prefs.js @@ -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