File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 7
7
- add MprisPlayer.track_album
8
8
- add MprisPlayer.metadata
9
9
- add Widget.keybind
10
+ - App.applyCss takes stylesheets, and an optional reset parameter
10
11
11
12
## Fixes
12
13
Original file line number Diff line number Diff line change @@ -98,13 +98,16 @@ export class App extends Gtk.Application {
98
98
this . _cssProviders = [ ] ;
99
99
} ;
100
100
101
- readonly applyCss = ( path : string ) => {
101
+ readonly applyCss = ( pathOrStyle : string , reset = false ) => {
102
102
const screen = Gdk . Screen . get_default ( ) ;
103
103
if ( ! screen ) {
104
104
console . error ( "couldn't get screen" ) ;
105
105
return ;
106
106
}
107
107
108
+ if ( reset )
109
+ this . resetCss ( ) ;
110
+
108
111
const cssProvider = new Gtk . CssProvider ( ) ;
109
112
cssProvider . connect ( 'parsing-error' , ( _ , section , err ) => {
110
113
const file = section . get_file ( ) . get_path ( ) ;
@@ -113,7 +116,10 @@ export class App extends Gtk.Application {
113
116
} ) ;
114
117
115
118
try {
116
- cssProvider . load_from_path ( path ) ;
119
+ if ( GLib . file_test ( pathOrStyle , GLib . FileTest . EXISTS ) )
120
+ cssProvider . load_from_path ( pathOrStyle ) ;
121
+ else
122
+ cssProvider . load_from_data ( new TextEncoder ( ) . encode ( pathOrStyle ) ) ;
117
123
} finally {
118
124
// log on parsing-error
119
125
}
You can’t perform that action at this time.
0 commit comments