[gthumb] Add rating-based filter



commit fd54d8f324ea0ba5f686eee2affce68517b09121
Author: Louis-Marie Mouton <lm mouton gmail com>
Date:   Sat Mar 16 12:42:46 2013 +0100

    Add rating-based filter

 gthumb/gth-main-default-tests.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gthumb/gth-main-default-tests.c b/gthumb/gth-main-default-tests.c
index b6755f6..a490c8a 100644
--- a/gthumb/gth-main-default-tests.c
+++ b/gthumb/gth-main-default-tests.c
@@ -224,6 +224,27 @@ get_embedded_description_for_test (GthTest        *test,
 }
 
 
+static gint64
+get_embedded_rating_for_test (GthTest        *test,
+                             GthFileData    *file,
+                             gconstpointer  *data,
+                             GDestroyNotify *data_destroy_func)
+{
+       GthMetadata *metadata;
+
+       metadata = (GthMetadata *) g_file_info_get_attribute_object (file->info, "general::rating");
+       if (metadata != NULL) {
+               int rating;
+
+               sscanf (gth_metadata_get_raw (metadata), "%d", &rating);
+               fprintf(stderr, "Rating: %d\n", rating);
+               return rating;
+       }
+
+       return 0;
+}
+
+
 void
 gth_main_register_default_tests (void)
 {
@@ -318,6 +339,13 @@ gth_main_register_default_tests (void)
                                  "get-data-func", get_embedded_description_for_test,
                                  NULL);
        gth_main_register_object (GTH_TYPE_TEST,
+                                 "general::rating", GTH_TYPE_TEST_SIMPLE,
+                                 "attributes", "general::rating",
+                                 "display-name", _("Rating"),
+                                 "data-type", GTH_TEST_DATA_TYPE_INT,
+                                 "get-data-func", get_embedded_rating_for_test,
+                                 NULL);
+       gth_main_register_object (GTH_TYPE_TEST,
                                  "general::tags",
                                  GTH_TYPE_TEST_CATEGORY,
                                  "attributes", "general::tags",


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