Add setting to define previews animation time

This commit is contained in:
Charles Gagnon
2019-05-24 18:17:13 -04:00
parent 78760e2bf6
commit d2b969d157
4 changed files with 68 additions and 5 deletions

View File

@@ -2158,6 +2158,11 @@
<property name="step_increment">10</property>
<property name="page_increment">25</property>
</object>
<object class="GtkAdjustment" id="preview_animation_time_adjustment">
<property name="upper">1000</property>
<property name="step_increment">10</property>
<property name="page_increment">50</property>
</object>
<object class="GtkAdjustment" id="preview_height_adjustment">
<property name="lower">50</property>
<property name="upper">500</property>
@@ -2290,6 +2295,50 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow_animation_time">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_animation_time">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkLabel" id="animation_time_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Animation time (ms)</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="animation_time_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">4</property>
<property name="text">0</property>
<property name="adjustment">preview_animation_time_adjustment</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listbox_preview_middle_click_close">
<property name="visible">True</property>

View File

@@ -1061,6 +1061,11 @@ const Settings = new Lang.Class({
this._settings.set_int('leave-timeout', widget.get_value());
}));
this._builder.get_object('animation_time_spinbutton').set_value(this._settings.get_int('window-preview-animation-time'));
this._builder.get_object('animation_time_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
this._settings.set_int('window-preview-animation-time', widget.get_value());
}));
this._builder.get_object('peek_mode_opacity_spinbutton').set_value(this._settings.get_int('peek-mode-opacity'));
this._builder.get_object('peek_mode_opacity_spinbutton').connect('value-changed', Lang.bind (this, function(widget) {
this._settings.set_int('peek-mode-opacity', widget.get_value());
@@ -1099,7 +1104,10 @@ const Settings = new Lang.Class({
this._builder.get_object('preview_timeout_spinbutton').set_value(this._settings.get_int('show-window-previews-timeout'));
this._settings.set_value('leave-timeout', this._settings.get_default_value('leave-timeout'));
this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout'));
this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout'));
this._settings.set_value('window-preview-animation-time', this._settings.get_default_value('window-preview-animation-time'));
this._builder.get_object('animation_time_spinbutton').set_value(this._settings.get_int('window-preview-animation-time'));
this._settings.set_value('peek-mode', this._settings.get_default_value('peek-mode'));
this._settings.set_value('window-preview-show-title', this._settings.get_default_value('window-preview-show-title'));

View File

@@ -413,12 +413,17 @@
<key type="s" name="window-preview-title-font-color">
<default>"#dddddd"</default>
<summary>Window previews title font color</summary>
<description>This defines the Window previews titles font color.</description>
<description>This defines the window preview titles font color.</description>
</key>
<key type="i" name="window-preview-title-font-size">
<default>14</default>
<summary>Window previews title font size</summary>
<description>This defines the Window previews titles font size.</description>
<description>This defines the window preview titles font size.</description>
</key>
<key type="i" name="window-preview-animation-time">
<default>300</default>
<summary>Window previews animation time</summary>
<description>This defines the window previews animation time.</description>
</key>
<key name="window-preview-title-font-weight" enum="org.gnome.shell.extensions.dash-to-panel.fontWeight">
<default>'inherit'</default>

View File

@@ -17,7 +17,6 @@
const Clutter = imports.gi.Clutter;
const Config = imports.misc.config;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Main = imports.ui.main;
const Mainloop = imports.mainloop;
@@ -48,6 +47,7 @@ const PEEK_INDEX_PROP = '_dtpPeekInitialIndex';
var headerHeight = 0;
var isLeftButtons = false;
var scaleFactor = 1;
var animationTime = 0;
var PreviewMenu = Utils.defineClass({
Name: 'DashToPanel-PreviewMenu',
@@ -333,6 +333,7 @@ var PreviewMenu = Utils.defineClass({
isLeftButtons = Meta.prefs_get_button_layout().left_buttons.indexOf(Meta.ButtonFunction.CLOSE) >= 0;
scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
headerHeight = this._dtpSettings.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0;
animationTime = this._dtpSettings.get_int('window-preview-animation-time') * .001;
},
_resetHiddenState: function() {
@@ -862,7 +863,7 @@ var Preview = Utils.defineClass({
function getTweenOpts(opts) {
let defaults = {
time: Taskbar.DASH_ANIMATION_TIME * 1.5,
time: animationTime,
transition: 'easeInOutQuad'
};