Skip to content

Commit 6707e92

Browse files
committed
Fix error messages thrown to the cli
1 parent 95c5e90 commit 6707e92

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/utils/ui-helpers.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,17 @@ export function applyCssToWidget(
202202
css,
203203
priority = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
204204
) {
205-
const cssProvider = new Gtk.CssProvider();
206-
cssProvider.load_from_string(css);
207-
widget.get_style_context().add_provider(cssProvider, priority);
205+
const apply = () => {
206+
const cssProvider = new Gtk.CssProvider();
207+
cssProvider.load_from_string(css);
208+
widget.get_style_context().add_provider(cssProvider, priority);
209+
};
210+
211+
if (widget.get_realized()) {
212+
apply();
213+
} else {
214+
widget.connect('realize', apply);
215+
}
208216
}
209217

210218
/**

0 commit comments

Comments
 (0)