nixpkgs/pkgs/desktops/mate/caja-extensions/hardcode-gsettings.patch
Bobby Rong 8d9763d043
mate.caja-extensions: Fix wrong schema path
Some schema comes from the mate-desktop package:

- org.mate.applications-terminal
- org.mate.background
2022-11-13 20:00:48 +08:00

170 lines
7.2 KiB
Diff

diff --git a/open-terminal/caja-open-terminal.c b/open-terminal/caja-open-terminal.c
index e14a9bf..691afab 100644
--- a/open-terminal/caja-open-terminal.c
+++ b/open-terminal/caja-open-terminal.c
@@ -135,8 +135,18 @@ desktop_opens_home_dir (void)
{
gboolean result;
GSettings* settings;
-
- settings = g_settings_new (COT_SCHEMA);
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@GSETTINGS_PATH@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ COT_SCHEMA,
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
result = g_settings_get_boolean (settings, COT_DESKTOP_KEY);
g_object_unref (settings);
return result;
@@ -147,8 +157,18 @@ set_desktop_opens_home_dir (gboolean val)
{
gboolean result;
GSettings* settings;
-
- settings = g_settings_new (COT_SCHEMA);
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@GSETTINGS_PATH@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ COT_SCHEMA,
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
result = g_settings_set_boolean (settings, COT_DESKTOP_KEY, val);
g_object_unref (settings);
return result;
@@ -159,8 +179,18 @@ desktop_is_home_dir (void)
{
gboolean result;
GSettings* settings;
-
- settings = g_settings_new (CAJA_SCHEMA);
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@caja_gsetttings_path@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ CAJA_SCHEMA,
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
result = g_settings_get_boolean (settings, CAJA_DESKTOP_KEY);
g_object_unref (settings);
return result;
@@ -171,8 +201,18 @@ default_terminal_application (void)
{
gchar *result;
GSettings* settings;
-
- settings = g_settings_new (TERM_SCHEMA);
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@desktop_gsetttings_path@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ TERM_SCHEMA,
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
result = g_settings_get_string (settings, TERM_EXEC_KEY);
g_object_unref (settings);
@@ -189,8 +229,18 @@ set_default_terminal_application (const gchar* exec)
{
gboolean result;
GSettings* settings;
-
- settings = g_settings_new (TERM_SCHEMA);
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@desktop_gsetttings_path@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ TERM_SCHEMA,
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
result = g_settings_set_string (settings, TERM_EXEC_KEY, exec);
g_object_unref (settings);
return result;
diff --git a/sendto/caja-sendto-command.c b/sendto/caja-sendto-command.c
index 8181db6..579dc81 100644
--- a/sendto/caja-sendto-command.c
+++ b/sendto/caja-sendto-command.c
@@ -801,6 +801,8 @@ caja_sendto_init (void)
int main (int argc, char **argv)
{
GOptionContext *context;
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
GError *error = NULL;
#ifdef ENABLE_NLS
@@ -818,7 +820,15 @@ int main (int argc, char **argv)
return 1;
}
- settings = g_settings_new ("org.mate.Caja.Sendto");
+ schema_source = g_settings_schema_source_new_from_directory("@GSETTINGS_PATH@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ "org.mate.Caja.Sendto",
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
caja_sendto_init ();
if (caja_sendto_plugin_init () == FALSE) {
GtkWidget *error_dialog;
diff --git a/wallpaper/caja-wallpaper-extension.c b/wallpaper/caja-wallpaper-extension.c
index 3119e9f..4f80c88 100644
--- a/wallpaper/caja-wallpaper-extension.c
+++ b/wallpaper/caja-wallpaper-extension.c
@@ -47,6 +47,8 @@ set_wallpaper_callback (CajaMenuItem *item,
{
GList *files;
GSettings *settings;
+ GSettingsSchemaSource* schema_source;
+ GSettingsSchema* schema;
CajaFileInfo *file;
gchar *uri;
gchar *filename;
@@ -57,7 +59,15 @@ set_wallpaper_callback (CajaMenuItem *item,
uri = caja_file_info_get_uri (file);
filename = g_filename_from_uri(uri, NULL, NULL);
- settings = g_settings_new (WP_SCHEMA);
+ schema_source = g_settings_schema_source_new_from_directory("@desktop_gsetttings_path@",
+ g_settings_schema_source_get_default(),
+ TRUE, NULL);
+ schema = g_settings_schema_source_lookup(schema_source,
+ WP_SCHEMA,
+ FALSE);
+ settings = g_settings_new_full(schema, NULL, NULL);
+ g_settings_schema_source_unref(schema_source);
+ g_settings_schema_unref(schema);
g_settings_set_string (settings, WP_FILE_KEY, filename);