nixpkgs-suyu/pkgs/desktops/cinnamon/nemo/fix-nemo-actions-duplicate-menu-items.patch
Bobby Rong 5cc5f394d7
cinnamon.nemo: Workaround duplicate right-click menu items
Don't populate nemo actions from /run/current-system/sw/share
They should only be loaded exactly once as $out/share
2022-12-17 11:41:17 +08:00

48 lines
2.2 KiB
Diff

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);