diff --git a/CHANGELOG.md b/CHANGELOG.md index f8210246..00e52c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,11 @@ FlatLaf Change Log ## 3.7.1-SNAPSHOT -- System File Chooser: Update current filter before invoking approve callback - and after closing dialog. (issue #1065) +- System File Chooser: + - Update current filter before invoking approve callback and after closing + dialog. (issue #1065) + - On Linux: Check whether required GSettings schemas are installed to avoid + application crash (occurred on NixOS with Plasma/KDE desktop). (issue #1069) - ComboBox: Added UI property `ComboBox.buttonFocusedEditableBackground`. (issue #1068) - Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is diff --git a/flatlaf-natives/flatlaf-natives-linux/src/main/cpp/GtkFileChooser.cpp b/flatlaf-natives/flatlaf-natives-linux/src/main/cpp/GtkFileChooser.cpp index 065c4c01..98105772 100644 --- a/flatlaf-natives/flatlaf-natives-linux/src/main/cpp/GtkFileChooser.cpp +++ b/flatlaf-natives/flatlaf-natives-linux/src/main/cpp/GtkFileChooser.cpp @@ -33,6 +33,9 @@ extern Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display** // declare internal methods static jobjectArray fileListToStringArray( JNIEnv* env, GSList* fileList ); +// fields +static int settingsSchemaInstalled = -1; + //---- helper ----------------------------------------------------------------- #define isOptionSet( option ) ((optionsSet & com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_ ## option) != 0) @@ -188,6 +191,22 @@ JNIEXPORT jobjectArray JNICALL Java_com_formdev_flatlaf_ui_FlatNativeLinuxLibrar if( !gtk_init_check( NULL, NULL ) ) return NULL; + // check whether required GSettings schemas are installed (e.g. on NixOS) + // this avoids output of following message on console, followed by an application crash: + // GLib-GIO-ERROR: No GSettings schemas are installed on the system + if( settingsSchemaInstalled < 0 ) { + GSettingsSchemaSource* schemaSource = g_settings_schema_source_get_default(); + GSettingsSchema* schema = (schemaSource != NULL) + ? g_settings_schema_source_lookup( schemaSource, "org.gtk.Settings.FileChooser", FALSE ) + : NULL; + if( schema != NULL ) + g_settings_schema_unref( schema ); + + settingsSchemaInstalled = (schema != NULL); + } + if( settingsSchemaInstalled <= 0 ) + return NULL; + // convert Java strings to C strings AutoReleaseStringUTF8 ctitle( env, title ); AutoReleaseStringUTF8 cokButtonLabel( env, okButtonLabel );