file-roller r2189 - in trunk: . src
- From: paobac svn gnome org
- To: svn-commits-list gnome org
- Subject: file-roller r2189 - in trunk: . src
- Date: Sun, 23 Mar 2008 18:31:23 +0000 (GMT)
Author: paobac
Date: Sun Mar 23 18:31:22 2008
New Revision: 2189
URL: http://svn.gnome.org/viewvc/file-roller?rev=2189&view=rev
Log:
2008-03-23 Paolo Bacchilega <paobac svn gnome org>
* src/file-list.c (filter_apply): return TRUE if there is no pattern,
or at least one pattern is matched.
Modified:
trunk/ChangeLog
trunk/src/file-list.c
Modified: trunk/src/file-list.c
==============================================================================
--- trunk/src/file-list.c (original)
+++ trunk/src/file-list.c Sun Mar 23 18:31:22 2008
@@ -103,12 +103,35 @@
static gboolean
+match_regexps (GRegex **regexps,
+ const char *string)
+{
+ gboolean matched;
+ int i;
+
+ if ((regexps == NULL) || (regexps[0] == NULL))
+ return TRUE;
+
+ if (string == NULL)
+ return FALSE;
+
+ matched = FALSE;
+ for (i = 0; regexps[i] != NULL; i++)
+ if (g_regex_match (regexps[i], string, 0, NULL)) {
+ matched = TRUE;
+ break;
+ }
+
+ return matched
+}
+
+
+static gboolean
filter_apply (Filter *filter,
const char *name)
{
const char *file_name;
char *utf8_name;
- int i;
gboolean matched;
g_return_val_if_fail (filter != NULL, FALSE);
@@ -123,18 +146,9 @@
if ((filter->options & FILTER_NOBACKUPFILES)
&& (file_name[strlen (file_name) - 1] == '~'))
return FALSE;
-
- matched = TRUE;
+
utf8_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL);
- for (i = 0; filter->regexps[i] != NULL; i++)
- if (! g_regex_match (filter->regexps[i],
- utf8_name,
- 0,
- NULL))
- {
- matched = FALSE;
- break;
- }
+ matched = match_regexps (filter->regexps, utf8_name);
g_free (utf8_name);
return matched;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]