blob: 161a709af75597a5f1a4abf7d23d883752e97ed5 (
plain)
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
|
/*
* SPDX-FileCopyrightText: 2025 Felix Morgner <felix.morgner@gmail.com>
* SPDX-License-Identifier: LGPL-2.1-only
*/
#include "turns/core/settings.hpp"
#include <glibmm/refptr.h>
#include <glibmm/wrap.h>
#include <giomm/settings.h>
#include <giomm/settingsschemasource.h>
#include <gio/gsettings.h>
namespace turns::core
{
auto get_settings() -> Glib::RefPtr<Gio::Settings>
{
auto constexpr schema_id = "ch.arknet.Turns";
#ifdef TURNS_SETTINGS_SCHEMA_DIR
auto source = Gio::SettingsSchemaSource::create(TURNS_SETTINGS_SCHEMA_DIR "/glib-2.0/schemas", true);
auto schema = source->lookup(schema_id, true);
auto settings = g_settings_new_full(Glib::unwrap(schema), nullptr, nullptr);
return Glib::wrap(settings);
#else
return Gio::Settings::create(schema_id);
#endif
}
} // namespace turns::core
|