mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-15 08:17:12 -06:00
System File Chooser on Linux: check whether required GSettings schemas are installed to avoid application crash (issue #1069)
occurred on NixOS with Plasma (KDE) desktop
This commit is contained in:
@@ -3,8 +3,11 @@ FlatLaf Change Log
|
|||||||
|
|
||||||
## 3.7.1-SNAPSHOT
|
## 3.7.1-SNAPSHOT
|
||||||
|
|
||||||
- System File Chooser: Update current filter before invoking approve callback
|
- System File Chooser:
|
||||||
and after closing dialog. (issue #1065)
|
- 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
|
- ComboBox: Added UI property `ComboBox.buttonFocusedEditableBackground`. (issue
|
||||||
#1068)
|
#1068)
|
||||||
- Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is
|
- Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ extern Window getWindowHandle( JNIEnv* env, JAWT* awt, jobject window, Display**
|
|||||||
// declare internal methods
|
// declare internal methods
|
||||||
static jobjectArray fileListToStringArray( JNIEnv* env, GSList* fileList );
|
static jobjectArray fileListToStringArray( JNIEnv* env, GSList* fileList );
|
||||||
|
|
||||||
|
// fields
|
||||||
|
static int settingsSchemaInstalled = -1;
|
||||||
|
|
||||||
//---- helper -----------------------------------------------------------------
|
//---- helper -----------------------------------------------------------------
|
||||||
|
|
||||||
#define isOptionSet( option ) ((optionsSet & com_formdev_flatlaf_ui_FlatNativeLinuxLibrary_ ## option) != 0)
|
#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 ) )
|
if( !gtk_init_check( NULL, NULL ) )
|
||||||
return 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
|
// convert Java strings to C strings
|
||||||
AutoReleaseStringUTF8 ctitle( env, title );
|
AutoReleaseStringUTF8 ctitle( env, title );
|
||||||
AutoReleaseStringUTF8 cokButtonLabel( env, okButtonLabel );
|
AutoReleaseStringUTF8 cokButtonLabel( env, okButtonLabel );
|
||||||
|
|||||||
Reference in New Issue
Block a user