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
This commit is contained in:
parent
cb6d9c9278
commit
3478715e6a
@ -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);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user