Skip to content

Commit d7e5b97

Browse files
committed
Search: Allow disabling of search helpers via gsettings.
1 parent f352205 commit d7e5b97

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

libnemo-private/nemo-global-preferences.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ typedef enum
262262
#define NEMO_PLUGIN_PREFERENCES_DISABLED_EXTENSIONS "disabled-extensions"
263263
#define NEMO_PLUGIN_PREFERENCES_DISABLED_ACTIONS "disabled-actions"
264264
#define NEMO_PLUGIN_PREFERENCES_DISABLED_SCRIPTS "disabled-scripts"
265+
#define NEMO_PLUGIN_PREFERENCES_DISABLED_SEARCH_HELPERS "disabled-search-helpers"
265266

266267
/* Connect-to server dialog last-used method */
267268
#define NEMO_PREFERENCES_LAST_SERVER_CONNECT_METHOD "last-server-connect-method"

libnemo-private/nemo-search-engine-advanced.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@
4444
#define SNIPPET_EXTEND_SIZE 100
4545

4646
typedef struct {
47+
gchar *filename;
4748
gchar *def_path;
4849
gchar *exec_format;
49-
50-
gint priority;
5150
/* future? */
5251
} SearchHelper;
5352

@@ -258,6 +257,7 @@ initialize_search_helpers (NemoSearchEngineAdvanced *engine)
258257
GDir *dir;
259258
const gchar *filename;
260259
const gchar *path;
260+
gchar **disabled_helpers;
261261

262262
path = (const gchar *) d_iter->data;
263263
DEBUG ("Checking location '%s' for search helpers", path);
@@ -271,19 +271,28 @@ initialize_search_helpers (NemoSearchEngineAdvanced *engine)
271271
continue;
272272
}
273273

274+
disabled_helpers = g_settings_get_strv (nemo_search_preferences,
275+
NEMO_PLUGIN_PREFERENCES_DISABLED_SEARCH_HELPERS);
276+
274277
while ((filename = g_dir_read_name (dir)) != NULL) {
275278
gchar *file_path;
276279

277280
if (!g_str_has_suffix (filename, ".nemo_search_helper")) {
278281
continue;
279282
}
280283

284+
if (g_strv_contains ((const gchar* const*) disabled_helpers, filename)) {
285+
DEBUG ("Skipping disabled search helper: '%s'", filename);
286+
continue;
287+
}
288+
281289
file_path = g_build_filename (path, filename, NULL);
282290
process_search_helper_file (file_path);
283291
g_free (file_path);
284292
}
285293

286294
g_dir_close (dir);
295+
g_strfreev (disabled_helpers);
287296
}
288297

289298
g_list_free_full (dir_list, g_free);

libnemo-private/org.nemo.gschema.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,5 +885,9 @@
885885
<default>false</default>
886886
<summary>Reverse the direction of the sort when viewing search results</summary>
887887
</key>
888+
<key name="disabled-search-helpers" type="as">
889+
<default>[]</default>
890+
<summary>List of search helper filenames to skip when using content search.</summary>
891+
</key>
888892
</schema>
889893
</schemalist>

0 commit comments

Comments
 (0)