Skip to content

Commit

Permalink
Replaces gtk.Scale with gtk.SpinButton for integers/float. It seems t…
Browse files Browse the repository at this point in the history
…o have a better integration overall.
  • Loading branch information
paradoxxxzero committed Jul 31, 2019
1 parent e23c13b commit 87fcc77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
35 changes: 5 additions & 30 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const layouts = {
half: 'Tile windows according to screen ratio',
'half-horizontal': 'Tile windows horizontally',
'half-vertical': 'Tile windows vertically',
ratio:
'Tile windows in both way according to the ratio of the remaining space',
ratio: 'Tile windows according to the ratio of remaining space',
grid: 'Tile windows according to a regular grid',
simple: 'Split screen unidirectionally according to screen ratio',
'simple-horizontal': 'Split screen horizontally',
Expand Down Expand Up @@ -153,17 +152,7 @@ function layoutsTab(notebook) {
rows.push(makeItemRow(name, description, item));

if (layout === 'ratio') {
const ratio = Gtk.Scale.new_with_range(
Gtk.Orientation.HORIZONTAL,
0,
1,
0.01
);
ratio.add_mark(
0.6180339887498948,
Gtk.PositionType.BOTTOM,
'Golden Ratio'
);
const ratio = Gtk.SpinButton.new_with_range(0, 1, 0.01);
settings.bind(
'ratio-value',
ratio.get_adjustment(),
Expand Down Expand Up @@ -193,7 +182,7 @@ function layoutsSettingsTab(notebook) {
const settings = getSettings('layouts');
const itemRows = [];

const gap = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, 0, 250, 1);
const gap = Gtk.SpinButton.new_with_range(0, 250, 1);
settings.bind(
'gap',
gap.get_adjustment(),
Expand Down Expand Up @@ -222,12 +211,7 @@ function layoutsSettingsTab(notebook) {
Gio.SettingsBindFlags.DEFAULT
);

const screenGap = Gtk.Scale.new_with_range(
Gtk.Orientation.HORIZONTAL,
0,
250,
1
);
const screenGap = Gtk.SpinButton.new_with_range(0, 250, 1);
settings.bind(
'screen-gap',
screenGap.get_adjustment(),
Expand All @@ -248,23 +232,14 @@ function layoutsSettingsTab(notebook) {
)
);

const tweentime = Gtk.Scale.new_with_range(
Gtk.Orientation.HORIZONTAL,
0,
1,
0.01
);
const tweentime = Gtk.SpinButton.new_with_range(0, 1, 0.01);
settings.bind(
'tween-time',
tweentime.get_adjustment(),
'value',
Gio.SettingsBindFlags.DEFAULT
);

tweentime.add_mark(0.1, Gtk.PositionType.BOTTOM, 'Fast');
tweentime.add_mark(0.25, Gtk.PositionType.BOTTOM, 'Smooth');
tweentime.add_mark(0.75, Gtk.PositionType.BOTTOM, 'Mesmerizing');

itemRows.push(
makeItemRow(
'Animation duration',
Expand Down
2 changes: 1 addition & 1 deletion utils/prefsUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var makeItemRow = (name, description, item) => {

const rowHBox = new Gtk.HBox();
rowHBox.pack_start(labelsVBox, true, true, 10);
rowHBox.pack_start(item, true, true, 0); // Should be true, true?
rowHBox.pack_start(item, false, false, 0);

const listRow = new Gtk.ListBoxRow();
listRow.add(rowHBox);
Expand Down

0 comments on commit 87fcc77

Please sign in to comment.