summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2021-06-04 20:13:18 +0200
committerChristian Persch <chpe@src.gnome.org>2021-06-04 20:13:18 +0200
commitf5ac87f5d82d0b364ea1cfac57cdf84bdce93380 (patch)
tree3b0d07a614b2b29a094052ab770b77c8d1018381
parentb915867e31ec3a09f230f45cc82cebab63039ca8 (diff)
downloadgnome-terminal-f5ac87f5d82d0b364ea1cfac57cdf84bdce93380.tar.gz
all: Specify the schema source when constructing any GSettings
Specify the GSettingsSchemaSource to use when constructing a GSettings object. Due to https://gitlab.gnome.org/GNOME/glib/-/issues/1884 this neccessitates not using g_settings_get_child() to construct a child setting, but instead to construct the child GSettings directly. In preparation for the next commit.
-rw-r--r--src/terminal-app.cc81
-rw-r--r--src/terminal-app.hh12
-rw-r--r--src/terminal-client-utils.cc22
-rw-r--r--src/terminal-client-utils.hh7
-rw-r--r--src/terminal-options.cc2
-rw-r--r--src/terminal-profiles-list.cc6
-rw-r--r--src/terminal-profiles-list.hh2
-rw-r--r--src/terminal-schemas.hh2
-rw-r--r--src/terminal-settings-list.cc39
-rw-r--r--src/terminal-settings-list.hh3
-rw-r--r--src/terminal-util.cc61
-rw-r--r--src/terminal-util.hh7
12 files changed, 184 insertions, 60 deletions
diff --git a/src/terminal-app.cc b/src/terminal-app.cc
index 125fcf7c..3f456a2e 100644
--- a/src/terminal-app.cc
+++ b/src/terminal-app.cc
@@ -32,6 +32,7 @@
#include "terminal-debug.hh"
#include "terminal-app.hh"
#include "terminal-accels.hh"
+#include "terminal-client-utils.hh"
#include "terminal-screen.hh"
#include "terminal-screen-container.hh"
#include "terminal-window.hh"
@@ -61,6 +62,10 @@
#define DESKTOP_INTERFACE_SETTINGS_SCHEMA "org.gnome.desktop.interface"
#define SYSTEM_PROXY_SETTINGS_SCHEMA "org.gnome.system.proxy"
+#define SYSTEM_HTTP_PROXY_SETTINGS_SCHEMA "org.gnome.system.proxy.http"
+#define SYSTEM_HTTPS_PROXY_SETTINGS_SCHEMA "org.gnome.system.proxy.https"
+#define SYSTEM_FTP_PROXY_SETTINGS_SCHEMA "org.gnome.system.proxy.ftp"
+#define SYSTEM_SOCKS_PROXY_SETTINGS_SCHEMA "org.gnome.system.proxy.socks"
#define GTK_SETTING_PREFER_DARK_THEME "gtk-application-prefer-dark-theme"
@@ -98,9 +103,11 @@ struct _TerminalApp
GHashTable *screen_map;
+ GSettingsSchemaSource* schema_source;
GSettings *global_settings;
GSettings *desktop_interface_settings;
GSettings *system_proxy_settings;
+ GSettings* system_proxy_protocol_settings[4];
GSettings *gtk_debug_settings;
#ifdef ENABLE_SEARCH_PROVIDER
@@ -803,19 +810,45 @@ terminal_app_init (TerminalApp *app)
gtk_window_set_default_icon_name (GNOME_TERMINAL_ICON_NAME);
+ app->schema_source = g_settings_schema_source_get_default();
+
/* Desktop proxy settings */
- app->system_proxy_settings = g_settings_new (SYSTEM_PROXY_SETTINGS_SCHEMA);
+ app->system_proxy_settings = terminal_g_settings_new(app->schema_source,
+ SYSTEM_PROXY_SETTINGS_SCHEMA);
+
+ /* Since there is no way to get the schema ID of a child schema, we cannot
+ * verify that the installed schemas are correct. Also, due to a glib bug
+ * (https://gitlab.gnome.org/GNOME/glib/-/issues/1884) g_settings_get_child()
+ * doesn't work with non-default schema sources.
+ * So instead of using g_settings_get_child() on the SYSTEM_PROXY_SETTINGS_SCHEMA,
+ * we construct the child GSettings directly.
+ */
+ app->system_proxy_protocol_settings[TERMINAL_PROXY_HTTP] =
+ terminal_g_settings_new(app->schema_source,
+ SYSTEM_HTTP_PROXY_SETTINGS_SCHEMA);
+ app->system_proxy_protocol_settings[TERMINAL_PROXY_HTTPS] =
+ terminal_g_settings_new(app->schema_source,
+ SYSTEM_HTTPS_PROXY_SETTINGS_SCHEMA);
+ app->system_proxy_protocol_settings[TERMINAL_PROXY_FTP] =
+ terminal_g_settings_new(app->schema_source,
+ SYSTEM_FTP_PROXY_SETTINGS_SCHEMA);
+ app->system_proxy_protocol_settings[TERMINAL_PROXY_SOCKS] =
+ terminal_g_settings_new(app->schema_source,
+ SYSTEM_SOCKS_PROXY_SETTINGS_SCHEMA);
/* Desktop Interface settings */
- app->desktop_interface_settings = g_settings_new (DESKTOP_INTERFACE_SETTINGS_SCHEMA);
+ app->desktop_interface_settings = terminal_g_settings_new(app->schema_source,
+ DESKTOP_INTERFACE_SETTINGS_SCHEMA);
/* Terminal global settings */
- app->global_settings = g_settings_new (TERMINAL_SETTING_SCHEMA);
+ app->global_settings = terminal_g_settings_new(app->schema_source,
+ TERMINAL_SETTING_SCHEMA);
/* Gtk debug settings */
- app->gtk_debug_settings = terminal_g_settings_new (GTK_DEBUG_SETTING_SCHEMA,
- GTK_DEBUG_ENABLE_INSPECTOR_KEY,
- GTK_DEBUG_ENABLE_INSPECTOR_TYPE);
+ app->gtk_debug_settings = terminal_g_settings_new_checked(app->schema_source,
+ GTK_DEBUG_SETTING_SCHEMA,
+ GTK_DEBUG_ENABLE_INSPECTOR_KEY,
+ GTK_DEBUG_ENABLE_INSPECTOR_TYPE);
/* These are internal settings that exists only for distributions
* to override, so we cache them on startup and don't react to changes.
@@ -845,11 +878,14 @@ terminal_app_init (TerminalApp *app)
#endif
/* Get the profiles */
- app->profiles_list = terminal_profiles_list_new ();
+ app->profiles_list = terminal_profiles_list_new(app->schema_source);
app->screen_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nullptr);
- gs_unref_object GSettings *settings = g_settings_get_child (app->global_settings, "keybindings");
+ gs_unref_object GSettings *settings =
+ terminal_g_settings_new_with_path(app->schema_source,
+ TERMINAL_KEYBINDINGS_SCHEMA,
+ TERMINAL_KEYBINDINGS_SCHEMA_PATH);
terminal_accels_init (G_APPLICATION (app), settings, app->use_headerbar);
}
@@ -871,7 +907,10 @@ terminal_app_finalize (GObject *object)
g_object_unref (app->global_settings);
g_object_unref (app->desktop_interface_settings);
g_object_unref (app->system_proxy_settings);
+ for (int i = 0; i < 4; ++i)
+ g_object_unref(app->system_proxy_protocol_settings[i]);
g_clear_object (&app->gtk_debug_settings);
+ g_settings_schema_source_unref(app->schema_source);
g_clear_object (&app->menubar);
g_clear_object (&app->menubar_new_terminal_section);
@@ -1188,6 +1227,18 @@ terminal_app_get_profile_section (TerminalApp *app)
}
/**
+ * terminal_app_get_schema_source:
+ * @app: a #TerminalApp
+ *
+ * Returns: (tranfer none): the #GSettingsSchemaSource to use for all #GSettings instances
+ */
+GSettingsSchemaSource*
+terminal_app_get_schema_source(TerminalApp *app)
+{
+ return app->schema_source;
+}
+
+/**
* terminal_app_get_global_settings:
* @app: a #TerminalApp
*
@@ -1223,6 +1274,20 @@ terminal_app_get_proxy_settings (TerminalApp *app)
return app->system_proxy_settings;
}
+/**
+ * terminal_app_get_proxy_settings_for_protocol:
+ * @app: a #TerminalApp
+ * @protocol: a #TerminalProxyProtocol
+ *
+ * Returns: (tranfer none): the cached #GSettings object for the org.gnome.system.proxy.@protocol schema
+ */
+GSettings*
+terminal_app_get_proxy_settings_for_protocol(TerminalApp *app,
+ TerminalProxyProtocol protocol)
+{
+ return app->system_proxy_protocol_settings[(int)protocol];
+}
+
GSettings *
terminal_app_get_gtk_debug_settings (TerminalApp *app)
{
diff --git a/src/terminal-app.hh b/src/terminal-app.hh
index d7e97681..b86aea5d 100644
--- a/src/terminal-app.hh
+++ b/src/terminal-app.hh
@@ -102,12 +102,24 @@ gboolean terminal_app_get_dialog_use_headerbar (TerminalApp *app);
/* GSettings */
+typedef enum {
+ TERMINAL_PROXY_HTTP = 0,
+ TERMINAL_PROXY_HTTPS = 1,
+ TERMINAL_PROXY_FTP = 2,
+ TERMINAL_PROXY_SOCKS = 3,
+} TerminalProxyProtocol;
+
+GSettingsSchemaSource* terminal_app_get_schema_source(TerminalApp* app);
+
GSettings *terminal_app_get_global_settings (TerminalApp *app);
GSettings *terminal_app_get_desktop_interface_settings (TerminalApp *app);
GSettings *terminal_app_get_proxy_settings (TerminalApp *app);
+GSettings *terminal_app_get_proxy_settings_for_protocol(TerminalApp *app,
+ TerminalProxyProtocol protocol);
+
GSettings *terminal_app_get_gtk_debug_settings (TerminalApp *app);
PangoFontDescription *terminal_app_get_system_font (TerminalApp *app);
diff --git a/src/terminal-client-utils.cc b/src/terminal-client-utils.cc
index b3d6ae6d..4d7ed70d 100644
--- a/src/terminal-client-utils.cc
+++ b/src/terminal-client-utils.cc
@@ -284,3 +284,25 @@ out:
#endif
return nullptr;
}
+
+GSettings*
+terminal_g_settings_new_with_path (GSettingsSchemaSource* source,
+ char const* schema_id,
+ char const* path)
+{
+ gs_unref_settings_schema GSettingsSchema* schema =
+ g_settings_schema_source_lookup(source,
+ schema_id,
+ TRUE /* recursive */);
+
+ return g_settings_new_full(schema,
+ nullptr /* default backend */,
+ path);
+}
+
+GSettings*
+terminal_g_settings_new(GSettingsSchemaSource* source,
+ char const* schema_id)
+{
+ return terminal_g_settings_new_with_path(source, schema_id, nullptr);
+}
diff --git a/src/terminal-client-utils.hh b/src/terminal-client-utils.hh
index 19a0a2b7..0e1c14c5 100644
--- a/src/terminal-client-utils.hh
+++ b/src/terminal-client-utils.hh
@@ -53,6 +53,13 @@ char const* const* terminal_client_get_environment_filters (void);
char** terminal_client_filter_environment (char** envv) G_GNUC_MALLOC;
+GSettings* terminal_g_settings_new (GSettingsSchemaSource* source,
+ char const* schema_id);
+
+GSettings* terminal_g_settings_new_with_path (GSettingsSchemaSource* source,
+ char const* schema_id,
+ char const* path);
+
G_END_DECLS
#endif /* TERMINAL_UTIL_UTILS_H */
diff --git a/src/terminal-options.cc b/src/terminal-options.cc
index d015d167..04c55893 100644
--- a/src/terminal-options.cc
+++ b/src/terminal-options.cc
@@ -111,7 +111,7 @@ static TerminalSettingsList *
terminal_options_ensure_profiles_list (TerminalOptions *options)
{
if (options->profiles_list == nullptr)
- options->profiles_list = terminal_profiles_list_new ();
+ options->profiles_list = terminal_profiles_list_new(g_settings_schema_source_get_default());
return options->profiles_list;
}
diff --git a/src/terminal-profiles-list.cc b/src/terminal-profiles-list.cc
index 6d4c6a56..07a97636 100644
--- a/src/terminal-profiles-list.cc
+++ b/src/terminal-profiles-list.cc
@@ -65,13 +65,15 @@ valid_uuid (const char *str,
/**
* terminal_profiles_list_new:
+ * @schema_source: a #GSettingsSchemaSource
*
* Returns: (transfer full): a new #TerminalSettingsList for the profiles list
*/
TerminalSettingsList *
-terminal_profiles_list_new (void)
+terminal_profiles_list_new(GSettingsSchemaSource* schema_source)
{
- return terminal_settings_list_new (TERMINAL_PROFILES_PATH_PREFIX,
+ return terminal_settings_list_new (schema_source,
+ TERMINAL_PROFILES_PATH_PREFIX,
TERMINAL_PROFILES_LIST_SCHEMA,
TERMINAL_PROFILE_SCHEMA,
TERMINAL_SETTINGS_LIST_FLAG_HAS_DEFAULT);
diff --git a/src/terminal-profiles-list.hh b/src/terminal-profiles-list.hh
index 9a258d31..d8323751 100644
--- a/src/terminal-profiles-list.hh
+++ b/src/terminal-profiles-list.hh
@@ -25,7 +25,7 @@
G_BEGIN_DECLS
-TerminalSettingsList *terminal_profiles_list_new (void);
+TerminalSettingsList *terminal_profiles_list_new(GSettingsSchemaSource* schema_source);
GList *terminal_profiles_list_ref_children_sorted (TerminalSettingsList *list);
diff --git a/src/terminal-schemas.hh b/src/terminal-schemas.hh
index 08b6e85f..b146ba82 100644
--- a/src/terminal-schemas.hh
+++ b/src/terminal-schemas.hh
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
#define TERMINAL_SETTINGS_LIST_SCHEMA "org.gnome.Terminal.SettingsList"
#define TERMINAL_PROFILES_LIST_SCHEMA "org.gnome.Terminal.ProfilesList"
+#define TERMINAL_KEYBINDINGS_SCHEMA_PATH "/org/gnome/terminal/legacy/keybindings/"
+
#define TERMINAL_PROFILE_AUDIBLE_BELL_KEY "audible-bell"
#define TERMINAL_PROFILE_BOLD_IS_BRIGHT_KEY "bold-is-bright"
#define TERMINAL_PROFILE_BACKGROUND_COLOR_KEY "background-color"
diff --git a/src/terminal-settings-list.cc b/src/terminal-settings-list.cc
index a247765b..095b99dc 100644
--- a/src/terminal-settings-list.cc
+++ b/src/terminal-settings-list.cc
@@ -18,6 +18,7 @@
#include "config.h"
#include "terminal-settings-list.hh"
+#include "terminal-client-utils.hh"
#include <string.h>
#include <uuid.h>
@@ -38,6 +39,7 @@ extern "C" {
struct _TerminalSettingsList {
GSettings parent;
+ GSettingsSchemaSource* schema_source;
char *path;
char *child_schema_id;
@@ -57,7 +59,8 @@ struct _TerminalSettingsListClass {
};
enum {
- PROP_CHILD_SCHEMA_ID = 1,
+ PROP_SCHEMA_SOURCE = 1,
+ PROP_CHILD_SCHEMA_ID,
PROP_FLAGS
};
@@ -267,7 +270,9 @@ terminal_settings_list_ref_child_internal (TerminalSettingsList *list,
goto done;
path = path_new (list, uuid);
- child = g_settings_new_with_path (list->child_schema_id, path);
+ child = terminal_g_settings_new_with_path(list->schema_source,
+ list->child_schema_id,
+ path);
g_hash_table_insert (list->children, g_strdup (uuid), child /* adopted */);
done:
@@ -282,7 +287,10 @@ new_child (TerminalSettingsList *list,
if (name != nullptr) {
gs_free char *new_path = path_new (list, new_uuid);
- gs_unref_object GSettings *child = g_settings_new_with_path (list->child_schema_id, new_path);
+ gs_unref_object GSettings *child =
+ terminal_g_settings_new_with_path(list->schema_source,
+ list->child_schema_id,
+ new_path);
g_settings_set_string (child, TERMINAL_PROFILE_VISIBLE_NAME_KEY, name);
}
@@ -520,6 +528,7 @@ terminal_settings_list_constructed (GObject *object)
G_OBJECT_CLASS (terminal_settings_list_parent_class)->constructed (object);
+ g_assert (list->schema_source != nullptr);
g_assert (list->child_schema_id != nullptr);
g_object_get (object, "path", &list->path, nullptr);
@@ -541,6 +550,7 @@ terminal_settings_list_finalize (GObject *object)
g_strfreev (list->uuids);
g_free (list->default_uuid);
g_hash_table_unref (list->children);
+ g_settings_schema_source_unref(list->schema_source);
G_OBJECT_CLASS (terminal_settings_list_parent_class)->finalize (object);
}
@@ -554,6 +564,11 @@ terminal_settings_list_set_property (GObject *object,
TerminalSettingsList *list = TERMINAL_SETTINGS_LIST (object);
switch (prop_id) {
+ case PROP_SCHEMA_SOURCE: {
+ auto const schema_source = reinterpret_cast<GSettingsSchemaSource*>(g_value_get_boxed(value));
+ list->schema_source = g_settings_schema_source_ref(schema_source);
+ break;
+ }
case PROP_CHILD_SCHEMA_ID:
list->child_schema_id = g_value_dup_string (value);
break;
@@ -581,6 +596,18 @@ terminal_settings_list_class_init (TerminalSettingsListClass *klass)
*
* The name of the schema of the children of this list.
*/
+ g_object_class_install_property (object_class, PROP_SCHEMA_SOURCE,
+ g_param_spec_boxed("schema-source", nullptr, nullptr,
+ G_TYPE_SETTINGS_SCHEMA_SOURCE,
+ GParamFlags(G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_WRITABLE |
+ G_PARAM_STATIC_STRINGS)));
+
+ /**
+ * TerminalSettingsList:child-schema-id:
+ *
+ * The name of the schema of the children of this list.
+ */
g_object_class_install_property (object_class, PROP_CHILD_SCHEMA_ID,
g_param_spec_string ("child-schema-id", nullptr, nullptr,
nullptr,
@@ -639,6 +666,7 @@ terminal_settings_list_class_init (TerminalSettingsListClass *klass)
/**
* terminal_settings_list_new:
+ * @schema_source: a #GSettingsSchemaSource
* @path: the settings path for the list
* @schema_id: the schema of the list, equal to or derived from "org.gnome.Terminal.SettingsList"
* @child_schema_id: the schema of the list children
@@ -647,17 +675,20 @@ terminal_settings_list_class_init (TerminalSettingsListClass *klass)
* Returns: (transfer full): the newly created #TerminalSettingsList
*/
TerminalSettingsList *
-terminal_settings_list_new (const char *path,
+terminal_settings_list_new (GSettingsSchemaSource* schema_source,
+ const char *path,
const char *schema_id,
const char *child_schema_id,
TerminalSettingsListFlags flags)
{
+ g_return_val_if_fail (schema_source != nullptr, nullptr);
g_return_val_if_fail (path != nullptr, nullptr);
g_return_val_if_fail (schema_id != nullptr, nullptr);
g_return_val_if_fail (child_schema_id != nullptr, nullptr);
g_return_val_if_fail (g_str_has_suffix (path, ":/"), nullptr);
return reinterpret_cast<TerminalSettingsList*>(g_object_new (TERMINAL_TYPE_SETTINGS_LIST,
+ "schema-source", schema_source,
"schema-id", schema_id,
"child-schema-id", child_schema_id,
"path", path,
diff --git a/src/terminal-settings-list.hh b/src/terminal-settings-list.hh
index 40fc8414..f131c2fa 100644
--- a/src/terminal-settings-list.hh
+++ b/src/terminal-settings-list.hh
@@ -36,7 +36,8 @@ typedef struct _TerminalSettingsListClass TerminalSettingsListClass;
GType terminal_settings_list_get_type (void);
-TerminalSettingsList *terminal_settings_list_new (const char *path,
+TerminalSettingsList *terminal_settings_list_new (GSettingsSchemaSource* schema_source,
+ const char *path,
const char *schema_id,
const char *child_schema_id,
TerminalSettingsListFlags flags);
diff --git a/src/terminal-util.cc b/src/terminal-util.cc
index db3a756c..7fbb1f78 100644
--- a/src/terminal-util.cc
+++ b/src/terminal-util.cc
@@ -584,21 +584,19 @@ set_proxy_env (GHashTable *env_table,
}
static void
-setup_proxy_env (GSettings *proxy_settings,
- const char *child_schema_id,
+setup_proxy_env (TerminalApp* app,
+ TerminalProxyProtocol protocol,
const char *proxy_scheme,
const char *env_name,
GHashTable *env_table)
{
- gs_unref_object GSettings *child_settings;
GString *buf;
gs_free char *host;
int port;
- gboolean is_http;
- is_http = (strcmp (child_schema_id, "http") == 0);
+ gboolean is_http = (protocol == TERMINAL_PROXY_HTTP);
- child_settings = g_settings_get_child (proxy_settings, child_schema_id);
+ GSettings *child_settings = terminal_app_get_proxy_settings_for_protocol(app, protocol);
host = g_settings_get_string (child_settings, "host");
port = g_settings_get_int (child_settings, "port");
@@ -636,23 +634,6 @@ setup_proxy_env (GSettings *proxy_settings,
}
static void
-setup_autoconfig_proxy_env (GSettings *proxy_settings,
- GHashTable *env_table)
-{
- /* XXX Not sure what to do with this. See bug #596688.
- gs_free char *url;
-
- url = g_settings_get_string (proxy_settings, "autoconfig-url");
- if (url[0])
- {
- char *proxy;
- proxy = g_strdup_printf ("pac+%s", url);
- set_proxy_env (env_table, "http_proxy", proxy);
- }
- */
-}
-
-static void
setup_ignore_proxy_env (GSettings *proxy_settings,
GHashTable *env_table)
{
@@ -684,25 +665,23 @@ setup_ignore_proxy_env (GSettings *proxy_settings,
void
terminal_util_add_proxy_env (GHashTable *env_table)
{
- GSettings *proxy_settings;
- GDesktopProxyMode mode;
-
- proxy_settings = terminal_app_get_proxy_settings (terminal_app_get ());
- mode = GDesktopProxyMode(g_settings_get_enum (proxy_settings, "mode"));
+ auto const app = terminal_app_get();
+ auto const proxy_settings = terminal_app_get_proxy_settings(app);
+ auto const mode = GDesktopProxyMode(g_settings_get_enum (proxy_settings, "mode"));
if (mode == G_DESKTOP_PROXY_MODE_MANUAL)
{
- setup_proxy_env (proxy_settings, "http", "http", "http_proxy", env_table);
+ setup_proxy_env (app, TERMINAL_PROXY_HTTP, "http", "http_proxy", env_table);
/* Even though it's https, the proxy scheme is 'http'. See bug #624440. */
- setup_proxy_env (proxy_settings, "https", "http", "https_proxy", env_table);
+ setup_proxy_env (app, TERMINAL_PROXY_HTTPS, "http", "https_proxy", env_table);
/* Even though it's ftp, the proxy scheme is 'http'. See bug #624440. */
- setup_proxy_env (proxy_settings, "ftp", "http", "ftp_proxy", env_table);
- setup_proxy_env (proxy_settings, "socks", "socks", "all_proxy", env_table);
+ setup_proxy_env (app, TERMINAL_PROXY_FTP, "http", "ftp_proxy", env_table);
+ setup_proxy_env (app, TERMINAL_PROXY_SOCKS, "socks", "all_proxy", env_table);
setup_ignore_proxy_env (proxy_settings, env_table);
}
else if (mode == G_DESKTOP_PROXY_MODE_AUTO)
{
- setup_autoconfig_proxy_env (proxy_settings, env_table);
+ /* Not supported */
}
}
@@ -795,7 +774,8 @@ s_to_rgba (GVariant *variant,
}
/**
- * terminal_g_settings_new:
+ * terminal_g_settings_new_checked:
+ * @schema_source: a #GSettingsSchemaSource
* @schema_id: a settings schema ID
* @mandatory_key: the name of a key that must exist in the schema
* @mandatory_key_type: the expected value type of @mandatory_key
@@ -807,15 +787,16 @@ s_to_rgba (GVariant *variant,
* Returns: (transfer full): a new #GSettings, or %nullptr
*/
GSettings *
-terminal_g_settings_new (const char *schema_id,
- const char *mandatory_key,
- const GVariantType *mandatory_key_type)
+terminal_g_settings_new_checked(GSettingsSchemaSource* schema_source,
+ const char *schema_id,
+ const char *mandatory_key,
+ const GVariantType *mandatory_key_type)
{
gs_unref_settings_schema GSettingsSchema *schema;
- schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
- schema_id,
- TRUE);
+ schema = g_settings_schema_source_lookup(schema_source,
+ schema_id,
+ TRUE);
if (schema == nullptr)
return nullptr;
diff --git a/src/terminal-util.hh b/src/terminal-util.hh
index 07c9470a..888a0fb0 100644
--- a/src/terminal-util.hh
+++ b/src/terminal-util.hh
@@ -71,9 +71,10 @@ char **terminal_util_get_etc_shells (void);
gboolean terminal_util_get_is_shell (const char *command);
-GSettings *terminal_g_settings_new (const char *schema_id,
- const char *mandatory_key,
- const GVariantType *mandatory_key_type);
+GSettings *terminal_g_settings_new_checked(GSettingsSchemaSource* schema_source,
+ const char *schema_id,
+ const char *mandatory_key,
+ const GVariantType *mandatory_key_type);
const GdkRGBA *terminal_g_settings_get_rgba (GSettings *settings,
const char *key,