[gnome-shell] padOsd: Disallow help/switch monitor actions on rings/strips
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] padOsd: Disallow help/switch monitor actions on rings/strips
- Date: Mon, 17 Jul 2017 17:51:55 +0000 (UTC)
commit 5202181a4d55ecdb7821438993969de6cd9606fd
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jul 12 18:37:18 2017 +0200
padOsd: Disallow help/switch monitor actions on rings/strips
It does not make sense to map those actions to non-buttons. Set the
actions insensitive in the combobox to disallow this from the UI.
https://bugzilla.gnome.org/show_bug.cgi?id=782033
js/ui/padOsd.js | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index e143fa8..fc0ad45 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -154,9 +154,16 @@ const ActionComboBox = new Lang.Class({
this._actionLabels.set(GDesktopEnums.PadButtonAction.SWITCH_MONITOR, _("Switch monitor"));
this._actionLabels.set(GDesktopEnums.PadButtonAction.KEYBINDING, _("Assign keystroke"));
+ this._buttonItems = [];
+
for (let [action, label] of this._actionLabels.entries()) {
let selectedAction = action;
- this._editMenu.addAction(label, Lang.bind(this, function() {
this._onActionSelected(selectedAction) }));
+ let item = this._editMenu.addAction(label, Lang.bind(this, function() {
this._onActionSelected(selectedAction) }));
+
+ /* These actions only apply to pad buttons */
+ if (selectedAction == GDesktopEnums.PadButtonAction.HELP ||
+ selectedAction == GDesktopEnums.PadButtonAction.SWITCH_MONITOR)
+ this._buttonItems.push(item);
}
this.setAction(GDesktopEnums.PadButtonAction.NONE);
@@ -185,6 +192,10 @@ const ActionComboBox = new Lang.Class({
this.popup();
else
this.popdown();
+ },
+
+ setButtonActionsActive: function (active) {
+ this._buttonItems.forEach(item => { item.setSensitive(active); });
}
});
Signals.addSignalMethods(ActionComboBox.prototype);
@@ -223,13 +234,16 @@ const ActionEditor = new Lang.Class({
}
},
- setSettings: function (settings) {
+ setSettings: function (settings, action) {
this._buttonSettings = settings;
this._currentAction = this._buttonSettings.get_enum('action');
this._currentKeybinding = this._buttonSettings.get_string('keybinding');
this._actionComboBox.setAction(this._currentAction);
this._updateKeybindingEntryState();
+
+ let isButton = (action == Meta.PadActionType.BUTTON);
+ this._actionComboBox.setButtonActionsActive(isButton);
},
close: function() {
@@ -879,7 +893,7 @@ const PadOsd = new Lang.Class({
let settingsPath = this._settings.path + key + '/';
this._editedActionSettings =
Gio.Settings.new_with_path('org.gnome.desktop.peripherals.tablet.pad-button',
settingsPath);
- this._actionEditor.setSettings(this._editedActionSettings);
+ this._actionEditor.setSettings(this._editedActionSettings, type);
this._padDiagram.startEdition(type, number, dir);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]