3
0
Fork 0
forked from mirrors/nixpkgs

caja-extensions: patch gsettings calls to find the schemas

This commit is contained in:
Ilya Fedin 2022-04-01 07:49:18 +04:00
parent 7ca4bdd62e
commit 8b167e1817
2 changed files with 186 additions and 1 deletions

View file

@ -1,4 +1,5 @@
{ lib, stdenv, fetchurl, pkg-config, gettext, gtk3, gupnp, mate, imagemagick, wrapGAppsHook, mateUpdateScript }:
{ lib, stdenv, fetchurl, pkg-config, gettext, gtk3, gupnp, mate, imagemagick, wrapGAppsHook, mateUpdateScript
, glib, substituteAll }:
stdenv.mkDerivation rec {
pname = "caja-extensions";
@ -23,7 +24,22 @@ stdenv.mkDerivation rec {
imagemagick
];
patches = [
(substituteAll {
src = ./hardcode-gsettings.patch;
CAJA_GSETTINGS_PATH = glib.getSchemaPath mate.caja;
TERM_GSETTINGS_PATH = glib.getSchemaPath mate.mate-terminal;
})
];
postPatch = ''
substituteInPlace open-terminal/caja-open-terminal.c --subst-var-by \
GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
substituteInPlace sendto/caja-sendto-command.c --subst-var-by \
GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
substituteInPlace wallpaper/caja-wallpaper-extension.c --subst-var-by \
GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"}
for f in image-converter/caja-image-{resizer,rotator}.c; do
substituteInPlace $f --replace "/usr/bin/convert" "${imagemagick}/bin/convert"
done

View file

@ -0,0 +1,169 @@
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_GSETTINGS_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("@TERM_GSETTINGS_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("@TERM_GSETTINGS_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("@GSETTINGS_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);