[gthumb/ext] renamed the _g_file_attributes_matches_* functions



commit 422d05cd1621170a0da71ebfb373f3063ebd0de7
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jan 1 17:38:52 2010 +0100

    renamed the _g_file_attributes_matches_* functions
    
    renamed to make it clear what the functions do.

 extensions/catalogs/gth-file-source-catalogs.c |    4 +-
 gthumb/gio-utils.c                             |    2 +-
 gthumb/glib-utils.c                            |   26 ++++++++++++++++++++---
 gthumb/glib-utils.h                            |    6 +++-
 gthumb/gth-main.c                              |    2 +-
 5 files changed, 30 insertions(+), 10 deletions(-)
---
diff --git a/extensions/catalogs/gth-file-source-catalogs.c b/extensions/catalogs/gth-file-source-catalogs.c
index 8f1a5cb..cde6f85 100644
--- a/extensions/catalogs/gth-file-source-catalogs.c
+++ b/extensions/catalogs/gth-file-source-catalogs.c
@@ -240,7 +240,7 @@ write_metadata_load_buffer_ready_cb (void     *buffer,
 		return;
 	}
 
-	if (_g_file_attributes_matches (metadata_op->attributes, "sort::*"))
+	if (_g_file_attributes_matches_any (metadata_op->attributes, "sort::*"))
 		gth_catalog_set_order (metadata_op->catalog,
 				       g_file_info_get_attribute_string (metadata_op->file_data->info, "sort::type"),
 				       g_file_info_get_attribute_boolean (metadata_op->file_data->info, "sort::inverse"));
@@ -367,7 +367,7 @@ read_metadata_info_ready_cb (GList    *files,
 
 	update_file_info (read_metadata->file_source, read_metadata->file_data->file, read_metadata->file_data->info);
 
-	if (_g_file_attributes_matches (read_metadata->attributes, "sort::*")) {
+	if (_g_file_attributes_matches_any (read_metadata->attributes, "sort::*")) {
 		GFile *gio_file;
 
 		gio_file = gth_catalog_file_to_gio_file (read_metadata->file_data->file);
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index a947523..af6a386 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -582,7 +582,7 @@ g_directory_foreach_child (GFile                *directory,
 						      g_str_equal,
 						      g_free,
 						      NULL);
-	fec->metadata_attributes = ! _g_file_attributes_matches_mask (fec->attributes, GIO_ATTRIBUTES);
+	fec->metadata_attributes = ! _g_file_attributes_matches_any (fec->attributes, GIO_ATTRIBUTES);
 
 	g_file_query_info_async (fec->base_directory,
 				 fec->attributes,
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index 216a78c..88260c8 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -2147,8 +2147,8 @@ attribute_matches_mask (const char *attribute,
 
 
 gboolean
-_g_file_attributes_matches_mask (const char *attributes,
-			         const char *mask)
+_g_file_attributes_matches_all (const char *attributes,
+			        const char *mask)
 {
 	gboolean   matches_all_mask = TRUE;
 	char     **attributes_v;
@@ -2208,13 +2208,31 @@ _attributes_matches_mask (const char *attributes,
 
 
 gboolean
-_g_file_attributes_matches (const char *attributes,
-			    const char *mask)
+_g_file_attributes_matches_any (const char *attributes,
+			        const char *mask)
 {
 	return _attributes_matches_mask (attributes, mask) || _attributes_matches_mask (mask, attributes);
 }
 
 
+gboolean
+_g_file_attributes_matches_any_v (const char *attributes,
+				  char      **attribute_v)
+{
+	gboolean matches;
+	int      i;
+
+	if (attributes == NULL)
+		return FALSE;
+
+	matches = FALSE;
+	for (i = 0; ! matches && (attribute_v[i] != NULL); i++)
+		matches = _g_file_attributes_matches_any (attributes, attribute_v[i]);
+
+	return matches;
+}
+
+
 /* -- _g_file_info_swap_attributes -- */
 
 
diff --git a/gthumb/glib-utils.h b/gthumb/glib-utils.h
index 330f46c..a679856 100644
--- a/gthumb/glib-utils.h
+++ b/gthumb/glib-utils.h
@@ -253,10 +253,12 @@ GFile *         _g_file_append_prefix            (GFile      *file,
 						  const char *prefix);
 GFile *         _g_file_append_path              (GFile      *file,
 						  const char *path);
-gboolean        _g_file_attributes_matches_mask  (const char *attributes,
+gboolean        _g_file_attributes_matches_all   (const char *attributes,
 						  const char *mask);
-gboolean        _g_file_attributes_matches       (const char *attributes,
+gboolean        _g_file_attributes_matches_any   (const char *attributes,
 						  const char *mask);
+gboolean        _g_file_attributes_matches_any_v (const char *attributes,
+						  char      **attribute_v);
 void            _g_file_info_swap_attributes     (GFileInfo  *info,
 						  const char *attr1,
 						  const char *attr2);
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 388903a..ec659b6 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -1275,7 +1275,7 @@ attribute_list_reaload_required (const char *old_attributes,
 	new_attributes_len = g_strv_length (new_attributes_v);
 
 	for (i = 0; i < new_attributes_len; i++) {
-		if (_g_file_attributes_matches (new_attributes_v[i], GIO_ATTRIBUTES)) {
+		if (_g_file_attributes_matches_any (new_attributes_v[i], GIO_ATTRIBUTES)) {
 			g_free (new_attributes_v[i]);
 			new_attributes_v[i] = NULL;
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]