use strings instead of order index for combo boxes assignments in case of future reorder

This commit is contained in:
jderose9
2016-12-28 20:22:12 -05:00
parent d5b544d5ff
commit 1924ef37be
5 changed files with 73 additions and 76 deletions

View File

@@ -73,12 +73,12 @@
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize window</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
<item translatable="yes">Cycle windows + minimize</item>
<item translatable="yes">Quit</item>
<item id="RAISE" translatable="yes">Raise window</item>
<item id="MINIMIZE" translatable="yes">Minimize window</item>
<item id="LAUNCH" translatable="yes">Launch new instance</item>
<item id="CYCLE" translatable="yes">Cycle through windows</item>
<item id="CYCLE-MIN" translatable="yes">Cycle windows + minimize</item>
<item id="QUIT" translatable="yes">Quit</item>
</items>
</object>
<packing>
@@ -143,12 +143,12 @@
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize window</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle windows</item>
<item translatable="yes">Cycle windows + minimize</item>
<item translatable="yes">Quit</item>
<item id="RAISE" translatable="yes">Raise window</item>
<item id="MINIMIZE" translatable="yes">Minimize window</item>
<item id="LAUNCH" translatable="yes">Launch new instance</item>
<item id="CYCLE" translatable="yes">Cycle through windows</item>
<item id="CYCLE-MIN" translatable="yes">Cycle windows + minimize</item>
<item id="QUIT" translatable="yes">Quit</item>
</items>
</object>
<packing>
@@ -213,12 +213,12 @@
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize window</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
<item translatable="yes">Cycle windows + minimize</item>
<item translatable="yes">Quit</item>
<item id="RAISE" translatable="yes">Raise window</item>
<item id="MINIMIZE" translatable="yes">Minimize window</item>
<item id="LAUNCH" translatable="yes">Launch new instance</item>
<item id="CYCLE" translatable="yes">Cycle through windows</item>
<item id="CYCLE-MIN" translatable="yes">Cycle windows + minimize</item>
<item id="QUIT" translatable="yes">Quit</item>
</items>
</object>
<packing>
@@ -734,11 +734,11 @@
<property name="can_focus">False</property>
<property name="valign">center</property>
<items>
<item translatable="yes">Raise window</item>
<item translatable="yes">Minimize</item>
<item translatable="yes">Launch new instance</item>
<item translatable="yes">Cycle through windows</item>
<item translatable="yes">Cycle windows + minimize</item>
<item id="RAISE" translatable="yes">Raise window</item>
<item id="MINIMIZE" translatable="yes">Minimize window</item>
<item id="LAUNCH" translatable="yes">Launch new instance</item>
<item id="CYCLE" translatable="yes">Cycle through windows</item>
<item id="CYCLE-MIN" translatable="yes">Cycle windows + minimize</item>
</items>
</object>
<packing>

View File

@@ -245,13 +245,14 @@ const taskbarPanel = new Lang.Class({
_setPanelStyle: function() {
let size = this._dtpSettings.get_int('panel-size');
let position = this._dtpSettings.get_enum('panel-position');
let position = this._dtpSettings.get_string('panel-position');
let isTop = position == "TOP";
this.panel.actor.set_height(size);
Main.overview._panelGhost.set_height(position ? size : 0);
this._myPanelGhost.set_height(position ? 0 : size);
position ? this.panelBox.set_anchor_point(0, 0) :
Main.overview._panelGhost.set_height(isTop ? size : 0);
this._myPanelGhost.set_height(isTop ? 0 : size);
isTop ? this.panelBox.set_anchor_point(0, 0) :
this.panelBox.set_anchor_point(0,(-1)*(Main.layoutManager.primaryMonitor.height-this.panelBox.height));
},

View File

@@ -72,13 +72,13 @@ const Settings = new Lang.Class({
// Position and size panel
// Position option
let position = this._settings.get_enum('panel-position');
let position = this._settings.get_string('panel-position');
switch (position) {
case 0:
case 'BOTTOM':
this._builder.get_object('position_bottom_button').set_active(true);
break;
case 1:
case 'TOP':
this._builder.get_object('position_top_button').set_active(true);
break;
@@ -123,20 +123,20 @@ const Settings = new Lang.Class({
'sensitive',
Gio.SettingsBindFlags.DEFAULT);
this._builder.get_object('click_action_combo').set_active(this._settings.get_enum('click-action'));
this._builder.get_object('click_action_combo').set_active_id(this._settings.get_string('click-action'));
this._builder.get_object('click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('click-action', widget.get_active());
this._settings.set_string('click-action', widget.get_active_id());
}));
this._builder.get_object('shift_click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('shift-click-action', widget.get_active());
this._settings.set_string('shift-click-action', widget.get_active_id());
}));
this._builder.get_object('middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('middle-click-action', widget.get_active());
this._settings.set_string('middle-click-action', widget.get_active_id());
}));
this._builder.get_object('shift_middle_click_action_combo').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_enum('shift-middle-click-action', widget.get_active());
this._settings.set_string('shift-middle-click-action', widget.get_active_id());
}));
// Create dialog for middle-click options
@@ -154,11 +154,11 @@ const Settings = new Lang.Class({
let box = this._builder.get_object('box_middle_click_options');
dialog.get_content_area().add(box);
this._builder.get_object('shift_click_action_combo').set_active(this._settings.get_enum('shift-click-action'));
this._builder.get_object('shift_click_action_combo').set_active_id(this._settings.get_string('shift-click-action'));
this._builder.get_object('middle_click_action_combo').set_active(this._settings.get_enum('middle-click-action'));
this._builder.get_object('middle_click_action_combo').set_active_id(this._settings.get_string('middle-click-action'));
this._builder.get_object('shift_middle_click_action_combo').set_active(this._settings.get_enum('shift-middle-click-action'));
this._builder.get_object('shift_middle_click_action_combo').set_active_id(this._settings.get_string('shift-middle-click-action'));
this._settings.bind('shift-click-action',
this._builder.get_object('shift_click_action_combo'),
@@ -180,9 +180,9 @@ const Settings = new Lang.Class({
keys.forEach(function(val) {
this._settings.set_value(val, this._settings.get_default_value(val));
}, this);
this._builder.get_object('shift_click_action_combo').set_active(this._settings.get_enum('shift-click-action'));
this._builder.get_object('middle_click_action_combo').set_active(this._settings.get_enum('middle-click-action'));
this._builder.get_object('shift_middle_click_action_combo').set_active(this._settings.get_enum('shift-middle-click-action'));
this._builder.get_object('shift_click_action_combo').set_active_id(this._settings.get_string('shift-click-action'));
this._builder.get_object('middle_click_action_combo').set_active_id(this._settings.get_string('middle-click-action'));
this._builder.get_object('shift_middle_click_action_combo').set_active_id(this._settings.get_string('shift-middle-click-action'));
} else {
// remove the settings box so it doesn't get destroyed;
dialog.get_content_area().remove(box);
@@ -231,12 +231,12 @@ const Settings = new Lang.Class({
position_bottom_button_toggled_cb: function(button) {
if (button.get_active())
this._settings.set_enum('panel-position', 0);
this._settings.set_string('panel-position', "BOTTOM");
},
position_top_button_toggled_cb: function(button) {
if (button.get_active())
this._settings.set_enum('panel-position', 1);
this._settings.set_string('panel-position', "TOP");
},
panel_size_scale_format_value_cb: function(scale, value) {

View File

@@ -1,21 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gnome-shell-extensions">
<enum id='org.gnome.shell.extensions.dash-to-panel.clickAction'>
<value value='0' nick='skip'/>
<value value='1' nick='minimize'/>
<value value='2' nick='launch'/>
<value value='3' nick='cycle-windows'/>
<value value='4' nick='cycle-windows-min'/>
<value value='5' nick='quit'/>
<value value='0' nick='SKIP'/>
<value value='1' nick='MINIMIZE'/>
<value value='2' nick='LAUNCH'/>
<value value='3' nick='CYCLE'/>
<value value='4' nick='CYCLE-MIN'/>
<value value='5' nick='QUIT'/>
</enum>
<enum id='org.gnome.shell.extensions.dash-to-panel.statusAreaPosition'>
<value value='0' nick='NATURAL'/>
<value value='1' nick='STATUSLEFT'/>
<value value='2' nick='STATUSRIGHT'/>
</enum>
<!-- this is mean to Match StSide. LEFT and RIGHT actual position in reversed in
rtl languages -->
<enum id='org.gnome.shell.extensions.dash-to-panel.position'>
<enum id='org.gnome.shell.extensions.dash-to-panel.panelPosition'>
<value value='0' nick='BOTTOM'/>
<value value='1' nick='TOP'/>
</enum>
<schema path="/org/gnome/shell/extensions/dash-to-panel/" id="org.gnome.shell.extensions.dash-to-panel">
<key name="panel-position" enum="org.gnome.shell.extensions.dash-to-panel.position">
<key name="panel-position" enum="org.gnome.shell.extensions.dash-to-panel.panelPosition">
<default>'BOTTOM'</default>
<summary>Panel position</summary>
<description>Panel is shown on the Bottom or Top of the screen.</description>
@@ -25,8 +30,8 @@
<summary>Panel size</summary>
<description>Set the size of the panel.</description>
</key>
<key type="s" name="location-clock">
<default>"STATUSRIGHT"</default>
<key name="location-clock" enum="org.gnome.shell.extensions.dash-to-panel.statusAreaPosition">
<default>'STATUSRIGHT'</default>
<summary>Location of the clock</summary>
<description>Set the location of the clock on the taskbar</description>
</key>
@@ -54,22 +59,22 @@
<summary>Activate only one window</summary>
</key>
<key name="click-action" enum="org.gnome.shell.extensions.dash-to-panel.clickAction">
<default>'cycle-windows-min'</default>
<default>'CYCLE-MIN'</default>
<summary>Action when clicking on a running app</summary>
<description>Set the action that is executed when clicking on the icon of a running application</description>
</key>
<key name="shift-click-action" enum="org.gnome.shell.extensions.dash-to-panel.clickAction">
<default>'minimize'</default>
<default>'MINIMIZE'</default>
<summary>Action when shit+clicking on a running app</summary>
<description>Set the action that is executed when shift+clicking on the icon of a running application</description>
</key>
<key name="middle-click-action" enum="org.gnome.shell.extensions.dash-to-panel.clickAction">
<default>'launch'</default>
<default>'LAUNCH'</default>
<summary>Action when clicking on a running app</summary>
<description>Set the action that is executed when middle-clicking on the icon of a running application</description>
</key>
<key name="shift-middle-click-action" enum="org.gnome.shell.extensions.dash-to-panel.clickAction">
<default>'launch'</default>
<default>'LAUNCH'</default>
<summary>Action when clicking on a running app</summary>
<description>Set the action that is executed when shift+middle-clicking on the icon of a running application</description>
</key>

View File

@@ -57,15 +57,6 @@ let LABEL_GAP = 5;
let RUNNING_INDICATOR_SIZE = 3;
let HFADE_WIDTH = 48;
const clickAction = {
SKIP: 0,
MINIMIZE: 1,
LAUNCH: 2,
CYCLE_WINDOWS: 3,
CYCLE_WINDOWS_MIN: 4,
QUIT: 5
};
function getPosition() {
return Main.layoutManager.panelBox.anchor_y == 0 ? St.Side.TOP : St.Side.BOTTOM;
}
@@ -1366,30 +1357,30 @@ const taskbarAppIcon = new Lang.Class({
let buttonAction = 0;
if (button && button == 2 ) {
if (modifiers & Clutter.ModifierType.SHIFT_MASK)
buttonAction = this._dtpSettings.get_enum('shift-middle-click-action');
buttonAction = this._dtpSettings.get_string('shift-middle-click-action');
else
buttonAction = this._dtpSettings.get_enum('middle-click-action');
buttonAction = this._dtpSettings.get_string('middle-click-action');
}
else if (button && button == 1) {
if (modifiers & Clutter.ModifierType.SHIFT_MASK)
buttonAction = this._dtpSettings.get_enum('shift-click-action');
buttonAction = this._dtpSettings.get_string('shift-click-action');
else
buttonAction = this._dtpSettings.get_enum('click-action');
buttonAction = this._dtpSettings.get_string('click-action');
}
// We customize the action only when the application is already running
if (this.app.state == Shell.AppState.RUNNING) {
switch (buttonAction) {
case clickAction.SKIP:
case "RAISE":
activateAllWindows(this.app);
break;
case clickAction.LAUNCH:
case "LAUNCH":
this.animateLaunch();
this.app.open_new_window(-1);
break;
case clickAction.MINIMIZE:
case "MINIMIZE":
// In overview just activate the app, unless the acion is explicitely
// requested with a keyboard modifier
if (!Main.overview._shown || modifiers){
@@ -1411,7 +1402,7 @@ const taskbarAppIcon = new Lang.Class({
this.app.activate();
break;
case clickAction.CYCLE_WINDOWS:
case "CYCLE":
if (!Main.overview._shown){
if (this.app == focusedApp)
activateNextWindow(this.app, false);
@@ -1422,7 +1413,7 @@ const taskbarAppIcon = new Lang.Class({
else
this.app.activate();
break;
case clickAction.CYCLE_WINDOWS_MIN:
case "CYCLE-MIN":
if (!Main.overview._shown){
if (this.app == focusedApp)
activateNextWindow(this.app, true);
@@ -1434,7 +1425,7 @@ const taskbarAppIcon = new Lang.Class({
this.app.activate();
break;
case clickAction.QUIT:
case "QUIT":
closeAllWindows(this.app);
break;
}