Skip to content

Commit 531a388

Browse files
committed
search: Disable content search for some special folders.
The gsettings skip list prevents recursion into these folders, and the hardcoded list prevents initiating a search within these locations. Ordinary search can still be performed from within these folders if desired. Fixes linuxmint/mint20.2-beta#30.
1 parent e169b8b commit 531a388

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

libnemo-private/org.nemo.gschema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@
834834
<summary>Stores the most recent state of the content search case toggle</summary>
835835
</key>
836836
<key name="search-skip-folders" type="as">
837-
<default>[]</default>
837+
<default>['/dev', '/proc', '/run', '/sys']</default>
838838
<summary>Paths or folder names to never recurse into when searching</summary>
839839
<description>List of locations that the search engine will never enter when looking for matches. These can be absolute or simply folder names (like .git). You can still enter those folders and search inside of them, however.</description>
840840
</key>

src/nemo-query-editor.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,20 @@ nemo_query_editor_set_active (NemoQueryEditor *editor,
725725
gtk_widget_show (editor->priv->infobar);
726726
gtk_widget_queue_resize (GTK_WIDGET (editor->priv->infobar));
727727

728+
const gchar *content_forbidden_dirs[] = {
729+
"file:///dev",
730+
"file:///proc",
731+
"file:///run",
732+
"file:///sys",
733+
NULL
734+
};
735+
728736
g_clear_pointer (&editor->priv->base_uri, g_free);
729737
editor->priv->base_uri = base_uri;
730738

731739
base = g_file_new_for_uri (base_uri);
732740

733-
if (g_file_is_native (base)) {
741+
if (g_file_is_native (base) && !g_strv_contains (content_forbidden_dirs, base_uri)) {
734742
gtk_widget_set_sensitive (editor->priv->content_main_box, TRUE);
735743
gtk_entry_set_placeholder_text (GTK_ENTRY (editor->priv->content_entry), "");
736744
} else {

0 commit comments

Comments
 (0)