From 3fb7bdb83b69478341ec1568b31ef6829d004715 Mon Sep 17 00:00:00 2001
From: Philipp <57151725+philippun1@users.noreply.github.com>
Date: Mon, 10 May 2021 04:14:15 +0200
Subject: [PATCH] Format value callbacks, app icon animation options dialog
layout (#1329)
* updated format-value callbacks to new format
* fixed app icon animation options dialog layout
---
Settings.ui | 453 ++++++++++++++++++++++++++--------------------------
prefs.js | 140 +++++++++-------
2 files changed, 309 insertions(+), 284 deletions(-)
diff --git a/Settings.ui b/Settings.ui
index b6fdd3c..ed7ef90 100644
--- a/Settings.ui
+++ b/Settings.ui
@@ -6,247 +6,242 @@
True
False
vertical
+ 1
+ 1
-
+
+
+ True
+ True
+ False
-
+
True
- True
- False
+ False
+ 12
+ 12
+ 12
+ 12
+ 24
+ 32
-
+
True
False
- 12
12
- 12
- 12
- 24
- 32
-
-
- True
- False
- 12
- Duration
- True
- 0
- end
-
- 0
- 0
-
-
-
-
-
- True
- True
- end
- True
- animate_appicon_hover_options_duration_adjustment
- 0
- 0
- right
-
-
- 0
- 1
-
-
-
-
-
- True
- False
- Rotation
- 0
- end
-
- 1
- 0
-
-
-
-
-
- True
- True
- end
- True
- animate_appicon_hover_options_rotation_adjustment
- 0
- 0
- right
-
-
- 1
- 1
-
-
-
-
-
- True
- False
- Travel
- 0
- end
-
- 2
- 0
-
-
-
-
-
- True
- True
- end
- True
- animate_appicon_hover_options_travel_adjustment
- 0
- 0
- right
-
-
- 2
- 1
-
-
-
-
-
- True
- False
- Zoom
- 0
- end
-
- 3
- 0
-
-
-
-
-
- True
- True
- end
- True
- animate_appicon_hover_options_zoom_adjustment
- 0
- 0
- right
-
-
- 3
- 1
-
-
-
-
-
- True
- False
- Convexity
- 0
- end
-
- 4
- 0
-
-
-
-
-
- True
- True
- end
- True
- animate_appicon_hover_options_convexity_adjustment
- 1
- 1
- right
-
-
- 4
- 1
-
-
-
-
-
- True
- False
- Extent
- 0
- end
-
- 0
- 5
-
-
-
-
-
- True
- True
- end
- True
- animate_appicon_hover_options_extent_adjustment
- 0
- 0
- right
-
-
- 5
- 1
-
-
-
+ Duration
+ True
+ 0
+ end
+
+ 0
+ 0
+
+
+
+
+
+ True
+ True
+ end
+ True
+ animate_appicon_hover_options_duration_adjustment
+ 0
+ 0
+ right
+ True
+
+ 0
+ 1
+
+
+
+
+
+ True
+ False
+ Rotation
+ 0
+ end
+
+ 1
+ 0
+
+
+
+
+
+ True
+ True
+ end
+ True
+ animate_appicon_hover_options_rotation_adjustment
+ 0
+ 0
+ right
+ True
+
+ 1
+ 1
+
+
+
+
+
+ True
+ False
+ Travel
+ 0
+ end
+
+ 2
+ 0
+
+
+
+
+
+ True
+ True
+ end
+ True
+ animate_appicon_hover_options_travel_adjustment
+ 0
+ 0
+ right
+ True
+
+ 2
+ 1
+
+
+
+
+
+ True
+ False
+ Zoom
+ 0
+ end
+
+ 3
+ 0
+
+
+
+
+
+ True
+ True
+ end
+ True
+ animate_appicon_hover_options_zoom_adjustment
+ 0
+ 0
+ right
+ True
+
+ 3
+ 1
+
+
+
+
+
+ True
+ False
+ Convexity
+ 0
+ end
+
+ 4
+ 0
+
+
+
+
+
+ True
+ True
+ end
+ True
+ animate_appicon_hover_options_convexity_adjustment
+ 1
+ 1
+ right
+ True
+
+ 4
+ 1
+
+
+
+
+
+ True
+ False
+ Extent
+ 0
+ end
+
+ 5
+ 0
+
+
+
+
+
+ True
+ True
+ end
+ True
+ animate_appicon_hover_options_extent_adjustment
+ 0
+ 0
+ right
+ True
+
+ 5
+ 1
+
@@ -4858,7 +4853,7 @@
0
0
right
-
+ True
1
@@ -4900,6 +4895,7 @@
0
0
right
+ True
2
1
@@ -5116,6 +5112,7 @@
0
0
right
+ True
0
@@ -5163,6 +5160,7 @@
0
0
right
+ True
0
@@ -6850,6 +6848,7 @@
0
0
right
+ True
0
@@ -6879,6 +6878,7 @@
0
0
right
+ True
1
@@ -6944,6 +6944,7 @@
0
0
right
+ True
0
@@ -6973,6 +6974,7 @@
0
0
right
+ True
1
@@ -7002,6 +7004,7 @@
0
0
right
+ True
2
diff --git a/prefs.js b/prefs.js
index 988214e..5661f9c 100644
--- a/prefs.js
+++ b/prefs.js
@@ -181,6 +181,7 @@ const Preferences = new Lang.Class({
this._tray_padding_timeout = 0;
this._statusicon_padding_timeout = 0;
this._leftbox_padding_timeout = 0;
+ this._addFormatValueCallbacks();
this._bindSettings();
},
@@ -553,6 +554,83 @@ const Preferences = new Lang.Class({
dialog.set_default_size(1, 1);
},
+ _addFormatValueCallbacks: function() {
+ // position
+ this._builder.get_object('panel_size_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ // style
+ this._builder.get_object('appicon_margin_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ this._builder.get_object('appicon_padding_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ // fine-tune box1
+ this._builder.get_object('tray_size_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ this._builder.get_object('leftbox_size_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ // fine-tune box2
+ this._builder.get_object('tray_padding_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ this._builder.get_object('statusicon_padding_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ this._builder.get_object('leftbox_padding_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return value + ' px';
+ }));
+
+ // animate hovering app icons dialog
+ this._builder.get_object('animate_appicon_hover_options_duration_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return _("%d ms").format(value);
+ }));
+
+ this._builder.get_object('animate_appicon_hover_options_rotation_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return _("%d °").format(value);
+ }));
+
+ this._builder.get_object('animate_appicon_hover_options_travel_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return _("%d %%").format(value);
+ }));
+
+ this._builder.get_object('animate_appicon_hover_options_zoom_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return _("%d %%").format(value);
+ }));
+
+ this._builder.get_object('animate_appicon_hover_options_convexity_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return _("%.1f").format(value);
+ }));
+
+ this._builder.get_object('animate_appicon_hover_options_extent_scale')
+ .set_format_value_func(Lang.bind(this, function(scale, value) {
+ return Gettext.ngettext("%d icon", "%d icons", value).format(value);
+ }));
+ },
+
_bindSettings: function() {
// size options
let panel_size_scale = this._builder.get_object('panel_size_scale');
@@ -2065,7 +2143,7 @@ const Preferences = new Lang.Class({
this._builder.get_object('animate_appicon_hover_button').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('App icon animation options'),
- transient_for: this.widget.get_toplevel(),
+ transient_for: this.notebook.get_root(),
use_header_bar: true,
modal: true });
@@ -2074,7 +2152,7 @@ const Preferences = new Lang.Class({
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('animate_appicon_hover_options');
- dialog.get_content_area().add(box);
+ dialog.get_content_area().append(box);
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
@@ -2094,7 +2172,7 @@ const Preferences = new Lang.Class({
return;
}));
- dialog.show_all();
+ dialog.show();
}));
@@ -2228,30 +2306,6 @@ const BuilderScope = GObject.registerClass({
connectObject.set_label("Clicked");
}
- animate_appicon_hover_options_duration_scale_format_value_cb(scale, value) {
- return _("%d ms").format(value);
- }
-
- animate_appicon_hover_options_rotation_scale_format_value_cb(scale, value) {
- return _("%d °").format(value);
- }
-
- animate_appicon_hover_options_travel_scale_format_value_cb(scale, value) {
- return _("%d %%").format(value);
- }
-
- animate_appicon_hover_options_zoom_scale_format_value_cb(scale, value) {
- return _("%d %%").format(value);
- }
-
- animate_appicon_hover_options_convexity_scale_format_value_cb(scale, value) {
- return _("%.1f").format(value);
- }
-
- animate_appicon_hover_options_extent_scale_format_value_cb(scale, value) {
- return Gettext.ngettext("%d icon", "%d icons", value).format(value);
- }
-
position_bottom_button_clicked_cb(button) {
if (!this._preferences._ignorePositionRadios && button.get_active()) this._preferences._setPanelPosition(Pos.BOTTOM);
}
@@ -2298,10 +2352,6 @@ const BuilderScope = GObject.registerClass({
this._preferences._settings.set_string('window-preview-title-position', 'TOP');
}
- panel_size_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
panel_size_scale_value_changed_cb(scale) {
// Avoid settings the size continuously
if (this._preferences._panel_size_timeout > 0)
@@ -2320,10 +2370,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- tray_size_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
tray_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._tray_size_timeout > 0)
@@ -2336,10 +2382,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- leftbox_size_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
leftbox_size_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._leftbox_size_timeout > 0)
@@ -2352,10 +2394,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- appicon_margin_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
appicon_margin_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._appicon_margin_timeout > 0)
@@ -2368,10 +2406,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- appicon_padding_scale_format_value_cb(scale, value) {
- return value + ' px';
- }
-
appicon_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._appicon_padding_timeout > 0)
@@ -2384,10 +2418,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- tray_padding_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
tray_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._tray_padding_timeout > 0)
@@ -2400,10 +2430,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- statusicon_padding_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
statusicon_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._statusicon_padding_timeout > 0)
@@ -2416,10 +2442,6 @@ const BuilderScope = GObject.registerClass({
}));
}
- leftbox_padding_scale_format_value_cb(scale, value) {
- return value+ ' px';
- }
-
leftbox_padding_scale_value_changed_cb(scale) {
// Avoid settings the size consinuosly
if (this._preferences._leftbox_padding_timeout > 0)