summaryrefslogtreecommitdiffstats
path: root/kde/patch/kde-gtk-config/kde-gtk-config_loadcurrentsettings.patch
blob: b5b074d4f9715816c5858dffcb8666812cbe6501 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
From 0d0f812a1704c62c014bc87162b1280224b64f93 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Tue, 24 Oct 2017 13:25:32 +0200
Subject: Revert "Make the kde-gtk-config kcm better at checking global gtk
 settings"

Summary:
This reverts commit 34357f74ee2d98128ff423b0ec6ddcbf4232c475.

Reverting this fixes loading of the actually used GTK settings.

BUG: 382291

Test Plan:
Opened kcmshell5 kde-gtk-config with and without this revert.
Without, it shows Adwaita as theme, with it shows breeze.
GTK uses breeze, so the behaviour with the revert is correct.

Reviewers: #plasma, apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8443
---
 CMakeLists.txt           |   2 +-
 src/abstractappearance.h |   5 +-
 src/appearancegtk2.cpp   | 103 +++++++++++++---------------------
 src/appearancegtk2.h     |  11 +---
 src/appearancegtk3.cpp   | 143 +++++++++++++++++++++--------------------------
 src/appearancegtk3.h     |  10 +---
 src/appearencegtk.cpp    |   4 +-
 tests/CMakeLists.txt     |   2 +-
 tests/configsavetest.cpp |  75 ++++++++++---------------
 tests/configsavetest.h   |   8 +--
 10 files changed, 144 insertions(+), 219 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 181cfc9..bf1ba29 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,7 @@ ki18n_wrap_ui(kcm_SRCS
 )
 add_library(kcm_kdegtkconfig MODULE ${kcm_SRCS})
 target_compile_definitions(kcm_kdegtkconfig PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}")
-target_link_libraries(kcm_kdegtkconfig ${X11_Xcursor_LIB} KF5::ConfigCore KF5::I18n KF5::KIOWidgets KF5::NewStuff KF5::Archive KF5::NewStuff KF5::ConfigWidgets KF5::IconThemes)
+target_link_libraries(kcm_kdegtkconfig ${X11_Xcursor_LIB} KF5::I18n KF5::KIOWidgets KF5::NewStuff KF5::Archive KF5::NewStuff KF5::ConfigWidgets KF5::IconThemes)
 
 kcoreaddons_desktop_to_json(kcm_kdegtkconfig kde-gtk-config.desktop)
 
diff --git a/src/abstractappearance.h b/src/abstractappearance.h
index 208342e..2961a09 100644
--- a/src/abstractappearance.h
+++ b/src/abstractappearance.h
@@ -30,11 +30,10 @@ class AbstractAppearance
 {
     public:
         virtual ~AbstractAppearance() {}
-        virtual bool loadSettings() = 0;
-        virtual bool saveSettings() const = 0;
+        virtual QString defaultConfigFile() const = 0;
         virtual bool loadSettings(const QString& path) = 0;
         virtual bool saveSettings(const QString& path) const = 0;
-
+        
         /** @returns the installed themes' paths*/
         virtual QStringList installedThemes() const = 0;
         
diff --git a/src/appearancegtk2.cpp b/src/appearancegtk2.cpp
index 92cbee3..44a2239 100644
--- a/src/appearancegtk2.cpp
+++ b/src/appearancegtk2.cpp
@@ -30,38 +30,48 @@
 #include <QStandardPaths>
 #include <config.h>
 
-bool AppearanceGTK2::loadSettingsPrivate(const QString& path)
+bool AppearanceGTK2::loadSettings(const QString& path)
 {
     QFile configFile(path);
     
-    if (!configFile.open(QIODevice::ReadOnly | QIODevice::Text))
-        return false;
+    bool canRead = configFile.open(QIODevice::ReadOnly | QIODevice::Text);
     
-    const QMap<QString, QString> foundSettings = readSettingsTuples(&configFile);
-
-    for(auto it = foundSettings.constBegin(), itEnd = foundSettings.constEnd(); it!=itEnd; ++it) {
-        if (it.key() == "gtk-theme-name")
-            m_settings["theme"] = *it;
-        else if (it.key() == "gtk-icon-theme-name")
-            m_settings["icon"] = *it;
-        else if (it.key() == "gtk-fallback-icon-theme")
-            m_settings["icon_fallback"] = *it;
-        else if (it.key() == "gtk-cursor-theme-name")
-            m_settings["cursor"] = *it;
-        else if (it.key() == "gtk-font-name")
-            m_settings["font"] = *it;
-        else if (it.key() == "gtk-toolbar-style")
-            m_settings["toolbar_style"] = *it;
-        else if (it.key() == "gtk-button-images")
-            m_settings["show_icons_buttons"] = *it;
-        else if(it.key() == "gtk-menu-images")
-            m_settings["show_icons_menus"] = *it;
-        else if (it.key() == "gtk-primary-button-warps-slider")
-            m_settings["primary_button_warps_slider"] = *it;
-        else
-            qWarning() << "unknown field" << it.key();
+    if(canRead) {
+//         qDebug() << "The gtk2 config file exists...";
+        const QMap<QString, QString> foundSettings = readSettingsTuples(&configFile);
+        m_settings = QMap<QString, QString> {
+            {"toolbar_style", "GTK_TOOLBAR_ICONS"},
+            {"show_icons_buttons", "0"},
+            {"show_icons_menus", "0"},
+            {"primary_button_warps_slider", "false"}
+        };
+
+        for(auto it = foundSettings.constBegin(), itEnd = foundSettings.constEnd(); it!=itEnd; ++it) {
+            if (it.key() == "gtk-theme-name")
+                m_settings["theme"] = *it;
+            else if (it.key() == "gtk-icon-theme-name")
+                m_settings["icon"] = *it;
+            else if (it.key() == "gtk-fallback-icon-theme")
+                m_settings["icon_fallback"] = *it;
+            else if (it.key() == "gtk-cursor-theme-name")
+                m_settings["cursor"] = *it;
+            else if (it.key() == "gtk-font-name")
+                m_settings["font"] = *it;
+            else if (it.key() == "gtk-toolbar-style")
+                m_settings["toolbar_style"] = *it;
+            else if (it.key() == "gtk-button-images")
+                m_settings["show_icons_buttons"] = *it;
+            else if(it.key() == "gtk-menu-images")
+                m_settings["show_icons_menus"] = *it;
+            else if (it.key() == "gtk-primary-button-warps-slider")
+                m_settings["primary_button_warps_slider"] = *it;
+            else
+                qWarning() << "unknown field" << it.key();
+        }
+
     }
-    return true;
+    
+    return canRead;
 }
 
 QString AppearanceGTK2::themesGtkrcFile(const QString& themeName) const
@@ -82,7 +92,7 @@ QString AppearanceGTK2::themesGtkrcFile(const QString& themeName) const
     return QString();
 }
 
-bool AppearanceGTK2::saveSettingsPrivate(const QString& gtkrcFile) const
+bool AppearanceGTK2::saveSettings(const QString& gtkrcFile) const
 {
     QFile gtkrc(gtkrcFile);
     gtkrc.remove();
@@ -107,14 +117,14 @@ bool AppearanceGTK2::saveSettingsPrivate(const QString& gtkrcFile) const
         flow  << "include \"/etc/gtk-2.0/gtkrc\"\n"; //We include the /etc's config file
 
     int nameEnd = m_settings["font"].lastIndexOf(QRegExp(" ([0-9]+|bold|italic)"));
-    const auto fontFamily = m_settings["font"].leftRef(nameEnd);
+    QString fontFamily = m_settings["font"].left(nameEnd);
 
     //TODO: is this really needed?
     flow << "style \"user-font\" \n"
             << "{\n"
             << "\tfont_name=\""<< fontFamily << "\"\n"
             << "}\n";
-
+    
     flow << "widget_class \"*\" style \"user-font\"\n";
     flow << "gtk-font-name=\"" << m_settings["font"] << "\"\n";
     flow << "gtk-theme-name=\"" << m_settings["theme"] << "\"\n";
@@ -144,16 +154,6 @@ bool AppearanceGTK2::saveSettingsPrivate(const QString& gtkrcFile) const
     return true;
 }
 
-void AppearanceGTK2::reset()
-{
-    m_settings = QMap<QString, QString> {
-        {"toolbar_style", "GTK_TOOLBAR_ICONS"},
-        {"show_icons_buttons", "0"},
-        {"show_icons_menus", "0"},
-        {"primary_button_warps_slider", "false"}
-    };
-}
-
 QString AppearanceGTK2::defaultConfigFile() const
 {
     return QDir::homePath()+"/.gtkrc-2.0";
@@ -183,26 +183,3 @@ QStringList AppearanceGTK2::installedThemes() const
 
     return paths;
 }
-
-bool AppearanceGTK2::loadSettings()
-{
-    reset();
-
-    return loadSettingsPrivate("/etc/gtk-2.0/gtkrc") && loadSettingsPrivate(defaultConfigFile());
-}
-
-bool AppearanceGTK2::saveSettings() const
-{
-    return saveSettings(defaultConfigFile());
-}
-
-bool AppearanceGTK2::loadSettings(const QString& gtkrcFile)
-{
-    reset();
-    return loadSettingsPrivate(gtkrcFile);
-}
-
-bool AppearanceGTK2::saveSettings(const QString& gtkrcFile) const
-{
-    return saveSettingsPrivate(gtkrcFile);
-}
diff --git a/src/appearancegtk2.h b/src/appearancegtk2.h
index 7df49bf..8bc28ee 100644
--- a/src/appearancegtk2.h
+++ b/src/appearancegtk2.h
@@ -29,17 +29,10 @@ class AppearanceGTK2 : public AbstractAppearance
 {
     bool loadSettings(const QString& path) override;
     bool saveSettings(const QString& path) const override;
-    bool loadSettings() override;
-    bool saveSettings() const override;
+    QString defaultConfigFile() const override;
     QStringList installedThemes() const override;
-
+    
     QString themesGtkrcFile(const QString& themeName) const;
-
-private:
-    void reset();
-    QString defaultConfigFile() const;
-    bool loadSettingsPrivate(const QString& path);
-    bool saveSettingsPrivate(const QString& path) const;
 };
 
 #endif // APPEARANCEGTK2_H
diff --git a/src/appearancegtk3.cpp b/src/appearancegtk3.cpp
index 7df48c3..fa1bde5 100644
--- a/src/appearancegtk3.cpp
+++ b/src/appearancegtk3.cpp
@@ -25,8 +25,6 @@
 #include <QDir>
 #include <QDebug>
 #include <QStandardPaths>
-#include <KSharedConfig>
-#include <KConfigGroup>
 
 QStringList AppearanceGTK3::installedThemes() const
 {
@@ -53,65 +51,76 @@ QStringList AppearanceGTK3::installedThemes() const
     return themes;
 }
 
-bool AppearanceGTK3::saveSettings(const KSharedConfig::Ptr& file) const
-{
-    KConfigGroup group(file, "Settings");
-
-    group.writeEntry("gtk-font-name", m_settings["font"]);
-    group.writeEntry("gtk-theme-name", m_settings["theme"]);
-    group.writeEntry("gtk-icon-theme-name", m_settings["icon"]);
-    group.writeEntry("gtk-fallback-icon-theme", m_settings["icon_fallback"]);
-    group.writeEntry("gtk-cursor-theme-name", m_settings["cursor"]);
-    group.writeEntry("gtk-toolbar-style", m_settings["toolbar_style"]);
-    group.writeEntry("gtk-menu-images", m_settings["show_icons_menus"]);
-    group.writeEntry("gtk-button-images", m_settings["show_icons_buttons"]);
-    group.writeEntry("gtk-primary-button-warps-slider", m_settings["primary_button_warps_slider"]);
-    group.writeEntry("gtk-application-prefer-dark-theme", m_settings["application_prefer_dark_theme"]);
-
-    const bool sync = group.sync();
-    Q_ASSERT(sync);
-    return true;
-}
-
-bool AppearanceGTK3::loadSettings(const KSharedConfig::Ptr& file)
+bool AppearanceGTK3::saveSettings(const QString& file) const
 {
-    KConfigGroup group(file, "Settings");
-
-    if (!file || !group.isValid()) {
-        qWarning() << "Cannot open the GTK3 config file" << file;
+    //Opening GTK3 config file $ENV{XDG_CONFIG_HOME}/gtk-3.0/m_settings.ini
+    QDir::home().mkpath(file.left(file.lastIndexOf('/'))); //we make sure the path exists
+    QFile file_gtk3(file);
+    
+    if(!file_gtk3.open(QIODevice::WriteOnly | QIODevice::Text)) {
+        qWarning() << "Couldn't open GTK3 config file for writing at:" << file_gtk3.fileName();
         return false;
     }
+    QTextStream flow3(&file_gtk3);
+    flow3 << "[Settings]\n";
+    flow3 << "gtk-font-name=" << m_settings["font"] << "\n";
+    flow3 << "gtk-theme-name=" << m_settings["theme"] << "\n";
+    flow3 << "gtk-icon-theme-name="<< m_settings["icon"] << "\n";
+    flow3 << "gtk-fallback-icon-theme=" << m_settings["icon_fallback"] << "\n";
+    flow3 << "gtk-cursor-theme-name=" << m_settings["cursor"] << "\n";
+    flow3 << "gtk-toolbar-style=" << m_settings["toolbar_style"] << "\n";
+    flow3 << "gtk-menu-images=" << m_settings["show_icons_menus"] << "\n";
+    flow3 << "gtk-button-images=" << m_settings["show_icons_buttons"] << "\n";
+    flow3 << "gtk-primary-button-warps-slider=" << m_settings["primary_button_warps_slider"] << "\n";
+    flow3 << "gtk-application-prefer-dark-theme=" << m_settings["application_prefer_dark_theme"] << "\n";
 
-    m_settings = QMap<QString, QString> {
-        {"toolbar_style", "GTK_TOOLBAR_ICONS"},
-        {"show_icons_buttons", "0"},
-        {"show_icons_menus", "0"},
-        {"primary_button_warps_slider", "false"},
-        {"application_prefer_dark_theme", "false"}
-    };
-
-    m_settings["theme"] = group.readEntry("gtk-theme-name");
-    m_settings["icon"] = group.readEntry("gtk-icon-theme-name");
-    m_settings["icon_fallback"] = group.readEntry("gtk-fallback-icon-theme");
-    m_settings["cursor"] = group.readEntry("gtk-cursor-theme-name");
-    m_settings["font"] = group.readEntry("gtk-font-name");
-    m_settings["toolbar_style"] = group.readEntry("gtk-toolbar-style");
-    m_settings["show_icons_buttons"] = group.readEntry("gtk-button-images");
-    m_settings["show_icons_menus"] = group.readEntry("gtk-menu-images");
-    m_settings["primary_button_warps_slider"] = group.readEntry("gtk-primary-button-warps-slider");
-    m_settings["application_prefer_dark_theme"] = group.readEntry("gtk-application-prefer-dark-theme");
-    for(auto it = m_settings.begin(); it != m_settings.end(); ) {
-        if (it.value().isEmpty())
-            it = m_settings.erase(it);
-        else
-            ++it;
-    }
     return true;
 }
 
-QString AppearanceGTK3::configFileName() const
+bool AppearanceGTK3::loadSettings(const QString& path)
 {
-    return QStringLiteral("gtk-3.0/settings.ini");
+    QFile fileGtk3(path);
+    bool canRead=fileGtk3.open(QIODevice::ReadOnly | QIODevice::Text);
+    
+    if(canRead) {
+        const QMap<QString, QString> foundSettings = readSettingsTuples(&fileGtk3);
+        
+        m_settings = QMap<QString, QString> {
+            {"toolbar_style", "GTK_TOOLBAR_ICONS"},
+            {"show_icons_buttons", "0"},
+            {"show_icons_menus", "0"},
+            {"primary_button_warps_slider", "false"},
+            {"application_prefer_dark_theme", "false"}
+        };
+
+        for(auto it = foundSettings.constBegin(), itEnd = foundSettings.constEnd(); it!=itEnd; ++it) {
+            if (it.key() == "gtk-theme-name")
+                m_settings["theme"] = *it;
+            else if (it.key() == "gtk-icon-theme-name")
+                m_settings["icon"] = *it;
+            else if (it.key() == "gtk-fallback-icon-theme")
+                m_settings["icon_fallback"] = *it;
+            else if (it.key() == "gtk-cursor-theme-name")
+                m_settings["cursor"] = *it;
+            else if (it.key() == "gtk-font-name")
+                m_settings["font"] = *it;
+            else if (it.key() == "gtk-toolbar-style")
+                m_settings["toolbar_style"] = *it;
+            else if (it.key() == "gtk-button-images")
+                m_settings["show_icons_buttons"] = *it;
+            else if (it.key() == "gtk-menu-images")
+                m_settings["show_icons_menus"] = *it;
+            else if (it.key() == "gtk-primary-button-warps-slider")
+                m_settings["primary_button_warps_slider"] = *it;
+            else if (it.key() == "gtk-application-prefer-dark-theme")
+                m_settings["application_prefer_dark_theme"] = *it;
+            else
+                qWarning() << "unknown field" << it.key();
+        }
+    } else
+        qWarning() << "Cannot open the GTK3 config file" << path;
+    
+    return canRead;
 }
 
 QString AppearanceGTK3::defaultConfigFile() const
@@ -120,7 +129,7 @@ QString AppearanceGTK3::defaultConfigFile() const
     if(root.isEmpty())
         root = QFileInfo(QDir::home(), ".config").absoluteFilePath();
     
-    return root + '/' + configFileName();
+    return root+"/gtk-3.0/settings.ini";
 }
 
 bool AppearanceGTK3::getApplicationPreferDarkTheme() const
@@ -132,29 +141,3 @@ void AppearanceGTK3::setApplicationPreferDarkTheme(const bool& enable)
 {
     m_settings["application_prefer_dark_theme"] = enable ? "true" : "false";
 }
-
-bool AppearanceGTK3::saveSettings(const QString& file) const
-{
-    auto cfg = KSharedConfig::openConfig(file);
-    return saveSettings(cfg);
-}
-
-bool AppearanceGTK3::loadSettings(const QString& path)
-{
-    auto cfg = KSharedConfig::openConfig(path);
-    return loadSettings(cfg);
-}
-
-bool AppearanceGTK3::loadSettings()
-{
-    auto cfg = KSharedConfig::openConfig(configFileName());
-    cfg->setReadDefaults(true);
-    return loadSettings(cfg);
-}
-
-bool AppearanceGTK3::saveSettings() const
-{
-    auto cfg = KSharedConfig::openConfig(configFileName());
-    cfg->setReadDefaults(true);
-    return saveSettings(cfg);
-}
diff --git a/src/appearancegtk3.h b/src/appearancegtk3.h
index 3ce5a05..d4562b1 100644
--- a/src/appearancegtk3.h
+++ b/src/appearancegtk3.h
@@ -23,7 +23,6 @@
 #ifndef APPEARANCEGTK3_H
 #define APPEARANCEGTK3_H
 
-#include <KSharedConfig>
 #include "abstractappearance.h"
 
 class AppearanceGTK3 : public AbstractAppearance
@@ -31,18 +30,11 @@ class AppearanceGTK3 : public AbstractAppearance
 
 public:
     QStringList installedThemes() const override;
-    bool saveSettings() const override;
-    bool loadSettings() override;
     bool saveSettings(const QString& file) const override;
     bool loadSettings(const QString& path) override;
+    QString defaultConfigFile() const override;
     bool getApplicationPreferDarkTheme() const;
     void setApplicationPreferDarkTheme(const bool& enable);
-
-private:
-    QString defaultConfigFile() const;
-    QString configFileName() const;
-    bool saveSettings(const KSharedConfig::Ptr& file) const;
-    bool loadSettings(const KSharedConfig::Ptr& file);
 };
 
 #endif // APPEARANCEGTK3_H
diff --git a/src/appearencegtk.cpp b/src/appearencegtk.cpp
index 95a6604..2e26a5a 100644
--- a/src/appearencegtk.cpp
+++ b/src/appearencegtk.cpp
@@ -64,7 +64,7 @@ bool AppearenceGTK::loadFileConfig()
 {
     bool correct = false;
     foreach(AbstractAppearance* app, m_app) {
-        bool c = app->loadSettings();
+        bool c = app->loadSettings(app->defaultConfigFile());
         correct = correct || c;
     }
 //     qDebug() << "loading..." << correct;
@@ -75,7 +75,7 @@ bool AppearenceGTK::saveFileConfig()
 {
     bool correct = true;
     foreach(AbstractAppearance* app, m_app) {
-        bool c = app->saveSettings();
+        bool c = app->saveSettings(app->defaultConfigFile());
         correct = correct && c;
     }
 //     qDebug() << "saving..." << correct;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 151725d..05bf8f1 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -2,7 +2,7 @@ macro(add_kgc_test name)
     add_executable(${name} ${name}.cpp ${ARGV})
     add_test(${name} ${name})
     ecm_mark_as_test(${name})
-    target_link_libraries(${name} Qt5::Core Qt5::Gui Qt5::Test KF5::ConfigCore)
+    target_link_libraries(${name} Qt5::Core Qt5::Gui Qt5::Test)
     target_include_directories(${name} PRIVATE ${CMAKE_BINARY_DIR})
 endmacro(add_kgc_test)
 
diff --git a/tests/configsavetest.cpp b/tests/configsavetest.cpp
index 1fe8f4f..d5d8460 100644
--- a/tests/configsavetest.cpp
+++ b/tests/configsavetest.cpp
@@ -9,40 +9,33 @@
 
 QTEST_GUILESS_MAIN(ConfigSaveTest);
 
-ConfigSaveTest::ConfigSaveTest()
-{
-    QStandardPaths::setTestModeEnabled(true);
-}
-
-static void fillValues(QScopedPointer<AbstractAppearance>& a)
+void ConfigSaveTest::fillValues(AbstractAppearance* a)
 {
     a->setFont("a");
     a->setIcon("a");
     a->setTheme("a");
     a->setToolbarStyle("a");
     a->setIconFallback("a");
-    a->setCursor("a");
     a->setShowIconsInButtons(true);
     a->setShowIconsInMenus(true);
     a->setPrimaryButtonWarpsSlider(true);
 
-    auto a3 = dynamic_cast<AppearanceGTK3*>(a.data());
+    auto a3 = dynamic_cast<AppearanceGTK3*>(a);
     if (a3) {
         a3->setApplicationPreferDarkTheme(false);
     }
 }
 
-void compareAppearances(QScopedPointer<AbstractAppearance>& reloaded, QScopedPointer<AbstractAppearance>& instance)
+bool compareAppearances(AbstractAppearance* a, AbstractAppearance* b)
 {
-    QCOMPARE(reloaded->getFont(), instance->getFont());
-    QCOMPARE(reloaded->getIcon(), instance->getIcon());
-    QCOMPARE(reloaded->getTheme(), instance->getTheme());
-    QCOMPARE(reloaded->getCursor(), instance->getCursor());
-    QCOMPARE(reloaded->getToolbarStyle(), instance->getToolbarStyle());
-    QCOMPARE(reloaded->getIconFallback(), instance->getIconFallback());
-    QCOMPARE(reloaded->getShowIconsInButtons(), instance->getShowIconsInButtons());
-    QCOMPARE(reloaded->getShowIconsInMenus(), instance->getShowIconsInMenus());
-    QCOMPARE(reloaded->getPrimaryButtonWarpsSlider(), instance->getPrimaryButtonWarpsSlider());
+    return a->getFont() == b->getFont()
+        && a->getIcon() == b->getIcon()
+        && a->getTheme() == b->getTheme()
+        && a->getToolbarStyle() == b->getToolbarStyle()
+        && a->getIconFallback() == b->getIconFallback()
+        && a->getShowIconsInButtons() == b->getShowIconsInButtons()
+        && a->getShowIconsInMenus() == b->getShowIconsInMenus()
+        && a->getPrimaryButtonWarpsSlider() == b->getPrimaryButtonWarpsSlider();
 }
 
 QByteArray readFile(const QString& path)
@@ -53,35 +46,23 @@ QByteArray readFile(const QString& path)
     return f.readAll();
 }
 
-void ConfigSaveTest::testGtk2()
+void ConfigSaveTest::testOpen()
 {
-    const QString pathA = QDir::current().absoluteFilePath("test-gtk2")
-                , pathB = QDir::current().absoluteFilePath("testB-gtk2");
-
-    QScopedPointer<AbstractAppearance> instance(new AppearanceGTK2);
-    fillValues(instance);
-    QVERIFY(instance->saveSettings(pathA));
-
-    QScopedPointer<AbstractAppearance> reloaded(new AppearanceGTK2);
-    QVERIFY(reloaded->loadSettings(pathA));
-    compareAppearances(reloaded, instance);
-    QVERIFY(reloaded->saveSettings(pathB));
-    QCOMPARE(readFile(pathA), readFile(pathB));
-}
-
-void ConfigSaveTest::testGtk3()
-{
-    QScopedPointer<AbstractAppearance> instance(new AppearanceGTK3);
-    fillValues(instance);
-    const QString pathA = QDir::current().absoluteFilePath("test-gtk3")
-                , pathB = QDir::current().absoluteFilePath("testB-gtk3");
-    QVERIFY(instance->saveSettings(pathA));
-
-    QScopedPointer<AbstractAppearance> reloaded(new AppearanceGTK3);
-    QVERIFY(QFile::exists(pathA));
-    QVERIFY(reloaded->loadSettings(pathA));
-    compareAppearances(reloaded, instance);
-    QVERIFY(reloaded->saveSettings(pathB));
+    QVector<AbstractAppearance*> instances;
+    instances << new AppearanceGTK2 << new AppearanceGTK3;
+    fillValues(instances[0]);
+    fillValues(instances[1]);
+    QVERIFY(instances[0]->saveSettings("test-gtk2"));
+    QVERIFY(instances[1]->saveSettings("test-gtk3"));
 
-    QCOMPARE(readFile(pathA), readFile(pathB));
+    QVector<AbstractAppearance*> reloaded;
+    reloaded << new AppearanceGTK2 << new AppearanceGTK3;
+    QVERIFY(reloaded[0]->loadSettings("test-gtk2"));
+    QVERIFY(reloaded[1]->loadSettings("test-gtk3"));
+    QVERIFY(compareAppearances(reloaded[0], instances[0]));
+    QVERIFY(compareAppearances(reloaded[1], instances[1]));
+    QVERIFY(reloaded[0]->saveSettings("testB-gtk2"));
+    QVERIFY(reloaded[1]->saveSettings("testB-gtk3"));
+    QCOMPARE(readFile("test-gtk2"), readFile("testB-gtk2"));
+    QCOMPARE(readFile("test-gtk3"), readFile("testB-gtk3"));
 }
diff --git a/tests/configsavetest.h b/tests/configsavetest.h
index 342b408..39fb4c2 100644
--- a/tests/configsavetest.h
+++ b/tests/configsavetest.h
@@ -11,11 +11,11 @@ class AbstractAppearance;
 class ConfigSaveTest : public QObject
 {
     Q_OBJECT
-public:
-    ConfigSaveTest();
 private slots:
-    void testGtk2();
-    void testGtk3();
+    void testOpen();
+
+private:
+    void fillValues(AbstractAppearance* a);
 };
 
 #endif // CONFIGSAVETEST_H
-- 
cgit v0.11.2