Configurable icon leave preview timeout. Fixes #19

This commit is contained in:
jderose9
2017-01-24 23:11:51 -05:00
parent 3a346513fa
commit 049935becf
4 changed files with 152 additions and 12 deletions

View File

@@ -239,9 +239,6 @@
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -255,6 +252,100 @@
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="leave_timeout_adjustment">
<property name="upper">9999</property>
<property name="step_increment">25</property>
<property name="page_increment">100</property>
</object>
<object class="GtkBox" id="box_advanced_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkFrame" id="frame_advanced_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkListBox" id="listbox_advanced_options">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow" id="listboxrow_leave_timeout">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="grid_leave_timeout">
<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="leave_timeout_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Preview timeout on icon leave (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="GtkLabel" id="leave_timeout_description">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">If set too low, the window preview of running applications may seem to close too quickly when trying to enter the popup. If set too high, the taskbar may feel slow to highlight applications.</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
<property name="xalign">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="leave_timeout_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="width_chars">4</property>
<property name="adjustment">leave_timeout_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>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<object class="GtkAdjustment" id="leftbox_padding_adjustment">
<property name="lower">0.33000000000000002</property>
<property name="upper">1</property>
@@ -731,11 +822,9 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
@@ -928,9 +1017,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkFrame" id="built_in_theme_frame3">
<property name="can_focus">False</property>
@@ -1051,11 +1137,22 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkButton" id="button_advanced_options">
<property name="label" translatable="yes">Advanced Options</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>

View File

@@ -232,6 +232,44 @@ const Settings = new Lang.Class({
}));
// setup dialog for advanced options
this._builder.get_object('button_advanced_options').connect('clicked', Lang.bind(this, function() {
let dialog = new Gtk.Dialog({ title: _('Advanced Options'),
transient_for: this.widget.get_toplevel(),
use_header_bar: true,
modal: true });
// GTK+ leaves positive values for application-defined response ids.
// Use +1 for the reset action
dialog.add_button(_('Reset to defaults'), 1);
let box = this._builder.get_object('box_advanced_options');
dialog.get_content_area().add(box);
this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout'));
this._builder.get_object('leave_timeout_spinbutton').connect('changed', Lang.bind (this, function(widget) {
this._settings.set_int('leave-timeout', widget.get_value());
}));
dialog.connect('response', Lang.bind(this, function(dialog, id) {
if (id == 1) {
// restore default settings
this._settings.set_int('leave-timeout', 100);
this._builder.get_object('leave_timeout_spinbutton').set_value(this._settings.get_int('leave-timeout'));
} else {
// remove the settings box so it doesn't get destroyed;
dialog.get_content_area().remove(box);
dialog.destroy();
}
return;
}));
dialog.show_all();
}));
// Appearance panel
let sizeScales = [

View File

@@ -107,6 +107,11 @@
<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>
<key type="i" name="leave-timeout">
<default>100</default>
<summary>Icon leave preview timeout</summary>
<description>Amount of time to leave preview windows open when the mouse has left the application's icon.</description>
</key>
<key type="i" name="tray-size">
<default>0</default>
<summary>Tray font size</summary>

View File

@@ -130,7 +130,7 @@ const thumbnailPreviewMenu = new Lang.Class({
this.shouldClose = true;
this.shouldOpen = false;
Mainloop.timeout_add(100, Lang.bind(this, this.hoverClose));
Mainloop.timeout_add(this._dtpSettings.get_int('leave-timeout'), Lang.bind(this, this.hoverClose));
},
hoverOpen: function () {