2016-12-23 11:08:39 -05:00
/ *
* This file is part of the Dash - To - Panel extension for Gnome 3
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*
*
* Credits :
* This file is based on code from the Dash to Dock extension by micheleg .
* Some code was also adapted from the upstream Gnome Shell source code .
* /
2016-12-22 18:12:04 -05:00
2018-03-11 16:09:21 -06:00
const GdkPixbuf = imports . gi . GdkPixbuf ;
2016-12-22 18:12:04 -05:00
const Gio = imports . gi . Gio ;
const GLib = imports . gi . GLib ;
const GObject = imports . gi . GObject ;
const Gtk = imports . gi . Gtk ;
const Gdk = imports . gi . Gdk ;
const Lang = imports . lang ;
const Mainloop = imports . mainloop ;
const Me = imports . misc . extensionUtils . getCurrentExtension ( ) ;
const Convenience = Me . imports . convenience ;
2019-03-17 00:08:07 -04:00
const Gettext = imports . gettext . domain ( Me . metadata [ 'gettext-domain' ] ) ;
2019-03-10 11:24:07 -04:00
const _ = Gettext . gettext ;
const N _ = function ( e ) { return e } ;
2019-10-28 23:59:13 -04:00
const Update = Me . imports . update ;
2016-12-22 18:12:04 -05:00
const SCALE _UPDATE _TIMEOUT = 500 ;
const DEFAULT _PANEL _SIZES = [ 128 , 96 , 64 , 48 , 32 , 24 , 16 ] ;
2016-12-23 16:19:46 -05:00
const DEFAULT _FONT _SIZES = [ 96 , 64 , 48 , 32 , 24 , 16 , 0 ] ;
2017-01-04 09:11:09 -05:00
const DEFAULT _MARGIN _SIZES = [ 32 , 24 , 16 , 12 , 8 , 4 , 0 ] ;
const DEFAULT _PADDING _SIZES = [ 32 , 24 , 16 , 12 , 8 , 4 , 0 , - 1 ] ;
2017-02-19 08:17:15 -05:00
const MAX _WINDOW _INDICATOR = 4 ;
2016-12-22 18:12:04 -05:00
2018-12-09 17:12:23 -05:00
const SCHEMA _PATH = '/org/gnome/shell/extensions/dash-to-panel/' ;
const GSET = 'gnome-shell-extension-tool' ;
2017-02-18 17:22:05 -05:00
/ * *
* This function was copied from the activities - config extension
* https : //github.com/nls1729/acme-code/tree/master/activities-config
* by Norman L . Smith .
* /
function cssHexString ( css ) {
let rrggbb = '#' ;
let start ;
for ( let loop = 0 ; loop < 3 ; loop ++ ) {
let end = 0 ;
let xx = '' ;
for ( let loop = 0 ; loop < 2 ; loop ++ ) {
while ( true ) {
let x = css . slice ( end , end + 1 ) ;
if ( ( x == '(' ) || ( x == ',' ) || ( x == ')' ) )
break ;
end ++ ;
}
if ( loop == 0 ) {
end ++ ;
start = end ;
}
}
xx = parseInt ( css . slice ( start , end ) ) . toString ( 16 ) ;
if ( xx . length == 1 )
xx = '0' + xx ;
rrggbb += xx ;
css = css . slice ( end ) ;
}
return rrggbb ;
}
2018-10-24 22:10:17 -04:00
function setShortcut ( settings , shortcutName ) {
let shortcut _text = settings . get _string ( shortcutName + '-text' ) ;
2017-05-26 17:03:57 -04:00
let [ key , mods ] = Gtk . accelerator _parse ( shortcut _text ) ;
if ( Gtk . accelerator _valid ( key , mods ) ) {
let shortcut = Gtk . accelerator _name ( key , mods ) ;
2018-10-24 22:10:17 -04:00
settings . set _strv ( shortcutName , [ shortcut ] ) ;
2017-05-26 17:03:57 -04:00
}
else {
2018-10-24 22:10:17 -04:00
settings . set _strv ( shortcutName , [ ] ) ;
2017-05-26 17:03:57 -04:00
}
}
2017-03-28 15:51:59 -04:00
function checkHotkeyPrefix ( settings ) {
settings . delay ( ) ;
let hotkeyPrefix = settings . get _string ( 'hotkey-prefix-text' ) ;
if ( hotkeyPrefix == 'Super' )
hotkeyPrefix = '<Super>' ;
else if ( hotkeyPrefix == 'SuperAlt' )
hotkeyPrefix = '<Super><Alt>' ;
let [ , mods ] = Gtk . accelerator _parse ( hotkeyPrefix ) ;
let [ , shift _mods ] = Gtk . accelerator _parse ( '<Shift>' + hotkeyPrefix ) ;
let [ , ctrl _mods ] = Gtk . accelerator _parse ( '<Ctrl>' + hotkeyPrefix ) ;
let numHotkeys = 10 ;
for ( let i = 1 ; i <= numHotkeys ; i ++ ) {
let number = i ;
if ( number == 10 )
number = 0 ;
let key = Gdk . keyval _from _name ( number . toString ( ) ) ;
let key _kp = Gdk . keyval _from _name ( 'KP_' + number . toString ( ) ) ;
if ( Gtk . accelerator _valid ( key , mods ) ) {
let shortcut = Gtk . accelerator _name ( key , mods ) ;
let shortcut _kp = Gtk . accelerator _name ( key _kp , mods ) ;
// Setup shortcut strings
settings . set _strv ( 'app-hotkey-' + i , [ shortcut ] ) ;
settings . set _strv ( 'app-hotkey-kp-' + i , [ shortcut _kp ] ) ;
// With <Shift>
shortcut = Gtk . accelerator _name ( key , shift _mods ) ;
shortcut _kp = Gtk . accelerator _name ( key _kp , shift _mods ) ;
settings . set _strv ( 'app-shift-hotkey-' + i , [ shortcut ] ) ;
settings . set _strv ( 'app-shift-hotkey-kp-' + i , [ shortcut _kp ] ) ;
// With <Control>
shortcut = Gtk . accelerator _name ( key , ctrl _mods ) ;
shortcut _kp = Gtk . accelerator _name ( key _kp , ctrl _mods ) ;
settings . set _strv ( 'app-ctrl-hotkey-' + i , [ shortcut ] ) ;
settings . set _strv ( 'app-ctrl-hotkey-kp-' + i , [ shortcut _kp ] ) ;
}
else {
// Reset default settings for the relevant keys if the
// accelerators are invalid
let keys = [ 'app-hotkey-' + i , 'app-shift-hotkey-' + i , 'app-ctrl-hotkey-' + i , // Regular numbers
'app-hotkey-kp-' + i , 'app-shift-hotkey-kp-' + i , 'app-ctrl-hotkey-kp-' + i ] ; // Key-pad numbers
keys . forEach ( function ( val ) {
settings . set _value ( val , settings . get _default _value ( val ) ) ;
} , this ) ;
}
}
settings . apply ( ) ;
}
2018-12-09 17:12:23 -05:00
function mergeObjects ( main , bck ) {
for ( var prop in bck ) {
if ( ! main . hasOwnProperty ( prop ) && bck . hasOwnProperty ( prop ) ) {
main [ prop ] = bck [ prop ] ;
}
}
return main ;
} ;
2016-12-22 18:12:04 -05:00
const Settings = new Lang . Class ( {
2017-01-10 18:35:10 -05:00
Name : 'DashToPanel.Settings' ,
2016-12-22 18:12:04 -05:00
_init : function ( ) {
2016-12-23 11:32:23 -05:00
this . _settings = Convenience . getSettings ( 'org.gnome.shell.extensions.dash-to-panel' ) ;
2016-12-22 18:12:04 -05:00
this . _rtl = ( Gtk . Widget . get _default _direction ( ) == Gtk . TextDirection . RTL ) ;
this . _builder = new Gtk . Builder ( ) ;
this . _builder . set _translation _domain ( Me . metadata [ 'gettext-domain' ] ) ;
this . _builder . add _from _file ( Me . path + '/Settings.ui' ) ;
2017-05-12 17:16:57 -04:00
this . notebook = this . _builder . get _object ( 'settings_notebook' ) ;
this . viewport = new Gtk . Viewport ( ) ;
this . viewport . add ( this . notebook ) ;
this . widget = new Gtk . ScrolledWindow ( ) ;
this . widget . add ( this . viewport ) ;
2016-12-22 18:12:04 -05:00
// Timeout to delay the update of the settings
this . _panel _size _timeout = 0 ;
2017-02-17 23:48:12 -05:00
this . _dot _height _timeout = 0 ;
2016-12-31 08:24:23 -05:00
this . _tray _size _timeout = 0 ;
this . _leftbox _size _timeout = 0 ;
this . _appicon _margin _timeout = 0 ;
2018-04-12 17:23:59 -05:00
this . _appicon _padding _timeout = 0 ;
2018-10-14 13:35:07 -04:00
this . _opacity _timeout = 0 ;
2017-01-04 09:11:09 -05:00
this . _tray _padding _timeout = 0 ;
this . _statusicon _padding _timeout = 0 ;
this . _leftbox _padding _timeout = 0 ;
2016-12-22 18:12:04 -05:00
this . _bindSettings ( ) ;
this . _builder . connect _signals _full ( Lang . bind ( this , this . _connector ) ) ;
} ,
/ * *
* Connect signals
* /
_connector : function ( builder , object , signal , handler ) {
object . connect ( signal , Lang . bind ( this , this . _SignalHandler [ handler ] ) ) ;
} ,
2019-09-10 09:58:14 -04:00
_updateVerticalRelatedOptions : function ( ) {
let position = this . _settings . get _string ( 'panel-position' ) ;
let isVertical = position == 'LEFT' || position == 'RIGHT' ;
let taskbarLocationCombo = this . _builder . get _object ( 'taskbar_position_combo' ) ;
let clockLocationCombo = this . _builder . get _object ( 'location_clock_combo' ) ;
2019-09-15 17:00:55 -04:00
let showDesktopWidthLabel = this . _builder . get _object ( 'show_showdesktop_width_label' ) ;
2019-09-10 09:58:14 -04:00
taskbarLocationCombo . remove _all ( ) ;
clockLocationCombo . remove _all ( ) ;
[
[ 'LEFTPANEL' , isVertical ? _ ( 'Top, with plugin icons collapsed to bottom' ) : _ ( 'Left, with plugin icons collapsed to right' ) ] ,
[ 'LEFTPANEL_FIXEDCENTER' , isVertical ? _ ( 'Top, with fixed center plugin icons' ) : _ ( 'Left, with fixed center plugin icons' ) ] ,
[ 'LEFTPANEL_FLOATCENTER' , isVertical ? _ ( 'Top, with floating center plugin icons' ) : _ ( 'Left, with floating center plugin icons' ) ] ,
[ 'CENTEREDMONITOR' , _ ( 'Center, fixed in middle of monitor' ) ] ,
[ 'CENTEREDCONTENT' , isVertical ? _ ( 'Center, floating between top and bottom elements' ) : _ ( 'Center, floating between left and right elements' ) ]
] . forEach ( tl => taskbarLocationCombo . append . apply ( taskbarLocationCombo , tl ) ) ;
[
[ 'BUTTONSLEFT' , isVertical ? _ ( 'Top of plugin icons' ) : _ ( 'Left of plugin icons' ) ] ,
[ 'BUTTONSRIGHT' , isVertical ? _ ( 'Bottom of plugin icons' ) : _ ( 'Right of plugin icons' ) ] ,
[ 'STATUSLEFT' , isVertical ? _ ( 'Top of system indicators' ) : _ ( 'Left of system indicators' ) ] ,
[ 'STATUSRIGHT' , isVertical ? _ ( 'Bottom of system indicators' ) : _ ( 'Right of system indicators' ) ] ,
[ 'TASKBARLEFT' , isVertical ? _ ( 'Top of taskbar' ) : _ ( 'Left of taskbar' ) ] ,
[ 'TASKBARRIGHT' , isVertical ? _ ( 'Bottom of taskbar' ) : _ ( 'Right of taskbar' ) ]
] . forEach ( cl => clockLocationCombo . append . apply ( clockLocationCombo , cl ) ) ;
2019-09-15 17:00:55 -04:00
2019-09-10 09:58:14 -04:00
taskbarLocationCombo . set _active _id ( this . _settings . get _string ( 'taskbar-position' ) ) ;
clockLocationCombo . set _active _id ( this . _settings . get _string ( 'location-clock' ) ) ;
2019-09-15 17:00:55 -04:00
showDesktopWidthLabel . set _text ( isVertical ? _ ( 'Show Desktop button height (px)' ) : _ ( 'Show Desktop button width (px)' ) ) ;
2019-09-10 09:58:14 -04:00
} ,
2020-05-02 12:57:21 -04:00
_setPositionRadios : function ( ) {
2016-12-28 20:22:12 -05:00
let position = this . _settings . get _string ( 'panel-position' ) ;
2016-12-22 18:12:04 -05:00
switch ( position ) {
2016-12-28 20:22:12 -05:00
case 'BOTTOM' :
2016-12-22 18:12:04 -05:00
this . _builder . get _object ( 'position_bottom_button' ) . set _active ( true ) ;
break ;
2016-12-28 20:22:12 -05:00
case 'TOP' :
2016-12-22 18:12:04 -05:00
this . _builder . get _object ( 'position_top_button' ) . set _active ( true ) ;
break ;
2019-07-30 19:25:30 -04:00
case 'LEFT' :
this . _builder . get _object ( 'position_left_button' ) . set _active ( true ) ;
break ;
case 'RIGHT' :
this . _builder . get _object ( 'position_right_button' ) . set _active ( true ) ;
break ;
2016-12-22 18:12:04 -05:00
}
2020-05-02 12:57:21 -04:00
} ,
_bindSettings : function ( ) {
// Position and style panel
// Position option
this . _setPositionRadios ( ) ;
2016-12-22 18:12:04 -05:00
2019-09-10 09:58:14 -04:00
this . _settings . connect ( 'changed::panel-position' , ( ) => this . _updateVerticalRelatedOptions ( ) ) ;
this . _updateVerticalRelatedOptions ( ) ;
2016-12-25 16:24:01 -05:00
this . _builder . get _object ( 'location_clock_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
2019-09-15 17:00:55 -04:00
let activeId = widget . get _active _id ( ) ;
if ( activeId ) {
this . _settings . set _string ( 'location-clock' , activeId ) ;
}
2016-12-25 16:24:01 -05:00
} ) ) ;
2017-11-07 18:46:37 +01:00
this . _builder . get _object ( 'taskbar_position_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
2019-09-15 17:00:55 -04:00
let activeId = widget . get _active _id ( ) ;
if ( activeId ) {
this . _settings . set _string ( 'taskbar-position' , activeId ) ;
}
2017-11-07 18:46:37 +01:00
} ) ) ;
2016-12-25 16:24:01 -05:00
2016-12-22 18:12:04 -05:00
// size options
let panel _size _scale = this . _builder . get _object ( 'panel_size_scale' ) ;
panel _size _scale . set _range ( DEFAULT _PANEL _SIZES [ DEFAULT _PANEL _SIZES . length - 1 ] , DEFAULT _PANEL _SIZES [ 0 ] ) ;
panel _size _scale . set _value ( this . _settings . get _int ( 'panel-size' ) ) ;
DEFAULT _PANEL _SIZES . slice ( 1 , - 1 ) . forEach ( function ( val ) {
panel _size _scale . add _mark ( val , Gtk . PositionType . TOP , val . toString ( ) ) ;
} ) ;
// Corrent for rtl languages
if ( this . _rtl ) {
// Flip value position: this is not done automatically
panel _size _scale . set _value _pos ( Gtk . PositionType . LEFT ) ;
// I suppose due to a bug, having a more than one mark and one above a value of 100
// makes the rendering of the marks wrong in rtl. This doesn't happen setting the scale as not flippable
// and then manually inverting it
panel _size _scale . set _flippable ( false ) ;
panel _size _scale . set _inverted ( true ) ;
}
2016-12-30 18:24:22 -05:00
// Dots Position option
let dotPosition = this . _settings . get _string ( 'dot-position' ) ;
switch ( dotPosition ) {
case 'BOTTOM' :
this . _builder . get _object ( 'dots_bottom_button' ) . set _active ( true ) ;
break ;
case 'TOP' :
this . _builder . get _object ( 'dots_top_button' ) . set _active ( true ) ;
break ;
2019-09-05 22:58:48 -04:00
case 'LEFT' :
this . _builder . get _object ( 'dots_left_button' ) . set _active ( true ) ;
break ;
case 'RIGHT' :
this . _builder . get _object ( 'dots_right_button' ) . set _active ( true ) ;
break ;
2016-12-30 18:24:22 -05:00
}
2017-02-17 23:48:12 -05:00
this . _builder . get _object ( 'dot_style_focused_combo' ) . set _active _id ( this . _settings . get _string ( 'dot-style-focused' ) ) ;
this . _builder . get _object ( 'dot_style_focused_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'dot-style-focused' , widget . get _active _id ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'dot_style_unfocused_combo' ) . set _active _id ( this . _settings . get _string ( 'dot-style-unfocused' ) ) ;
this . _builder . get _object ( 'dot_style_unfocused_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'dot-style-unfocused' , widget . get _active _id ( ) ) ;
} ) ) ;
2017-02-19 08:17:15 -05:00
for ( let i = 1 ; i <= MAX _WINDOW _INDICATOR ; i ++ ) {
let idx = i ;
this . _builder . get _object ( 'dot_color_' + idx + '_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'dot-color-' + idx , hexString ) ;
} ) ) ;
2017-02-22 16:57:53 -05:00
this . _builder . get _object ( 'dot_color_unfocused_' + idx + '_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'dot-color-unfocused-' + idx , hexString ) ;
} ) ) ;
2017-02-19 08:17:15 -05:00
}
2017-02-18 17:22:05 -05:00
2017-02-22 16:57:53 -05:00
this . _builder . get _object ( 'dot_color_apply_all_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
for ( let i = 2 ; i <= MAX _WINDOW _INDICATOR ; i ++ ) {
2018-01-14 13:53:58 -05:00
this . _settings . set _value ( 'dot-color-' + i , this . _settings . get _value ( 'dot-color-1' ) ) ;
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'dot-color-' + i ) ) ;
this . _builder . get _object ( 'dot_color_' + i + '_colorbutton' ) . set _rgba ( rgba ) ;
2017-02-22 16:57:53 -05:00
}
} ) ) ;
2018-01-14 13:53:58 -05:00
this . _builder . get _object ( 'dot_color_unfocused_apply_all_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
2017-02-22 16:57:53 -05:00
for ( let i = 2 ; i <= MAX _WINDOW _INDICATOR ; i ++ ) {
2018-01-14 13:53:58 -05:00
this . _settings . set _value ( 'dot-color-unfocused-' + i , this . _settings . get _value ( 'dot-color-unfocused-1' ) ) ;
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'dot-color-unfocused-' + i ) ) ;
this . _builder . get _object ( 'dot_color_unfocused_' + i + '_colorbutton' ) . set _rgba ( rgba ) ;
2017-02-22 16:57:53 -05:00
}
} ) ) ;
2018-01-14 13:53:58 -05:00
this . _builder . get _object ( 'focus_highlight_color_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'focus-highlight-color' , hexString ) ;
} ) ) ;
2017-02-17 23:48:12 -05:00
this . _builder . get _object ( 'dot_style_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
2017-02-17 22:11:16 -05:00
let dialog = new Gtk . Dialog ( { title : _ ( 'Running Indicator 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_dots_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
2019-05-02 10:08:14 -07:00
this . _settings . bind ( 'dot-color-dominant' ,
this . _builder . get _object ( 'dot_color_dominant_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-17 23:48:12 -05:00
this . _settings . bind ( 'dot-color-override' ,
this . _builder . get _object ( 'dot_color_override_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-22 16:57:53 -05:00
2019-05-02 10:08:14 -07:00
// when either becomes active, turn the other off
this . _builder . get _object ( 'dot_color_dominant_switch' ) . connect ( 'state-set' , Lang . bind ( this , function ( widget ) {
if ( widget . get _active ( ) ) this . _settings . set _boolean ( 'dot-color-override' , false ) ;
} ) ) ;
this . _builder . get _object ( 'dot_color_override_switch' ) . connect ( 'state-set' , Lang . bind ( this , function ( widget ) {
if ( widget . get _active ( ) ) this . _settings . set _boolean ( 'dot-color-dominant' , false ) ;
} ) ) ;
2017-02-22 16:57:53 -05:00
this . _settings . bind ( 'dot-color-unfocused-different' ,
this . _builder . get _object ( 'dot_color_unfocused_different_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'dot-color-override' ,
this . _builder . get _object ( 'grid_dot_color' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-19 08:17:15 -05:00
2017-02-22 16:57:53 -05:00
this . _settings . bind ( 'dot-color-override' ,
this . _builder . get _object ( 'dot_color_unfocused_box' ) ,
2017-02-19 08:17:15 -05:00
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-22 16:57:53 -05:00
this . _settings . bind ( 'dot-color-unfocused-different' ,
this . _builder . get _object ( 'grid_dot_color_unfocused' ) ,
2017-02-19 08:17:15 -05:00
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-22 16:57:53 -05:00
for ( let i = 1 ; i <= MAX _WINDOW _INDICATOR ; i ++ ) {
2017-02-19 08:17:15 -05:00
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'dot-color-' + i ) ) ;
this . _builder . get _object ( 'dot_color_' + i + '_colorbutton' ) . set _rgba ( rgba ) ;
2017-02-22 16:57:53 -05:00
rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'dot-color-unfocused-' + i ) ) ;
this . _builder . get _object ( 'dot_color_unfocused_' + i + '_colorbutton' ) . set _rgba ( rgba ) ;
2017-02-19 08:17:15 -05:00
}
2017-02-17 23:48:12 -05:00
this . _settings . bind ( 'focus-highlight' ,
this . _builder . get _object ( 'focus_highlight_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-01-17 12:37:32 -05:00
this . _settings . bind ( 'focus-highlight' ,
this . _builder . get _object ( 'grid_focus_highlight_options' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-02 21:21:13 -07:00
this . _settings . bind ( 'focus-highlight-dominant' ,
this . _builder . get _object ( 'focus_highlight_dominant_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'focus-highlight-dominant' ,
this . _builder . get _object ( 'focus_highlight_color_label' ) ,
'sensitive' ,
Gio . SettingsBindFlags . INVERT _BOOLEAN ) ;
this . _settings . bind ( 'focus-highlight-dominant' ,
this . _builder . get _object ( 'focus_highlight_color_colorbutton' ) ,
'sensitive' ,
Gio . SettingsBindFlags . INVERT _BOOLEAN ) ;
2018-01-14 13:53:58 -05:00
( function ( ) {
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'focus-highlight-color' ) ) ;
this . _builder . get _object ( 'focus_highlight_color_colorbutton' ) . set _rgba ( rgba ) ;
} ) . apply ( this ) ;
this . _builder . get _object ( 'focus_highlight_opacity_spinbutton' ) . set _value ( this . _settings . get _int ( 'focus-highlight-opacity' ) ) ;
this . _builder . get _object ( 'focus_highlight_opacity_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'focus-highlight-opacity' , widget . get _value ( ) ) ;
} ) ) ;
2017-02-17 23:48:12 -05:00
this . _builder . get _object ( 'dot_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'dot-size' ) ) ;
this . _builder . get _object ( 'dot_size_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'dot-size' , widget . get _value ( ) ) ;
} ) ) ;
2017-02-17 22:11:16 -05:00
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
2019-05-02 10:08:14 -07:00
this . _settings . set _value ( 'dot-color-dominant' , this . _settings . get _default _value ( 'dot-color-dominant' ) ) ;
2017-02-17 23:48:12 -05:00
this . _settings . set _value ( 'dot-color-override' , this . _settings . get _default _value ( 'dot-color-override' ) ) ;
2017-02-22 16:57:53 -05:00
this . _settings . set _value ( 'dot-color-unfocused-different' , this . _settings . get _default _value ( 'dot-color-unfocused-different' ) ) ;
2017-02-17 23:48:12 -05:00
2018-01-14 13:53:58 -05:00
this . _settings . set _value ( 'focus-highlight-color' , this . _settings . get _default _value ( 'focus-highlight-color' ) ) ;
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'focus-highlight-color' ) ) ;
this . _builder . get _object ( 'focus_highlight_color_colorbutton' ) . set _rgba ( rgba ) ;
this . _settings . set _value ( 'focus-highlight-opacity' , this . _settings . get _default _value ( 'focus-highlight-opacity' ) ) ;
this . _builder . get _object ( 'focus_highlight_opacity_spinbutton' ) . set _value ( this . _settings . get _int ( 'focus-highlight-opacity' ) ) ;
2017-02-19 08:17:15 -05:00
for ( let i = 1 ; i <= MAX _WINDOW _INDICATOR ; i ++ ) {
this . _settings . set _value ( 'dot-color-' + i , this . _settings . get _default _value ( 'dot-color-' + i ) ) ;
2018-01-14 13:53:58 -05:00
rgba = new Gdk . RGBA ( ) ;
2017-02-19 08:17:15 -05:00
rgba . parse ( this . _settings . get _string ( 'dot-color-' + i ) ) ;
this . _builder . get _object ( 'dot_color_' + i + '_colorbutton' ) . set _rgba ( rgba ) ;
2017-02-22 16:57:53 -05:00
this . _settings . set _value ( 'dot-color-unfocused-' + i , this . _settings . get _default _value ( 'dot-color-unfocused-' + i ) ) ;
rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'dot-color-unfocused-' + i ) ) ;
this . _builder . get _object ( 'dot_color_unfocused_' + i + '_colorbutton' ) . set _rgba ( rgba ) ;
2017-02-19 08:17:15 -05:00
}
2017-02-17 23:48:12 -05:00
this . _settings . set _value ( 'dot-size' , this . _settings . get _default _value ( 'dot-size' ) ) ;
this . _builder . get _object ( 'dot_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'dot-size' ) ) ;
this . _settings . set _value ( 'focus-highlight' , this . _settings . get _default _value ( 'focus-highlight' ) ) ;
2019-05-02 21:21:13 -07:00
this . _settings . set _value ( 'focus-highlight-dominant' , this . _settings . get _default _value ( 'focus-highlight-dominant' ) ) ;
2017-02-17 23:48:12 -05:00
2017-02-17 22:11:16 -05:00
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2018-10-04 21:36:56 -04:00
//multi-monitor
2019-01-03 13:21:56 -05:00
let monitors = [ - 1 ] ;
2018-10-04 21:36:56 -04:00
2019-01-03 13:21:56 -05:00
this . _builder . get _object ( 'multimon_primary_combo' ) . append _text ( _ ( 'Default (Primary monitor)' ) ) ;
2018-10-04 21:36:56 -04:00
2019-01-03 13:21:56 -05:00
for ( let i = 0 , monitorNum = Gdk . Screen . get _default ( ) . get _n _monitors ( ) ; i < monitorNum ; ++ i ) {
this . _builder . get _object ( 'multimon_primary_combo' ) . append _text ( _ ( 'Monitor ' ) + ( i + 1 ) ) ;
2018-10-04 21:36:56 -04:00
monitors . push ( i ) ;
}
this . _builder . get _object ( 'multimon_primary_combo' ) . set _active ( monitors . indexOf ( this . _settings . get _int ( 'primary-monitor' ) ) ) ;
this . _builder . get _object ( 'multimon_primary_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'primary-monitor' , monitors [ widget . get _active ( ) ] ) ;
} ) ) ;
this . _settings . bind ( 'multi-monitors' ,
this . _builder . get _object ( 'multimon_multi_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-10-07 14:12:08 -04:00
this . _settings . bind ( 'show-clock-all-monitors' ,
this . _builder . get _object ( 'multimon_multi_show_clock_switch' ) ,
'active' ,
2018-10-04 21:36:56 -04:00
Gio . SettingsBindFlags . DEFAULT ) ;
2018-10-09 19:40:07 -04:00
this . _settings . bind ( 'show-status-menu-all-monitors' ,
this . _builder . get _object ( 'multimon_multi_show_status_menu_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-10-22 18:02:02 -04:00
if ( monitors . length === 1 ) {
this . _builder . get _object ( 'multimon_multi_switch' ) . set _active ( false ) ;
}
2018-10-14 13:35:07 -04:00
//dynamic opacity
this . _settings . bind ( 'trans-use-custom-bg' ,
this . _builder . get _object ( 'trans_bg_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'trans-use-custom-bg' ,
this . _builder . get _object ( 'trans_bg_color_colorbutton' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'trans-bg-color' ) ) ;
this . _builder . get _object ( 'trans_bg_color_colorbutton' ) . set _rgba ( rgba ) ;
this . _builder . get _object ( 'trans_bg_color_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'trans-bg-color' , hexString ) ;
} ) ) ;
this . _settings . bind ( 'trans-use-custom-opacity' ,
this . _builder . get _object ( 'trans_opacity_override_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'trans-use-custom-opacity' ,
this . _builder . get _object ( 'trans_opacity_box' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _builder . get _object ( 'trans_opacity_override_switch' ) . connect ( 'notify::active' , ( widget ) => {
if ( ! widget . get _active ( ) )
this . _builder . get _object ( 'trans_dyn_switch' ) . set _active ( false ) ;
} ) ;
2018-10-17 13:21:51 -04:00
this . _builder . get _object ( 'trans_opacity_spinbutton' ) . set _value ( this . _settings . get _double ( 'trans-panel-opacity' ) * 100 ) ;
this . _builder . get _object ( 'trans_opacity_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _double ( 'trans-panel-opacity' , widget . get _value ( ) * 0.01 ) ;
} ) ) ;
2018-10-14 13:35:07 -04:00
this . _settings . bind ( 'trans-use-dynamic-opacity' ,
this . _builder . get _object ( 'trans_dyn_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'trans-use-dynamic-opacity' ,
this . _builder . get _object ( 'trans_dyn_options_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-10-15 10:21:34 -04:00
this . _settings . bind ( 'trans-dynamic-behavior' ,
this . _builder . get _object ( 'trans_options_window_type_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-10-17 13:21:51 -04:00
this . _settings . bind ( 'trans-use-custom-gradient' ,
this . _builder . get _object ( 'trans_gradient_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'trans-use-custom-gradient' ,
this . _builder . get _object ( 'trans_gradient_box' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
rgba . parse ( this . _settings . get _string ( 'trans-gradient-top-color' ) ) ;
this . _builder . get _object ( 'trans_gradient_color1_colorbutton' ) . set _rgba ( rgba ) ;
this . _builder . get _object ( 'trans_gradient_color1_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'trans-gradient-top-color' , hexString ) ;
} ) ) ;
this . _builder . get _object ( 'trans_gradient_color1_spinbutton' ) . set _value ( this . _settings . get _double ( 'trans-gradient-top-opacity' ) * 100 ) ;
this . _builder . get _object ( 'trans_gradient_color1_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _double ( 'trans-gradient-top-opacity' , widget . get _value ( ) * 0.01 ) ;
} ) ) ;
rgba . parse ( this . _settings . get _string ( 'trans-gradient-bottom-color' ) ) ;
this . _builder . get _object ( 'trans_gradient_color2_colorbutton' ) . set _rgba ( rgba ) ;
this . _builder . get _object ( 'trans_gradient_color2_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'trans-gradient-bottom-color' , hexString ) ;
} ) ) ;
this . _builder . get _object ( 'trans_gradient_color2_spinbutton' ) . set _value ( this . _settings . get _double ( 'trans-gradient-bottom-opacity' ) * 100 ) ;
this . _builder . get _object ( 'trans_gradient_color2_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _double ( 'trans-gradient-bottom-opacity' , widget . get _value ( ) * 0.01 ) ;
} ) ) ;
2018-10-14 13:35:07 -04:00
this . _builder . get _object ( 'trans_options_distance_spinbutton' ) . set _value ( this . _settings . get _int ( 'trans-dynamic-distance' ) ) ;
this . _builder . get _object ( 'trans_options_distance_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'trans-dynamic-distance' , widget . get _value ( ) ) ;
} ) ) ;
2018-10-17 13:21:51 -04:00
this . _builder . get _object ( 'trans_options_min_opacity_spinbutton' ) . set _value ( this . _settings . get _double ( 'trans-dynamic-anim-target' ) * 100 ) ;
this . _builder . get _object ( 'trans_options_min_opacity_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _double ( 'trans-dynamic-anim-target' , widget . get _value ( ) * 0.01 ) ;
} ) ) ;
2018-10-14 13:35:07 -04:00
this . _builder . get _object ( 'trans_options_anim_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'trans-dynamic-anim-time' ) ) ;
this . _builder . get _object ( 'trans_options_anim_time_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'trans-dynamic-anim-time' , widget . get _value ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'trans_dyn_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Dynamic opacity 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_dynamic_opacity_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
2018-10-15 10:21:34 -04:00
this . _settings . set _value ( 'trans-dynamic-behavior' , this . _settings . get _default _value ( 'trans-dynamic-behavior' ) ) ;
2018-10-14 13:35:07 -04:00
this . _settings . set _value ( 'trans-dynamic-distance' , this . _settings . get _default _value ( 'trans-dynamic-distance' ) ) ;
this . _builder . get _object ( 'trans_options_distance_spinbutton' ) . set _value ( this . _settings . get _int ( 'trans-dynamic-distance' ) ) ;
this . _settings . set _value ( 'trans-dynamic-anim-target' , this . _settings . get _default _value ( 'trans-dynamic-anim-target' ) ) ;
2018-10-18 00:33:37 -04:00
this . _builder . get _object ( 'trans_options_min_opacity_spinbutton' ) . set _value ( this . _settings . get _double ( 'trans-dynamic-anim-target' ) * 100 ) ;
2018-10-14 13:35:07 -04:00
this . _settings . set _value ( 'trans-dynamic-anim-time' , this . _settings . get _default _value ( 'trans-dynamic-anim-time' ) ) ;
this . _builder . get _object ( 'trans_options_anim_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'trans-dynamic-anim-time' ) ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2018-03-10 12:08:22 -06:00
this . _settings . bind ( 'intellihide' ,
this . _builder . get _object ( 'intellihide_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide' ,
this . _builder . get _object ( 'intellihide_options_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-hide-from-windows' ,
this . _builder . get _object ( 'intellihide_window_hide_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-hide-from-windows' ,
this . _builder . get _object ( 'intellihide_behaviour_options' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-behaviour' ,
this . _builder . get _object ( 'intellihide_behaviour_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-use-pressure' ,
this . _builder . get _object ( 'intellihide_use_pressure_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-use-pressure' ,
this . _builder . get _object ( 'intellihide_use_pressure_options' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-show-in-fullscreen' ,
this . _builder . get _object ( 'intellihide_show_in_fullscreen_switch' ) ,
'active' ,
2019-02-02 20:59:10 -05:00
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'intellihide-only-secondary' ,
this . _builder . get _object ( 'intellihide_only_secondary_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'multi-monitors' ,
this . _builder . get _object ( 'grid_intellihide_only_secondary' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _builder . get _object ( 'multimon_multi_switch' ) . connect ( 'notify::active' , ( widget ) => {
if ( ! widget . get _active ( ) )
this . _builder . get _object ( 'intellihide_only_secondary_switch' ) . set _active ( false ) ;
} ) ;
2018-03-10 12:08:22 -06:00
this . _builder . get _object ( 'intellihide_pressure_threshold_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-pressure-threshold' ) ) ;
this . _builder . get _object ( 'intellihide_pressure_threshold_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'intellihide-pressure-threshold' , widget . get _value ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'intellihide_pressure_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-pressure-time' ) ) ;
this . _builder . get _object ( 'intellihide_pressure_time_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'intellihide-pressure-time' , widget . get _value ( ) ) ;
} ) ) ;
2018-10-24 22:10:17 -04:00
this . _settings . bind ( 'intellihide-key-toggle-text' ,
this . _builder . get _object ( 'intellihide_toggle_entry' ) ,
'text' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . connect ( 'changed::intellihide-key-toggle-text' , ( ) => setShortcut ( this . _settings , 'intellihide-key-toggle' ) ) ;
2018-03-10 12:08:22 -06:00
this . _builder . get _object ( 'intellihide_animation_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-animation-time' ) ) ;
this . _builder . get _object ( 'intellihide_animation_time_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'intellihide-animation-time' , widget . get _value ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'intellihide_close_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-close-delay' ) ) ;
this . _builder . get _object ( 'intellihide_close_delay_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'intellihide-close-delay' , widget . get _value ( ) ) ;
} ) ) ;
2019-09-28 17:50:07 -04:00
this . _builder . get _object ( 'intellihide_enable_start_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-enable-start-delay' ) ) ;
this . _builder . get _object ( 'intellihide_enable_start_delay_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'intellihide-enable-start-delay' , widget . get _value ( ) ) ;
} ) ) ;
2018-03-10 12:08:22 -06:00
this . _builder . get _object ( 'intellihide_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Intellihide 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_intellihide_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'intellihide-hide-from-windows' , this . _settings . get _default _value ( 'intellihide-hide-from-windows' ) ) ;
this . _settings . set _value ( 'intellihide-behaviour' , this . _settings . get _default _value ( 'intellihide-behaviour' ) ) ;
this . _settings . set _value ( 'intellihide-use-pressure' , this . _settings . get _default _value ( 'intellihide-use-pressure' ) ) ;
this . _settings . set _value ( 'intellihide-show-in-fullscreen' , this . _settings . get _default _value ( 'intellihide-show-in-fullscreen' ) ) ;
2019-02-02 20:59:10 -05:00
this . _settings . set _value ( 'intellihide-only-secondary' , this . _settings . get _default _value ( 'intellihide-only-secondary' ) ) ;
2018-03-10 12:08:22 -06:00
this . _settings . set _value ( 'intellihide-pressure-threshold' , this . _settings . get _default _value ( 'intellihide-pressure-threshold' ) ) ;
this . _builder . get _object ( 'intellihide_pressure_threshold_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-pressure-threshold' ) ) ;
this . _settings . set _value ( 'intellihide-pressure-time' , this . _settings . get _default _value ( 'intellihide-pressure-time' ) ) ;
this . _builder . get _object ( 'intellihide_pressure_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-pressure-time' ) ) ;
2018-10-24 22:10:17 -04:00
this . _settings . set _value ( 'intellihide-key-toggle-text' , this . _settings . get _default _value ( 'intellihide-key-toggle-text' ) ) ;
2018-03-10 12:08:22 -06:00
this . _settings . set _value ( 'intellihide-animation-time' , this . _settings . get _default _value ( 'intellihide-animation-time' ) ) ;
this . _builder . get _object ( 'intellihide_animation_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-animation-time' ) ) ;
this . _settings . set _value ( 'intellihide-close-delay' , this . _settings . get _default _value ( 'intellihide-close-delay' ) ) ;
this . _builder . get _object ( 'intellihide_close_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-close-delay' ) ) ;
2019-09-28 17:50:07 -04:00
this . _settings . set _value ( 'intellihide-enable-start-delay' , this . _settings . get _default _value ( 'intellihide-enable-start-delay' ) ) ;
this . _builder . get _object ( 'intellihide_enable_start_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'intellihide-enable-start-delay' ) ) ;
2018-03-10 12:08:22 -06:00
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2016-12-22 18:12:04 -05:00
// Behavior panel
this . _settings . bind ( 'show-show-apps-button' ,
this . _builder . get _object ( 'show_applications_button_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-03-11 16:09:21 -06:00
this . _settings . bind ( 'show-show-apps-button' ,
this . _builder . get _object ( 'show_application_options_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-01-14 22:53:14 -05:00
this . _builder . get _object ( 'show_applications_side_padding_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-apps-icon-side-padding' ) ) ;
this . _builder . get _object ( 'show_applications_side_padding_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'show-apps-icon-side-padding' , widget . get _value ( ) ) ;
} ) ) ;
2018-03-11 16:09:21 -06:00
this . _builder . get _object ( 'show_application_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Show Applications 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 ( 'show_applications_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
let fileChooser = this . _builder . get _object ( 'show_applications_icon_file_filebutton' ) ;
let fileImage = this . _builder . get _object ( 'show_applications_current_icon_image' ) ;
let fileFilter = new Gtk . FileFilter ( ) ;
let handleIconChange = function ( newIconPath ) {
if ( newIconPath && GLib . file _test ( newIconPath , GLib . FileTest . EXISTS ) ) {
let file = Gio . File . new _for _path ( newIconPath )
let pixbuf = GdkPixbuf . Pixbuf . new _from _stream _at _scale ( file . read ( null ) , 32 , 32 , true , null ) ;
fileImage . set _from _pixbuf ( pixbuf ) ;
fileChooser . set _filename ( newIconPath ) ;
} else {
newIconPath = '' ;
fileImage . set _from _icon _name ( 'view-app-grid-symbolic' , 32 ) ;
fileChooser . unselect _all ( ) ;
fileChooser . set _current _folder ( GLib . get _user _special _dir ( GLib . UserDirectory . DIRECTORY _PICTURES ) ) ;
}
this . _settings . set _string ( 'show-apps-icon-file' , newIconPath || '' ) ;
} ;
fileFilter . add _pixbuf _formats ( ) ;
fileChooser . filter = fileFilter ;
fileChooser . connect ( 'file-set' , widget => handleIconChange . call ( this , widget . get _filename ( ) ) ) ;
handleIconChange . call ( this , this . _settings . get _string ( 'show-apps-icon-file' ) ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
2019-01-14 22:53:14 -05:00
this . _settings . set _value ( 'show-apps-icon-side-padding' , this . _settings . get _default _value ( 'show-apps-icon-side-padding' ) ) ;
this . _builder . get _object ( 'show_applications_side_padding_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-apps-icon-side-padding' ) ) ;
2020-05-01 17:40:55 -04:00
this . _settings . set _value ( 'show-apps-override-escape' , this . _settings . get _default _value ( 'show-apps-override-escape' ) ) ;
2018-03-11 16:09:21 -06:00
handleIconChange . call ( this , null ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2016-12-22 18:12:04 -05:00
this . _settings . bind ( 'animate-show-apps' ,
this . _builder . get _object ( 'application_button_animation_button' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'show-show-apps-button' ,
this . _builder . get _object ( 'application_button_animation_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2020-05-01 17:40:55 -04:00
this . _settings . bind ( 'show-apps-override-escape' ,
this . _builder . get _object ( 'show_applications_esc_key_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-01-02 21:36:09 -05:00
this . _settings . bind ( 'show-activities-button' ,
this . _builder . get _object ( 'show_activities_button_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-28 22:50:24 -05:00
this . _settings . bind ( 'show-showdesktop-button' ,
this . _builder . get _object ( 'show_showdesktop_button_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-01-23 10:37:04 -05:00
this . _settings . bind ( 'show-showdesktop-button' ,
this . _builder . get _object ( 'show_showdesktop_options_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-02-04 21:59:37 -05:00
this . _settings . bind ( 'show-showdesktop-hover' ,
this . _builder . get _object ( 'show_showdesktop_hide_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'show-showdesktop-hover' ,
this . _builder . get _object ( 'grid_show_showdesktop_hide_options' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-01-23 10:37:04 -05:00
this . _builder . get _object ( 'show_showdesktop_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Show Desktop 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 ) ;
2018-03-10 12:08:22 -06:00
let box = this . _builder . get _object ( 'box_show_showdesktop_options' ) ;
2018-01-23 10:37:04 -05:00
dialog . get _content _area ( ) . add ( box ) ;
this . _builder . get _object ( 'show_showdesktop_width_spinbutton' ) . set _value ( this . _settings . get _int ( 'showdesktop-button-width' ) ) ;
this . _builder . get _object ( 'show_showdesktop_width_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'showdesktop-button-width' , widget . get _value ( ) ) ;
} ) ) ;
2019-02-04 21:59:37 -05:00
this . _builder . get _object ( 'show_showdesktop_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-showdesktop-delay' ) ) ;
this . _builder . get _object ( 'show_showdesktop_delay_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'show-showdesktop-delay' , widget . get _value ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'show_showdesktop_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-showdesktop-time' ) ) ;
this . _builder . get _object ( 'show_showdesktop_time_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'show-showdesktop-time' , widget . get _value ( ) ) ;
} ) ) ;
2018-01-23 10:37:04 -05:00
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'showdesktop-button-width' , this . _settings . get _default _value ( 'showdesktop-button-width' ) ) ;
this . _builder . get _object ( 'show_showdesktop_width_spinbutton' ) . set _value ( this . _settings . get _int ( 'showdesktop-button-width' ) ) ;
2019-10-29 17:24:35 -04:00
this . _settings . set _value ( 'show-showdesktop-hover' , this . _settings . get _default _value ( 'show-showdesktop-hover' ) ) ;
this . _settings . set _value ( 'show-showdesktop-delay' , this . _settings . get _default _value ( 'show-showdesktop-delay' ) ) ;
2019-02-04 21:59:37 -05:00
this . _builder . get _object ( 'show_showdesktop_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-showdesktop-delay' ) ) ;
2019-10-29 17:24:35 -04:00
this . _settings . set _value ( 'show-showdesktop-time' , this . _settings . get _default _value ( 'show-showdesktop-time' ) ) ;
2019-02-04 21:59:37 -05:00
this . _builder . get _object ( 'show_showdesktop_time_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-showdesktop-time' ) ) ;
2018-01-23 10:37:04 -05:00
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2017-01-14 13:18:07 +01:00
this . _settings . bind ( 'show-appmenu' ,
this . _builder . get _object ( 'show_appmenu_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-02-03 10:16:31 -05:00
2017-01-10 20:17:01 -05:00
this . _settings . bind ( 'show-window-previews' ,
this . _builder . get _object ( 'show_window_previews_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-02-03 10:16:31 -05:00
this . _settings . bind ( 'show-window-previews' ,
2017-04-15 15:20:56 +02:00
this . _builder . get _object ( 'show_window_previews_button' ) ,
2017-02-06 22:42:22 -05:00
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-02-03 10:16:31 -05:00
this . _settings . bind ( 'show-tooltip' ,
this . _builder . get _object ( 'show_tooltip_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-06-27 11:05:18 +02:00
this . _settings . bind ( 'show-favorites' ,
this . _builder . get _object ( 'show_favorite_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-04-15 15:20:56 +02:00
2020-05-04 19:39:17 -04:00
this . _settings . bind ( 'show-favorites-all-monitors' ,
this . _builder . get _object ( 'multimon_multi_show_favorites_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'show-favorites' ,
this . _builder . get _object ( 'multimon_multi_show_favorites_switch' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-06-25 17:32:47 -04:00
this . _settings . bind ( 'show-running-apps' ,
this . _builder . get _object ( 'show_runnning_apps_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-08-22 08:56:31 -04:00
this . _setPreviewTitlePosition ( ) ;
2019-05-24 20:41:55 -04:00
2019-05-23 20:08:49 -04:00
this . _builder . get _object ( 'grid_preview_title_font_color_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'window-preview-title-font-color' , hexString ) ;
} ) ) ;
2017-04-15 15:20:56 +02:00
this . _builder . get _object ( 'show_window_previews_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Window preview 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 ) ;
2019-06-02 21:34:02 -04:00
let scrolledWindow = this . _builder . get _object ( 'box_window_preview_options' ) ;
adjustScrollableHeight ( this . _builder . get _object ( 'viewport_window_preview_options' ) , scrolledWindow ) ;
dialog . get _content _area ( ) . add ( scrolledWindow ) ;
2017-04-15 15:20:56 +02:00
this . _builder . get _object ( 'preview_timeout_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-window-previews-timeout' ) ) ;
this . _builder . get _object ( 'preview_timeout_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'show-window-previews-timeout' , widget . get _value ( ) ) ;
} ) ) ;
2019-05-23 20:08:49 -04:00
this . _settings . bind ( 'preview-middle-click-close' ,
this . _builder . get _object ( 'preview_middle_click_close_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-29 21:24:25 -04:00
this . _settings . bind ( 'window-preview-fixed-x' ,
this . _builder . get _object ( 'preview_aspect_ratio_x_fixed_togglebutton' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'window-preview-fixed-y' ,
this . _builder . get _object ( 'preview_aspect_ratio_y_fixed_togglebutton' ) ,
2019-05-26 13:43:42 -04:00
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-06-06 23:02:01 -04:00
this . _settings . bind ( 'preview-use-custom-opacity' ,
this . _builder . get _object ( 'preview_custom_opacity_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'preview-use-custom-opacity' ,
this . _builder . get _object ( 'preview_custom_opacity_spinbutton' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _builder . get _object ( 'preview_custom_opacity_spinbutton' ) . set _value ( this . _settings . get _int ( 'preview-custom-opacity' ) ) ;
this . _builder . get _object ( 'preview_custom_opacity_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'preview-custom-opacity' , widget . get _value ( ) ) ;
} ) ) ;
2019-05-26 13:43:42 -04:00
2017-04-15 15:20:56 +02:00
this . _settings . bind ( 'peek-mode' ,
2017-04-07 22:14:47 +02:00
this . _builder . get _object ( 'peek_mode_switch' ) ,
'active' ,
2017-02-06 22:42:22 -05:00
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-23 20:08:49 -04:00
this . _settings . bind ( 'peek-mode' ,
this . _builder . get _object ( 'grid_enter_peek_mode_timeout' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'peek-mode' ,
this . _builder . get _object ( 'grid_peek_mode_opacity' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-04-05 23:03:50 -05:00
this . _settings . bind ( 'window-preview-show-title' ,
this . _builder . get _object ( 'preview_show_title_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-23 20:08:49 -04:00
this . _settings . bind ( 'window-preview-show-title' ,
this . _builder . get _object ( 'grid_preview_title_size' ) ,
2017-05-12 16:58:31 -04:00
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-23 20:08:49 -04:00
this . _settings . bind ( 'window-preview-show-title' ,
this . _builder . get _object ( 'grid_preview_title_weight' ) ,
2017-05-12 16:58:31 -04:00
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-23 20:08:49 -04:00
this . _settings . bind ( 'window-preview-show-title' ,
this . _builder . get _object ( 'grid_preview_title_font_color' ) ,
'sensitive' ,
2017-09-27 17:44:44 +01:00
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-06 18:03:42 -05:00
2017-04-15 15:20:56 +02:00
this . _builder . get _object ( 'enter_peek_mode_timeout_spinbutton' ) . set _value ( this . _settings . get _int ( 'enter-peek-mode-timeout' ) ) ;
this . _builder . get _object ( 'enter_peek_mode_timeout_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'enter-peek-mode-timeout' , widget . get _value ( ) ) ;
} ) ) ;
2019-05-23 20:08:49 -04:00
this . _builder . get _object ( 'leave_timeout_spinbutton' ) . set _value ( this . _settings . get _int ( 'leave-timeout' ) ) ;
this . _builder . get _object ( 'leave_timeout_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'leave-timeout' , widget . get _value ( ) ) ;
} ) ) ;
2017-04-15 15:20:56 +02:00
2019-08-22 08:10:35 -04:00
this . _settings . bind ( 'window-preview-hide-immediate-click' ,
this . _builder . get _object ( 'preview_immediate_click_button' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-05-24 18:17:13 -04:00
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 ( ) ) ;
} ) ) ;
2019-05-23 20:08:49 -04:00
this . _builder . get _object ( 'peek_mode_opacity_spinbutton' ) . set _value ( this . _settings . get _int ( 'peek-mode-opacity' ) ) ;
2017-04-15 15:20:56 +02:00
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 ( ) ) ;
} ) ) ;
2019-05-23 20:08:49 -04:00
this . _builder . get _object ( 'preview_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'window-preview-size' ) ) ;
this . _builder . get _object ( 'preview_size_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'window-preview-size' , widget . get _value ( ) ) ;
2018-04-08 08:12:52 -05:00
} ) ) ;
2019-05-29 21:24:25 -04:00
this . _builder . get _object ( 'preview_aspect_ratio_x_combo' ) . set _active _id ( this . _settings . get _int ( 'window-preview-aspect-ratio-x' ) . toString ( ) ) ;
this . _builder . get _object ( 'preview_aspect_ratio_x_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'window-preview-aspect-ratio-x' , parseInt ( widget . get _active _id ( ) , 10 ) ) ;
} ) ) ;
this . _builder . get _object ( 'preview_aspect_ratio_y_combo' ) . set _active _id ( this . _settings . get _int ( 'window-preview-aspect-ratio-y' ) . toString ( ) ) ;
this . _builder . get _object ( 'preview_aspect_ratio_y_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'window-preview-aspect-ratio-y' , parseInt ( widget . get _active _id ( ) , 10 ) ) ;
} ) ) ;
2018-04-08 08:12:52 -05:00
this . _builder . get _object ( 'preview_padding_spinbutton' ) . set _value ( this . _settings . get _int ( 'window-preview-padding' ) ) ;
this . _builder . get _object ( 'preview_padding_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'window-preview-padding' , widget . get _value ( ) ) ;
2018-04-05 22:20:00 -05:00
} ) ) ;
2019-05-23 20:08:49 -04:00
this . _builder . get _object ( 'preview_title_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'window-preview-title-font-size' ) ) ;
this . _builder . get _object ( 'preview_title_size_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'window-preview-title-font-size' , widget . get _value ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'grid_preview_title_weight_combo' ) . set _active _id ( this . _settings . get _string ( 'window-preview-title-font-weight' ) ) ;
this . _builder . get _object ( 'grid_preview_title_weight_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'window-preview-title-font-weight' , widget . get _active _id ( ) ) ;
} ) ) ;
( function ( ) {
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'window-preview-title-font-color' ) ) ;
this . _builder . get _object ( 'grid_preview_title_font_color_colorbutton' ) . set _rgba ( rgba ) ;
} ) . apply ( this ) ;
2017-04-15 15:20:56 +02:00
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'show-window-previews-timeout' , this . _settings . get _default _value ( 'show-window-previews-timeout' ) ) ;
this . _builder . get _object ( 'preview_timeout_spinbutton' ) . set _value ( this . _settings . get _int ( 'show-window-previews-timeout' ) ) ;
2019-05-23 20:08:49 -04:00
this . _settings . set _value ( 'leave-timeout' , this . _settings . get _default _value ( 'leave-timeout' ) ) ;
2019-05-24 18:17:13 -04:00
this . _builder . get _object ( 'leave_timeout_spinbutton' ) . set _value ( this . _settings . get _int ( 'leave-timeout' ) ) ;
2019-08-22 08:10:35 -04:00
this . _settings . set _value ( 'window-preview-hide-immediate-click' , this . _settings . get _default _value ( 'window-preview-hide-immediate-click' ) ) ;
2019-05-24 18:17:13 -04:00
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' ) ) ;
2019-05-23 20:08:49 -04:00
2019-06-06 23:02:01 -04:00
this . _settings . set _value ( 'preview-use-custom-opacity' , this . _settings . get _default _value ( 'preview-use-custom-opacity' ) ) ;
this . _settings . set _value ( 'preview-custom-opacity' , this . _settings . get _default _value ( 'preview-custom-opacity' ) ) ;
this . _builder . get _object ( 'preview_custom_opacity_spinbutton' ) . set _value ( this . _settings . get _int ( 'preview-custom-opacity' ) ) ;
2019-08-22 08:56:31 -04:00
this . _settings . set _value ( 'window-preview-title-position' , this . _settings . get _default _value ( 'window-preview-title-position' ) ) ;
this . _setPreviewTitlePosition ( ) ;
2017-04-15 15:20:56 +02:00
this . _settings . set _value ( 'peek-mode' , this . _settings . get _default _value ( 'peek-mode' ) ) ;
2018-04-05 23:03:50 -05:00
this . _settings . set _value ( 'window-preview-show-title' , this . _settings . get _default _value ( 'window-preview-show-title' ) ) ;
2017-04-15 15:20:56 +02:00
this . _settings . set _value ( 'enter-peek-mode-timeout' , this . _settings . get _default _value ( 'enter-peek-mode-timeout' ) ) ;
this . _builder . get _object ( 'enter_peek_mode_timeout_spinbutton' ) . set _value ( this . _settings . get _int ( 'enter-peek-mode-timeout' ) ) ;
this . _settings . set _value ( 'peek-mode-opacity' , this . _settings . get _default _value ( 'peek-mode-opacity' ) ) ;
this . _builder . get _object ( 'peek_mode_opacity_spinbutton' ) . set _value ( this . _settings . get _int ( 'peek-mode-opacity' ) ) ;
2018-04-05 22:20:00 -05:00
2019-05-23 20:08:49 -04:00
this . _settings . set _value ( 'window-preview-size' , this . _settings . get _default _value ( 'window-preview-size' ) ) ;
this . _builder . get _object ( 'preview_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'window-preview-size' ) ) ;
2019-05-29 21:24:25 -04:00
this . _settings . set _value ( 'window-preview-fixed-x' , this . _settings . get _default _value ( 'window-preview-fixed-x' ) ) ;
this . _settings . set _value ( 'window-preview-fixed-y' , this . _settings . get _default _value ( 'window-preview-fixed-y' ) ) ;
this . _settings . set _value ( 'window-preview-aspect-ratio-x' , this . _settings . get _default _value ( 'window-preview-aspect-ratio-x' ) ) ;
this . _builder . get _object ( 'preview_aspect_ratio_x_combo' ) . set _active _id ( this . _settings . get _int ( 'window-preview-aspect-ratio-x' ) . toString ( ) ) ;
this . _settings . set _value ( 'window-preview-aspect-ratio-y' , this . _settings . get _default _value ( 'window-preview-aspect-ratio-y' ) ) ;
this . _builder . get _object ( 'preview_aspect_ratio_y_combo' ) . set _active _id ( this . _settings . get _int ( 'window-preview-aspect-ratio-y' ) . toString ( ) ) ;
2018-04-05 22:20:00 -05:00
2018-04-08 08:12:52 -05:00
this . _settings . set _value ( 'window-preview-padding' , this . _settings . get _default _value ( 'window-preview-padding' ) ) ;
this . _builder . get _object ( 'preview_padding_spinbutton' ) . set _value ( this . _settings . get _int ( 'window-preview-padding' ) ) ;
2018-04-05 22:20:00 -05:00
2017-09-27 17:44:44 +01:00
this . _settings . set _value ( 'preview-middle-click-close' , this . _settings . get _default _value ( 'preview-middle-click-close' ) ) ;
2017-04-15 15:20:56 +02:00
2019-05-23 20:08:49 -04:00
this . _settings . set _value ( 'window-preview-title-font-size' , this . _settings . get _default _value ( 'window-preview-title-font-size' ) ) ;
this . _builder . get _object ( 'preview_title_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'window-preview-title-font-size' ) ) ;
this . _settings . set _value ( 'window-preview-title-font-weight' , this . _settings . get _default _value ( 'window-preview-title-font-weight' ) ) ;
this . _builder . get _object ( 'grid_preview_title_weight_combo' ) . set _active _id ( this . _settings . get _string ( 'window-preview-title-font-weight' ) ) ;
this . _settings . set _value ( 'window-preview-title-font-color' , this . _settings . get _default _value ( 'window-preview-title-font-color' ) ) ;
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'window-preview-title-font-color' ) ) ;
this . _builder . get _object ( 'grid_preview_title_font_color_colorbutton' ) . set _rgba ( rgba ) ;
2017-04-15 15:20:56 +02:00
} else {
// remove the settings box so it doesn't get destroyed;
2019-06-02 21:34:02 -04:00
dialog . get _content _area ( ) . remove ( scrolledWindow ) ;
2017-04-15 15:20:56 +02:00
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
2017-02-06 18:03:42 -05:00
} ) ) ;
2017-01-02 20:46:35 -05:00
this . _settings . bind ( 'isolate-workspaces' ,
this . _builder . get _object ( 'isolate_workspaces_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2016-12-22 18:12:04 -05:00
2020-05-04 19:39:17 -04:00
this . _settings . bind ( 'isolate-monitors' ,
this . _builder . get _object ( 'multimon_multi_isolate_monitor_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-01-14 13:53:58 -05:00
this . _settings . bind ( 'group-apps' ,
this . _builder . get _object ( 'group_apps_switch' ) ,
'active' ,
2018-01-17 16:17:37 -05:00
Gio . SettingsBindFlags . DEFAULT | Gio . SettingsBindFlags . INVERT _BOOLEAN ) ;
2018-01-14 13:53:58 -05:00
2018-01-16 20:44:09 -05:00
this . _settings . bind ( 'group-apps' ,
this . _builder . get _object ( 'show_group_apps_options_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT | Gio . SettingsBindFlags . INVERT _BOOLEAN ) ;
2018-01-16 20:28:59 -05:00
this . _builder . get _object ( 'group_apps_label_font_color_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'group-apps-label-font-color' , hexString ) ;
} ) ) ;
2020-05-03 00:17:18 +02:00
this . _builder . get _object ( 'group_apps_label_font_color_minimized_colorbutton' ) . connect ( 'notify::color' , Lang . bind ( this , function ( button ) {
let rgba = button . get _rgba ( ) ;
let css = rgba . to _string ( ) ;
let hexString = cssHexString ( css ) ;
this . _settings . set _string ( 'group-apps-label-font-color-minimized' , hexString ) ;
} ) ) ;
2018-01-14 13:53:58 -05:00
this . _settings . bind ( 'group-apps-use-fixed-width' ,
this . _builder . get _object ( 'group_apps_use_fixed_width_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'group-apps-underline-unfocused' ,
this . _builder . get _object ( 'group_apps_underline_unfocused_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'group-apps-use-launchers' ,
this . _builder . get _object ( 'group_apps_use_launchers_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _builder . get _object ( 'show_group_apps_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
2018-01-17 16:17:37 -05:00
let dialog = new Gtk . Dialog ( { title : _ ( 'Ungrouped application options' ) ,
2018-01-14 13:53:58 -05:00
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_group_apps_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
this . _builder . get _object ( 'group_apps_label_font_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'group-apps-label-font-size' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_size_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'group-apps-label-font-size' , widget . get _value ( ) ) ;
} ) ) ;
2018-07-26 21:12:35 +03:00
this . _builder . get _object ( 'group_apps_label_font_weight_combo' ) . set _active _id ( this . _settings . get _string ( 'group-apps-label-font-weight' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_weight_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'group-apps-label-font-weight' , widget . get _active _id ( ) ) ;
} ) ) ;
2018-01-16 20:28:59 -05:00
( function ( ) {
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'group-apps-label-font-color' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_color_colorbutton' ) . set _rgba ( rgba ) ;
} ) . apply ( this ) ;
2020-05-03 00:17:18 +02:00
( function ( ) {
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'group-apps-label-font-color-minimized' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_color_minimized_colorbutton' ) . set _rgba ( rgba ) ;
} ) . apply ( this ) ;
2018-01-14 13:53:58 -05:00
this . _builder . get _object ( 'group_apps_label_max_width_spinbutton' ) . set _value ( this . _settings . get _int ( 'group-apps-label-max-width' ) ) ;
this . _builder . get _object ( 'group_apps_label_max_width_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'group-apps-label-max-width' , widget . get _value ( ) ) ;
} ) ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'group-apps-label-font-size' , this . _settings . get _default _value ( 'group-apps-label-font-size' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_size_spinbutton' ) . set _value ( this . _settings . get _int ( 'group-apps-label-font-size' ) ) ;
2018-07-26 21:12:35 +03:00
this . _settings . set _value ( 'group-apps-label-font-weight' , this . _settings . get _default _value ( 'group-apps-label-font-weight' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_weight_combo' ) . set _active _id ( this . _settings . get _string ( 'group-apps-label-font-weight' ) ) ;
2018-01-16 20:28:59 -05:00
this . _settings . set _value ( 'group-apps-label-font-color' , this . _settings . get _default _value ( 'group-apps-label-font-color' ) ) ;
let rgba = new Gdk . RGBA ( ) ;
rgba . parse ( this . _settings . get _string ( 'group-apps-label-font-color' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_color_colorbutton' ) . set _rgba ( rgba ) ;
2020-05-03 00:17:18 +02:00
this . _settings . set _value ( 'group-apps-label-font-color-minimized' , this . _settings . get _default _value ( 'group-apps-label-font-color-minimized' ) ) ;
let minimizedFontColor = new Gdk . RGBA ( ) ;
minimizedFontColor . parse ( this . _settings . get _string ( 'group-apps-label-font-color-minimized' ) ) ;
this . _builder . get _object ( 'group_apps_label_font_color_minimized_colorbutton' ) . set _rgba ( minimizedFontColor ) ;
2018-01-14 13:53:58 -05:00
this . _settings . set _value ( 'group-apps-label-max-width' , this . _settings . get _default _value ( 'group-apps-label-max-width' ) ) ;
this . _builder . get _object ( 'group_apps_label_max_width_spinbutton' ) . set _value ( this . _settings . get _int ( 'group-apps-label-max-width' ) ) ;
this . _settings . set _value ( 'group-apps-use-fixed-width' , this . _settings . get _default _value ( 'group-apps-use-fixed-width' ) ) ;
this . _settings . set _value ( 'group-apps-underline-unfocused' , this . _settings . get _default _value ( 'group-apps-underline-unfocused' ) ) ;
this . _settings . set _value ( 'group-apps-use-launchers' , this . _settings . get _default _value ( 'group-apps-use-launchers' ) ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2016-12-28 20:22:12 -05:00
this . _builder . get _object ( 'click_action_combo' ) . set _active _id ( this . _settings . get _string ( 'click-action' ) ) ;
2016-12-22 18:12:04 -05:00
this . _builder . get _object ( 'click_action_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
2016-12-28 20:22:12 -05:00
this . _settings . set _string ( 'click-action' , widget . get _active _id ( ) ) ;
2016-12-22 18:12:04 -05:00
} ) ) ;
this . _builder . get _object ( 'shift_click_action_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
2016-12-28 20:22:12 -05:00
this . _settings . set _string ( 'shift-click-action' , widget . get _active _id ( ) ) ;
2016-12-22 18:12:04 -05:00
} ) ) ;
this . _builder . get _object ( 'middle_click_action_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
2016-12-28 20:22:12 -05:00
this . _settings . set _string ( 'middle-click-action' , widget . get _active _id ( ) ) ;
2016-12-22 18:12:04 -05:00
} ) ) ;
this . _builder . get _object ( 'shift_middle_click_action_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
2016-12-28 20:22:12 -05:00
this . _settings . set _string ( 'shift-middle-click-action' , widget . get _active _id ( ) ) ;
2016-12-22 18:12:04 -05:00
} ) ) ;
// Create dialog for middle-click options
this . _builder . get _object ( 'middle_click_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Customize middle-click behavior' ) ,
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_middle_click_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
2016-12-28 20:22:12 -05:00
this . _builder . get _object ( 'shift_click_action_combo' ) . set _active _id ( this . _settings . get _string ( 'shift-click-action' ) ) ;
2016-12-22 18:12:04 -05:00
2016-12-28 20:22:12 -05:00
this . _builder . get _object ( 'middle_click_action_combo' ) . set _active _id ( this . _settings . get _string ( 'middle-click-action' ) ) ;
2016-12-22 18:12:04 -05:00
2016-12-28 20:22:12 -05:00
this . _builder . get _object ( 'shift_middle_click_action_combo' ) . set _active _id ( this . _settings . get _string ( 'shift-middle-click-action' ) ) ;
2016-12-22 18:12:04 -05:00
this . _settings . bind ( 'shift-click-action' ,
this . _builder . get _object ( 'shift_click_action_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'middle-click-action' ,
this . _builder . get _object ( 'middle_click_action_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'shift-middle-click-action' ,
this . _builder . get _object ( 'shift_middle_click_action_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings for the relevant keys
let keys = [ 'shift-click-action' , 'middle-click-action' , 'shift-middle-click-action' ] ;
keys . forEach ( function ( val ) {
this . _settings . set _value ( val , this . _settings . get _default _value ( val ) ) ;
} , this ) ;
2016-12-28 20:22:12 -05:00
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' ) ) ;
2016-12-22 18:12:04 -05:00
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2019-08-19 22:20:46 -04:00
this . _builder . get _object ( 'scroll_panel_combo' ) . set _active _id ( this . _settings . get _string ( 'scroll-panel-action' ) ) ;
this . _builder . get _object ( 'scroll_panel_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'scroll-panel-action' , widget . get _active _id ( ) ) ;
} ) ) ;
this . _builder . get _object ( 'scroll_icon_combo' ) . set _active _id ( this . _settings . get _string ( 'scroll-icon-action' ) ) ;
this . _builder . get _object ( 'scroll_icon_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'scroll-icon-action' , widget . get _active _id ( ) ) ;
} ) ) ;
// Create dialog for panel scroll options
this . _builder . get _object ( 'scroll_panel_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Customize panel scroll behavior' ) ,
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 ( 'scroll_panel_options_box' ) ;
dialog . get _content _area ( ) . add ( box ) ;
this . _builder . get _object ( 'scroll_panel_options_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'scroll-panel-delay' ) ) ;
this . _builder . get _object ( 'scroll_panel_options_delay_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'scroll-panel-delay' , widget . get _value ( ) ) ;
} ) ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'scroll-panel-delay' , this . _settings . get _default _value ( 'scroll-panel-delay' ) ) ;
this . _builder . get _object ( 'scroll_panel_options_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'scroll-panel-delay' ) ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
// Create dialog for icon scroll options
this . _builder . get _object ( 'scroll_icon_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
let dialog = new Gtk . Dialog ( { title : _ ( 'Customize icon scroll behavior' ) ,
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 ( 'scroll_icon_options_box' ) ;
dialog . get _content _area ( ) . add ( box ) ;
this . _builder . get _object ( 'scroll_icon_options_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'scroll-icon-delay' ) ) ;
this . _builder . get _object ( 'scroll_icon_options_delay_spinbutton' ) . connect ( 'value-changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _int ( 'scroll-icon-delay' , widget . get _value ( ) ) ;
} ) ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'scroll-icon-delay' , this . _settings . get _default _value ( 'scroll-icon-delay' ) ) ;
this . _builder . get _object ( 'scroll_icon_options_delay_spinbutton' ) . set _value ( this . _settings . get _int ( 'scroll-icon-delay' ) ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2017-01-27 10:21:23 -05:00
this . _settings . bind ( 'hot-keys' ,
this . _builder . get _object ( 'hot_keys_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-02-11 18:49:40 -05:00
this . _settings . bind ( 'hot-keys' ,
this . _builder . get _object ( 'overlay_button' ) ,
'sensitive' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-05-26 18:22:06 -04:00
this . _builder . get _object ( 'overlay_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'hotkeys-overlay-combo' , widget . get _active _id ( ) ) ;
} ) ) ;
2018-10-27 09:21:24 -04:00
this . _settings . bind ( 'shortcut-previews' ,
this . _builder . get _object ( 'shortcut_preview_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-09-08 10:06:32 -04:00
this . _builder . get _object ( 'shortcut_num_keys_combo' ) . set _active _id ( this . _settings . get _string ( 'shortcut-num-keys' ) ) ;
this . _builder . get _object ( 'shortcut_num_keys_combo' ) . connect ( 'changed' , Lang . bind ( this , function ( widget ) {
this . _settings . set _string ( 'shortcut-num-keys' , widget . get _active _id ( ) ) ;
} ) ) ;
this . _settings . connect ( 'changed::hotkey-prefix-text' , Lang . bind ( this , function ( ) { checkHotkeyPrefix ( this . _settings ) ; } ) ) ;
2018-10-27 09:21:24 -04:00
this . _builder . get _object ( 'hotkey_prefix_combo' ) . set _active _id ( this . _settings . get _string ( 'hotkey-prefix-text' ) ) ;
this . _settings . bind ( 'hotkey-prefix-text' ,
this . _builder . get _object ( 'hotkey_prefix_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _builder . get _object ( 'overlay_combo' ) . set _active _id ( this . _settings . get _string ( 'hotkeys-overlay-combo' ) ) ;
this . _settings . bind ( 'hotkeys-overlay-combo' ,
this . _builder . get _object ( 'overlay_combo' ) ,
'active-id' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'overlay-timeout' ,
this . _builder . get _object ( 'timeout_spinbutton' ) ,
'value' ,
Gio . SettingsBindFlags . DEFAULT ) ;
if ( this . _settings . get _string ( 'hotkeys-overlay-combo' ) !== 'TEMPORARILY' ) {
this . _builder . get _object ( 'timeout_spinbutton' ) . set _sensitive ( false ) ;
}
this . _settings . connect ( 'changed::hotkeys-overlay-combo' , Lang . bind ( this , function ( ) {
if ( this . _settings . get _string ( 'hotkeys-overlay-combo' ) !== 'TEMPORARILY' )
this . _builder . get _object ( 'timeout_spinbutton' ) . set _sensitive ( false ) ;
else
this . _builder . get _object ( 'timeout_spinbutton' ) . set _sensitive ( true ) ;
} ) ) ;
this . _settings . bind ( 'shortcut-text' ,
this . _builder . get _object ( 'shortcut_entry' ) ,
'text' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . connect ( 'changed::shortcut-text' , Lang . bind ( this , function ( ) { setShortcut ( this . _settings , 'shortcut' ) ; } ) ) ;
2017-02-11 18:49:40 -05:00
// Create dialog for number overlay options
this . _builder . get _object ( 'overlay_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
2017-02-14 20:37:05 -05:00
let dialog = new Gtk . Dialog ( { title : _ ( 'Advanced hotkeys options' ) ,
2017-02-11 18:49:40 -05:00
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_overlay_shortcut' ) ;
dialog . get _content _area ( ) . add ( box ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings for the relevant keys
2018-10-27 09:21:24 -04:00
let keys = [ 'hotkey-prefix-text' , 'shortcut-text' , 'hotkeys-overlay-combo' , 'overlay-timeout' , 'shortcut-previews' ] ;
2017-02-11 18:49:40 -05:00
keys . forEach ( function ( val ) {
this . _settings . set _value ( val , this . _settings . get _default _value ( val ) ) ;
} , this ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2017-03-24 22:31:43 -04:00
// setup dialog for secondary menu options
this . _builder . get _object ( 'secondarymenu_options_button' ) . connect ( 'clicked' , Lang . bind ( this , function ( ) {
2017-02-11 18:49:40 -05:00
2017-03-24 22:31:43 -04:00
let dialog = new Gtk . Dialog ( { title : _ ( 'Secondary Menu 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_secondarymenu_options' ) ;
dialog . get _content _area ( ) . add ( box ) ;
this . _settings . bind ( 'secondarymenu-contains-appmenu' ,
this . _builder . get _object ( 'secondarymenu_appmenu_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'secondarymenu-contains-showdetails' ,
this . _builder . get _object ( 'secondarymenu_showdetails_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
// restore default settings
this . _settings . set _value ( 'secondarymenu-contains-appmenu' , this . _settings . get _default _value ( 'secondarymenu-contains-appmenu' ) ) ;
this . _settings . set _value ( 'secondarymenu-contains-showdetails' , this . _settings . get _default _value ( 'secondarymenu-contains-showdetails' ) ) ;
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2017-01-27 10:21:23 -05:00
2017-01-24 23:11:51 -05:00
// 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 ) ;
dialog . connect ( 'response' , Lang . bind ( this , function ( dialog , id ) {
if ( id == 1 ) {
2017-05-12 16:58:31 -04:00
// restore default settings
2019-05-23 20:08:49 -04:00
2017-01-24 23:11:51 -05:00
} else {
// remove the settings box so it doesn't get destroyed;
dialog . get _content _area ( ) . remove ( box ) ;
dialog . destroy ( ) ;
}
return ;
} ) ) ;
dialog . show _all ( ) ;
} ) ) ;
2017-02-17 22:11:16 -05:00
// Fine-tune panel
2016-12-23 16:19:46 -05:00
let sizeScales = [
2016-12-31 08:24:23 -05:00
{ objectName : 'tray_size_scale' , valueName : 'tray-size' , range : DEFAULT _FONT _SIZES } ,
{ objectName : 'leftbox_size_scale' , valueName : 'leftbox-size' , range : DEFAULT _FONT _SIZES } ,
{ objectName : 'appicon_margin_scale' , valueName : 'appicon-margin' , range : DEFAULT _MARGIN _SIZES } ,
2018-04-12 17:23:59 -05:00
{ objectName : 'appicon_padding_scale' , valueName : 'appicon-padding' , range : DEFAULT _MARGIN _SIZES } ,
2017-01-04 09:11:09 -05:00
{ objectName : 'tray_padding_scale' , valueName : 'tray-padding' , range : DEFAULT _PADDING _SIZES } ,
{ objectName : 'leftbox_padding_scale' , valueName : 'leftbox-padding' , range : DEFAULT _PADDING _SIZES } ,
{ objectName : 'statusicon_padding_scale' , valueName : 'status-icon-padding' , range : DEFAULT _PADDING _SIZES }
2016-12-23 16:19:46 -05:00
] ;
for ( var idx in sizeScales ) {
let size _scale = this . _builder . get _object ( sizeScales [ idx ] . objectName ) ;
2016-12-31 08:24:23 -05:00
let range = sizeScales [ idx ] . range ;
size _scale . set _range ( range [ range . length - 1 ] , range [ 0 ] ) ;
2016-12-23 16:19:46 -05:00
size _scale . set _value ( this . _settings . get _int ( sizeScales [ idx ] . valueName ) ) ;
2016-12-31 08:24:23 -05:00
range . slice ( 1 , - 1 ) . forEach ( function ( val ) {
2016-12-23 16:19:46 -05:00
size _scale . add _mark ( val , Gtk . PositionType . TOP , val . toString ( ) ) ;
} ) ;
// Corrent for rtl languages
if ( this . _rtl ) {
// Flip value position: this is not done automatically
size _scale . set _value _pos ( Gtk . PositionType . LEFT ) ;
// I suppose due to a bug, having a more than one mark and one above a value of 100
// makes the rendering of the marks wrong in rtl. This doesn't happen setting the scale as not flippable
// and then manually inverting it
size _scale . set _flippable ( false ) ;
size _scale . set _inverted ( true ) ;
}
}
2017-02-17 23:48:12 -05:00
this . _settings . bind ( 'animate-app-switch' ,
this . _builder . get _object ( 'animate_app_switch_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
this . _settings . bind ( 'animate-window-launch' ,
this . _builder . get _object ( 'animate_window_launch_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2018-10-28 12:06:20 -04:00
this . _settings . bind ( 'stockgs-keep-dash' ,
this . _builder . get _object ( 'stockgs_dash_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2019-02-02 12:32:41 -05:00
2020-05-02 12:57:21 -04:00
this . _settings . bind ( 'stockgs-keep-top-panel' ,
this . _builder . get _object ( 'stockgs_top_panel_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
var maybeDisableTopPosition = ( ) => {
let keepTopPanel = this . _settings . get _boolean ( 'stockgs-keep-top-panel' ) ;
let topRadio = this . _builder . get _object ( 'position_top_button' ) ;
topRadio . set _sensitive ( ! keepTopPanel ) ;
topRadio . set _tooltip _text ( keepTopPanel ? _ ( 'Unavailable when gnome-shell top panel is present' ) : '' ) ;
if ( keepTopPanel && this . _settings . get _string ( 'panel-position' ) == 'TOP' ) {
this . _settings . set _string ( 'panel-position' , "BOTTOM" ) ;
this . _setPositionRadios ( ) ;
}
} ;
2020-05-04 19:39:17 -04:00
var setGsStockPanelOptions = ( ) => {
let keepTopPanel = this . _settings . get _boolean ( 'stockgs-keep-top-panel' ) ;
this . _builder . get _object ( 'stockgs_top_panel_description' ) [ keepTopPanel ? 'show' : 'hide' ] ( ) ;
this . _builder . get _object ( 'multimon_multi_show_clock_label' ) . set _text ( keepTopPanel ? _ ( 'Display the clock on additional panels' ) : _ ( 'Display the clock on secondary panels' ) ) ;
this . _builder . get _object ( 'multimon_multi_show_status_menu_label' ) . set _text ( keepTopPanel ? _ ( 'Display the status menu on additional panels' ) : _ ( 'Display the status menu on secondary panels' ) ) ;
} ;
this . _settings . connect ( 'changed::stockgs-keep-top-panel' , ( ) => {
setGsStockPanelOptions ( ) ;
maybeDisableTopPosition ( ) ;
} ) ;
setGsStockPanelOptions ( ) ;
2020-05-02 12:57:21 -04:00
maybeDisableTopPosition ( ) ;
2019-02-02 12:32:41 -05:00
this . _settings . bind ( 'stockgs-panelbtn-click-only' ,
this . _builder . get _object ( 'stockgs_panelbtn_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-01-11 20:52:32 -05:00
2020-01-14 17:58:53 -05:00
this . _settings . bind ( 'stockgs-force-hotcorner' ,
this . _builder . get _object ( 'stockgs_hotcorner_switch' ) ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
2017-01-11 20:52:32 -05:00
// About Panel
2016-12-23 16:19:46 -05:00
2018-01-26 21:53:21 -05:00
this . _builder . get _object ( 'extension_version' ) . set _label ( Me . metadata . version . toString ( ) + ( Me . metadata . commit ? ' (' + Me . metadata . commit + ')' : '' ) ) ;
2018-12-09 17:12:23 -05:00
this . _builder . get _object ( 'importexport_export_button' ) . connect ( 'clicked' , widget => {
this . _showFileChooser (
_ ( 'Export settings' ) ,
{ action : Gtk . FileChooserAction . SAVE ,
do _overwrite _confirmation : true } ,
Gtk . STOCK _SAVE ,
filename => {
let file = Gio . file _new _for _path ( filename ) ;
let raw = file . replace ( null , false , Gio . FileCreateFlags . NONE , null ) ;
let out = Gio . BufferedOutputStream . new _sized ( raw , 4096 ) ;
out . write _all ( GLib . spawn _command _line _sync ( 'dconf dump ' + SCHEMA _PATH ) [ 1 ] , null ) ;
out . close ( null ) ;
}
) ;
} ) ;
this . _builder . get _object ( 'importexport_import_button' ) . connect ( 'clicked' , widget => {
this . _showFileChooser (
_ ( 'Import settings' ) ,
2018-12-09 17:54:59 -05:00
{ action : Gtk . FileChooserAction . OPEN } ,
2018-12-09 17:12:23 -05:00
Gtk . STOCK _OPEN ,
filename => {
let settingsFile = Gio . File . new _for _path ( filename ) ;
let [ , pid , stdin , stdout , stderr ] =
GLib . spawn _async _with _pipes (
null ,
[ 'dconf' , 'load' , SCHEMA _PATH ] ,
null ,
GLib . SpawnFlags . SEARCH _PATH | GLib . SpawnFlags . DO _NOT _REAP _CHILD ,
null
) ;
stdin = new Gio . UnixOutputStream ( { fd : stdin , close _fd : true } ) ;
GLib . close ( stdout ) ;
GLib . close ( stderr ) ;
2019-03-10 13:17:10 -04:00
let [ , , , retCode ] = GLib . spawn _command _line _sync ( GSET + ' -d ' + Me . uuid ) ;
2018-12-09 17:12:23 -05:00
if ( retCode == 0 ) {
2019-03-10 13:17:10 -04:00
GLib . child _watch _add ( GLib . PRIORITY _DEFAULT , pid , ( ) => GLib . spawn _command _line _sync ( GSET + ' -e ' + Me . uuid ) ) ;
2018-12-09 17:12:23 -05:00
}
stdin . splice ( settingsFile . read ( null ) , Gio . OutputStreamSpliceFlags . CLOSE _SOURCE | Gio . OutputStreamSpliceFlags . CLOSE _TARGET , null ) ;
}
) ;
} ) ;
2019-10-28 23:59:13 -04:00
let updateCheckSwitch = this . _builder . get _object ( 'updates_check_switch' ) ;
updateCheckSwitch . set _sensitive ( false ) ;
this . _builder . get _object ( 'updates_check_now_button' ) . connect ( 'clicked' , widget => {
this . _settings . set _boolean ( 'force-check-update' , true ) ;
} ) ;
//!start-update
updateCheckSwitch . set _sensitive ( true ) ;
this . _settings . bind ( 'check-update' ,
updateCheckSwitch ,
'active' ,
Gio . SettingsBindFlags . DEFAULT ) ;
//!end-update
2018-12-09 17:12:23 -05:00
} ,
2019-08-22 08:56:31 -04:00
_setPreviewTitlePosition : function ( ) {
switch ( this . _settings . get _string ( 'window-preview-title-position' ) ) {
case 'BOTTOM' :
this . _builder . get _object ( 'preview_title_position_bottom_button' ) . set _active ( true ) ;
break ;
case 'TOP' :
this . _builder . get _object ( 'preview_title_position_top_button' ) . set _active ( true ) ;
break ;
}
} ,
2018-12-09 17:12:23 -05:00
_showFileChooser : function ( title , params , acceptBtn , acceptHandler ) {
let dialog = new Gtk . FileChooserDialog ( mergeObjects ( { title : title , transient _for : this . widget . get _toplevel ( ) } , params ) ) ;
dialog . add _button ( Gtk . STOCK _CANCEL , Gtk . ResponseType . CANCEL ) ;
dialog . add _button ( acceptBtn , Gtk . ResponseType . ACCEPT ) ;
if ( dialog . run ( ) == Gtk . ResponseType . ACCEPT ) {
try {
acceptHandler ( dialog . get _filename ( ) ) ;
} catch ( e ) {
log ( 'error from dash-to-panel filechooser: ' + e ) ;
}
}
dialog . destroy ( ) ;
2016-12-22 18:12:04 -05:00
} ,
/ * *
* Object containing all signals defined in the glade file
* /
_SignalHandler : {
position _bottom _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
2016-12-28 20:22:12 -05:00
this . _settings . set _string ( 'panel-position' , "BOTTOM" ) ;
2016-12-22 18:12:04 -05:00
} ,
position _top _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
2016-12-28 20:22:12 -05:00
this . _settings . set _string ( 'panel-position' , "TOP" ) ;
2019-07-30 19:25:30 -04:00
} ,
position _left _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'panel-position' , "LEFT" ) ;
} ,
position _right _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'panel-position' , "RIGHT" ) ;
} ,
2016-12-30 18:24:22 -05:00
dots _bottom _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'dot-position' , "BOTTOM" ) ;
} ,
dots _top _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'dot-position' , "TOP" ) ;
2016-12-22 18:12:04 -05:00
} ,
2019-09-05 22:58:48 -04:00
dots _left _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'dot-position' , "LEFT" ) ;
} ,
dots _right _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'dot-position' , "RIGHT" ) ;
} ,
2019-05-24 20:41:55 -04:00
preview _title _position _bottom _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'window-preview-title-position' , 'BOTTOM' ) ;
} ,
preview _title _position _top _button _toggled _cb : function ( button ) {
if ( button . get _active ( ) )
this . _settings . set _string ( 'window-preview-title-position' , 'TOP' ) ;
} ,
2016-12-22 18:12:04 -05:00
panel _size _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
panel _size _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
if ( this . _panel _size _timeout > 0 )
Mainloop . source _remove ( this . _panel _size _timeout ) ;
this . _panel _size _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
this . _settings . set _int ( 'panel-size' , scale . get _value ( ) ) ;
this . _panel _size _timeout = 0 ;
return GLib . SOURCE _REMOVE ;
} ) ) ;
2016-12-23 16:42:05 -05:00
} ,
tray _size _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
tray _size _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
2016-12-31 08:24:23 -05:00
if ( this . _tray _size _timeout > 0 )
Mainloop . source _remove ( this . _tray _size _timeout ) ;
2016-12-23 16:42:05 -05:00
2016-12-31 08:24:23 -05:00
this . _tray _size _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
2016-12-23 16:42:05 -05:00
this . _settings . set _int ( 'tray-size' , scale . get _value ( ) ) ;
2016-12-31 08:24:23 -05:00
this . _tray _size _timeout = 0 ;
2016-12-23 16:42:05 -05:00
return GLib . SOURCE _REMOVE ;
} ) ) ;
} ,
leftbox _size _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
leftbox _size _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
2016-12-31 08:24:23 -05:00
if ( this . _leftbox _size _timeout > 0 )
Mainloop . source _remove ( this . _leftbox _size _timeout ) ;
2016-12-23 16:42:05 -05:00
2016-12-31 08:24:23 -05:00
this . _leftbox _size _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
2016-12-23 16:42:05 -05:00
this . _settings . set _int ( 'leftbox-size' , scale . get _value ( ) ) ;
2016-12-31 08:24:23 -05:00
this . _leftbox _size _timeout = 0 ;
return GLib . SOURCE _REMOVE ;
} ) ) ;
} ,
appicon _margin _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
appicon _margin _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
if ( this . _appicon _margin _timeout > 0 )
Mainloop . source _remove ( this . _appicon _margin _timeout ) ;
this . _appicon _margin _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
this . _settings . set _int ( 'appicon-margin' , scale . get _value ( ) ) ;
this . _appicon _margin _timeout = 0 ;
2016-12-23 16:42:05 -05:00
return GLib . SOURCE _REMOVE ;
} ) ) ;
2017-01-04 09:11:09 -05:00
} ,
2018-04-12 17:23:59 -05:00
appicon _padding _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
appicon _padding _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
if ( this . _appicon _padding _timeout > 0 )
Mainloop . source _remove ( this . _appicon _padding _timeout ) ;
this . _appicon _padding _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
this . _settings . set _int ( 'appicon-padding' , scale . get _value ( ) ) ;
this . _appicon _padding _timeout = 0 ;
return GLib . SOURCE _REMOVE ;
} ) ) ;
} ,
2017-01-04 09:11:09 -05:00
tray _padding _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
tray _padding _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
if ( this . _tray _padding _timeout > 0 )
Mainloop . source _remove ( this . _tray _padding _timeout ) ;
this . _tray _padding _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
this . _settings . set _int ( 'tray-padding' , scale . get _value ( ) ) ;
this . _tray _padding _timeout = 0 ;
return GLib . SOURCE _REMOVE ;
} ) ) ;
} ,
statusicon _padding _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
statusicon _padding _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
if ( this . _statusicon _padding _timeout > 0 )
Mainloop . source _remove ( this . _statusicon _padding _timeout ) ;
this . _statusicon _padding _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
this . _settings . set _int ( 'status-icon-padding' , scale . get _value ( ) ) ;
this . _statusicon _padding _timeout = 0 ;
return GLib . SOURCE _REMOVE ;
} ) ) ;
} ,
leftbox _padding _scale _format _value _cb : function ( scale , value ) {
return value + ' px' ;
} ,
leftbox _padding _scale _value _changed _cb : function ( scale ) {
// Avoid settings the size consinuosly
if ( this . _leftbox _padding _timeout > 0 )
Mainloop . source _remove ( this . _leftbox _padding _timeout ) ;
this . _leftbox _padding _timeout = Mainloop . timeout _add ( SCALE _UPDATE _TIMEOUT , Lang . bind ( this , function ( ) {
this . _settings . set _int ( 'leftbox-padding' , scale . get _value ( ) ) ;
this . _leftbox _padding _timeout = 0 ;
return GLib . SOURCE _REMOVE ;
} ) ) ;
2016-12-22 18:12:04 -05:00
}
}
} ) ;
function init ( ) {
Convenience . initTranslations ( ) ;
}
function buildPrefsWidget ( ) {
let settings = new Settings ( ) ;
let widget = settings . widget ;
2017-05-12 15:57:27 -04:00
// I'd like the scrolled window to default to a size large enough to show all without scrolling, if it fits on the screen
// But, it doesn't seem possible, so I'm setting a minimum size if there seems to be enough screen real estate
2017-05-12 17:16:57 -04:00
widget . show _all ( ) ;
2019-06-02 21:34:02 -04:00
adjustScrollableHeight ( settings . viewport , widget ) ;
2017-05-12 17:16:57 -04:00
2016-12-22 18:12:04 -05:00
return widget ;
}
2019-06-02 21:34:02 -04:00
function adjustScrollableHeight ( viewport , scrollableWindow ) {
let viewportSize = viewport . size _request ( ) ;
let screenHeight = scrollableWindow . get _screen ( ) . get _height ( ) - 120 ;
scrollableWindow . set _size _request ( viewportSize . width , viewportSize . height > screenHeight ? screenHeight : viewportSize . height ) ;
}