File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 26
26
27
27
Q_LOGGING_CATEGORY (QGnomePlatformGSettingsHintProvider, " qt.qpa.qgnomeplatform.gsettingshintprovider" )
28
28
29
+ static GSettings *loadGSettingsSchema(const QString &schema)
30
+ {
31
+ GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
32
+ GSettingsSchema *gschema = nullptr ;
33
+
34
+ gschema = g_settings_schema_source_lookup (source, schema.toLatin1 (), TRUE );
35
+ if (!gschema) {
36
+ return nullptr ;
37
+ }
38
+
39
+ GSettings *settings = g_settings_new (schema.toLatin1 ());
40
+ g_settings_schema_unref (gschema);
41
+ return settings;
42
+ }
43
+
29
44
GSettingsHintProvider::GSettingsHintProvider (QObject *parent)
30
45
: HintProvider(parent)
31
- , m_gnomeDesktopSettings(g_settings_new( " org.gnome.desktop.wm.preferences" ))
32
- , m_settings(g_settings_new( " org.gnome.desktop.interface" ))
46
+ , m_gnomeDesktopSettings(loadGSettingsSchema(QLatin1String( " org.gnome.desktop.wm.preferences" ) ))
47
+ , m_settings(loadGSettingsSchema(QLatin1String( " org.gnome.desktop.interface" ) ))
33
48
{
34
49
// Check if this is a Cinnamon session to use additionally a different setting scheme
35
50
if (qgetenv (" XDG_CURRENT_DESKTOP" ).toLower () == QStringLiteral (" x-cinnamon" )) {
36
- m_cinnamonSettings = g_settings_new (" org.cinnamon.desktop.interface" );
51
+ m_cinnamonSettings = loadGSettingsSchema (QLatin1String (" org.cinnamon.desktop.interface" ));
52
+ }
53
+
54
+ // Do not continue on missing GSettings
55
+ if (!m_settings && !m_cinnamonSettings) {
56
+ return ;
37
57
}
38
58
39
59
// Watch for changes
You can’t perform that action at this time.
0 commit comments