@@ -33,6 +33,9 @@ extern Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display**
3333// declare internal methods
3434static jobjectArray fileListToStringArray ( JNIEnv* env, GSList* fileList );
3535
36+ // fields
37+ static int settingsSchemaInstalled = -1 ;
38+
3639// ---- helper -----------------------------------------------------------------
3740
3841#define isOptionSet ( option ) ((optionsSet & com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_ ## option) != 0 )
@@ -188,6 +191,22 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLinuxLibrar
188191 if ( !gtk_init_check ( NULL , NULL ) )
189192 return NULL ;
190193
194+ // check whether required GSettings schemas are installed (e.g. on NixOS)
195+ // this avoids output of following message on console, followed by an application crash:
196+ // GLib-GIO-ERROR: No GSettings schemas are installed on the system
197+ if ( settingsSchemaInstalled < 0 ) {
198+ GSettingsSchemaSource* schemaSource = g_settings_schema_source_get_default ();
199+ GSettingsSchema* schema = (schemaSource != NULL )
200+ ? g_settings_schema_source_lookup ( schemaSource, " org.gtk.Settings.FileChooser" , FALSE )
201+ : NULL ;
202+ if ( schema != NULL )
203+ g_settings_schema_unref ( schema );
204+
205+ settingsSchemaInstalled = (schema != NULL );
206+ }
207+ if ( settingsSchemaInstalled <= 0 )
208+ return NULL ;
209+
191210 // convert Java strings to C strings
192211 AutoReleaseStringUTF8 ctitle ( env, title );
193212 AutoReleaseStringUTF8 cokButtonLabel ( env, okButtonLabel );
0 commit comments