Merge pull request #206475 from bobby285271/cinnamon-nemo-fix

cinnamon.nemo: Workaround duplicate right-click menu items
This commit is contained in:
Bobby Rong 2022-12-19 09:37:32 +08:00 committed by GitHub
commit 7dabcc94ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 0 deletions

View file

@ -34,6 +34,13 @@ stdenv.mkDerivation rec {
sha256 = "sha256-ztx3Y+n9Bpzuz06mbkis3kdlM/0JrOaMDbRF5glzkDE=";
};
patches = [
# Don't populate nemo actions from /run/current-system/sw/share
# They should only be loaded exactly once from $out/share
# https://github.com/NixOS/nixpkgs/issues/190781
./fix-nemo-actions-duplicate-menu-items.patch
];
outputs = [ "out" "dev" ];
buildInputs = [

View file

@ -0,0 +1,48 @@
diff --git a/libnemo-private/nemo-action-manager.c b/libnemo-private/nemo-action-manager.c
index 4dac198..b671421 100644
--- a/libnemo-private/nemo-action-manager.c
+++ b/libnemo-private/nemo-action-manager.c
@@ -146,6 +146,8 @@ set_up_actions_directories (NemoActionManager *action_manager)
data_dirs = (gchar **) g_get_system_data_dirs ();
for (i = 0; i < g_strv_length (data_dirs); i++) {
+ if (g_strcmp0 (data_dirs[i], "/run/current-system/sw/share") == 0)
+ continue;
path = g_build_filename (data_dirs[i], "nemo", "actions", NULL);
uri = g_filename_to_uri (path, NULL, NULL);
diff --git a/src/nemo-action-config-widget.c b/src/nemo-action-config-widget.c
index fc4075e..6e1c837 100644
--- a/src/nemo-action-config-widget.c
+++ b/src/nemo-action-config-widget.c
@@ -221,6 +221,8 @@ refresh_widget (NemoActionConfigWidget *widget)
data_dirs = (gchar **) g_get_system_data_dirs ();
for (i = 0; i < g_strv_length (data_dirs); i++) {
+ if (g_strcmp0 (data_dirs[i], "/run/current-system/sw/share") == 0)
+ continue;
path = g_build_filename (data_dirs[i], "nemo", "actions", NULL);
populate_from_directory (widget, path);
g_clear_pointer (&path, g_free);
@@ -390,6 +392,8 @@ static void setup_dir_monitors (NemoActionConfigWidget *widget)
guint i;
for (i = 0; i < g_strv_length (data_dirs); i++) {
+ if (g_strcmp0 (data_dirs[i], "/run/current-system/sw/share") == 0)
+ continue;
gchar *path = g_build_filename (data_dirs[i], "nemo", "actions", NULL);
try_monitor_path (widget, path);
g_free (path);
diff --git a/src/nemo-script-config-widget.c b/src/nemo-script-config-widget.c
index 3a2d349..b8a85b4 100644
--- a/src/nemo-script-config-widget.c
+++ b/src/nemo-script-config-widget.c
@@ -288,6 +288,8 @@ static void setup_dir_monitors (NemoScriptConfigWidget *widget)
guint i;
for (i = 0; i < g_strv_length (data_dirs); i++) {
+ if (g_strcmp0 (data_dirs[i], "/run/current-system/sw/share") == 0)
+ continue;
gchar *path = g_build_filename (data_dirs[i], "nemo", "actions", NULL);
try_monitor_path (widget, path);
g_free (path);