[gedit/gnome-3-10] filebrowser: Fix filename matching
- From: Volker Sobek <vsobek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/gnome-3-10] filebrowser: Fix filename matching
- Date: Sat, 16 Nov 2013 11:53:22 +0000 (UTC)
commit 03c6ddf56b1656f7e7e5c49a6edb9bd22aa6fadf
Author: Volker Sobek <reklov live com>
Date: Fri Nov 15 00:05:14 2013 +0100
filebrowser: Fix filename matching
Ensure filename matching in the filebrowser always works. It wasn't
working when the option to show binary files was disabled.
Also, don't filter out directories that match binary-patterns.
https://bugzilla.gnome.org/show_bug.cgi?id=712313
plugins/filebrowser/gedit-file-browser-store.c | 54 +++++++++++++----------
1 files changed, 30 insertions(+), 24 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-store.c b/plugins/filebrowser/gedit-file-browser-store.c
index fa7f094..e45f59b 100644
--- a/plugins/filebrowser/gedit-file-browser-store.c
+++ b/plugins/filebrowser/gedit-file-browser-store.c
@@ -1052,39 +1052,45 @@ model_node_update_visibility (GeditFileBrowserStore *model,
NODE_IS_HIDDEN (node))
{
node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED;
+ return;
}
- else if (FILTER_BINARY (model->priv->filter_mode) &&
- (!NODE_IS_TEXT (node) && !NODE_IS_DIR (node)))
- {
- node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED;
- }
- else if (FILTER_BINARY (model->priv->filter_mode) &&
- model->priv->binary_patterns != NULL)
- {
- gint i;
- gssize name_length;
- gchar *name_reversed;
-
- name_length = strlen (node->name);
- name_reversed = g_utf8_strreverse (node->name, name_length);
- for (i = 0; i < model->priv->binary_pattern_specs->len; ++i)
+ if (FILTER_BINARY (model->priv->filter_mode) && !NODE_IS_DIR (node))
+ {
+ if (!NODE_IS_TEXT (node))
{
- GPatternSpec *spec;
+ node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED;
+ return;
+ }
+ else if (model->priv->binary_patterns != NULL)
+ {
+ gint i;
+ gssize name_length;
+ gchar *name_reversed;
- spec = g_ptr_array_index (model->priv->binary_pattern_specs, i);
+ name_length = strlen (node->name);
+ name_reversed = g_utf8_strreverse (node->name, name_length);
- if (g_pattern_match (spec, name_length,
- node->name, name_reversed))
+ for (i = 0; i < model->priv->binary_pattern_specs->len; ++i)
{
- node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED;
- break;
+ GPatternSpec *spec;
+
+ spec = g_ptr_array_index (model->priv->binary_pattern_specs, i);
+
+ if (g_pattern_match (spec, name_length,
+ node->name, name_reversed))
+ {
+ node->flags |= GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED;
+ g_free (name_reversed);
+ return;
+ }
}
- }
- g_free (name_reversed);
+ g_free (name_reversed);
+ }
}
- else if (model->priv->filter_func)
+
+ if (model->priv->filter_func)
{
iter.user_data = node;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]