Newer
Older
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
#include "matetheme.h"
#include <QStringList>
#include <QDir>
#include <QProcess>
MateTheme::MateTheme(const QString &path, QObject *parent)
: QObject(parent), path_(path)
{
themeName_ = QDir(path_).dirName();
}
bool MateTheme::applyAsWallpaper() const
{
return setConfig("org.mate.background", "picture-filename", path_);
}
bool MateTheme::applyAsIcon() const
{
return setConfig("org.mate.interface", "icon-theme", themeName_);
}
bool MateTheme::applyAsCursor() const
{
return setConfig("org.mate.peripherals-mouse", "cursor-theme", themeName_);
}
bool MateTheme::applyAsGtk2Theme() const
{
return setConfig("org.mate.interface", "gtk-theme", themeName_);
}
bool MateTheme::applyAsMetacityTheme() const
{
return setConfig("org.mate.Marco.general", "theme", themeName_);
}
bool MateTheme::setConfig(const QString &schema, const QString &key, const QString &value) const
{
return QProcess::startDetached("gsettings", QStringList() << "set" << schema << key << value);
}