[gthumb] allow to search and filter for the embedded metadata as well



commit 96ed1ec13e995c1feab3d5a517558f2e30868627
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Jul 14 21:12:42 2010 +0200

    allow to search and filter for the embedded metadata as well
    
    searching or filtering for the embedded metadata is slow but sometimes is exactly what the user wants to do.

 extensions/comments/Makefile.am                    |    2 --
 extensions/comments/main.c                         |    3 ++-
 gthumb/Makefile.am                                 |    2 ++
 gthumb/gth-main-default-tests.c                    |   19 +++++++++++++++++++
 .../comments => gthumb}/gth-test-category.c        |   11 +++++++++--
 .../comments => gthumb}/gth-test-category.h        |    1 -
 gthumb/gth-test.c                                  |    1 +
 7 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/extensions/comments/Makefile.am b/extensions/comments/Makefile.am
index f1f4132..ddfb304 100644
--- a/extensions/comments/Makefile.am
+++ b/extensions/comments/Makefile.am
@@ -10,8 +10,6 @@ libcomments_la_SOURCES = 			\
 	gth-comment.h				\
 	gth-metadata-provider-comment.c		\
 	gth-metadata-provider-comment.h		\
-	gth-test-category.c			\
-	gth-test-category.h			\
 	main.c					\
 	preferences.h
 
diff --git a/extensions/comments/main.c b/extensions/comments/main.c
index 8bb3f71..cc5e058 100644
--- a/extensions/comments/main.c
+++ b/extensions/comments/main.c
@@ -27,7 +27,6 @@
 #include "dlg-comments-preferences.h"
 #include "gth-comment.h"
 #include "gth-metadata-provider-comment.h"
-#include "gth-test-category.h"
 #include "preferences.h"
 
 
@@ -221,8 +220,10 @@ gthumb_extension_activate (void)
 	gth_main_register_object (GTH_TYPE_TEST,
 				  "comment::category",
 				  GTH_TYPE_TEST_CATEGORY,
+				  "attributes", "comment::categories",
 				  "display-name", _("Tag"),
 				  NULL);
+
 	gth_hook_add_callback ("add-sidecars", 10, G_CALLBACK (comments__add_sidecars_cb), NULL);
 	gth_hook_add_callback ("read-metadata-ready", 10, G_CALLBACK (comments__read_metadata_ready_cb), NULL);
 }
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 5d9c3c1..67c0b30 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -96,6 +96,7 @@ PUBLIC_HEADER_FILES = 					\
 	gth-tags-file.h					\
 	gth-task.h					\
 	gth-test.h					\
+	gth-test-category.h				\
 	gth-test-chain.h				\
 	gth-test-selector.h				\
 	gth-test-simple.h				\
@@ -213,6 +214,7 @@ gthumb_SOURCES = 					\
 	gth-tags-file.c					\
 	gth-task.c					\
 	gth-test.c					\
+	gth-test-category.c				\
 	gth-test-chain.c				\
 	gth-test-selector.c				\
 	gth-test-simple.c				\
diff --git a/gthumb/gth-main-default-tests.c b/gthumb/gth-main-default-tests.c
index 3104ef9..f1cc4a1 100644
--- a/gthumb/gth-main-default-tests.c
+++ b/gthumb/gth-main-default-tests.c
@@ -25,6 +25,7 @@
 #include <glib/gi18n.h>
 #include "glib-utils.h"
 #include "gth-main.h"
+#include "gth-test-category.h"
 #include "gth-test-simple.h"
 #include "gth-time.h"
 
@@ -265,4 +266,22 @@ gth_main_register_default_tests (void)
 				  "data-type", GTH_TEST_DATA_TYPE_DATE,
 				  "get-data-func", get_original_date_for_test,
 				  NULL);
+	gth_main_register_object (GTH_TYPE_TEST,
+				  "general::title",
+				  GTH_TYPE_TEST_CATEGORY,
+				  "attributes", "general::title",
+				  "display-name", _("Title (embedded)"),
+				  NULL);
+	gth_main_register_object (GTH_TYPE_TEST,
+				  "general::description",
+				  GTH_TYPE_TEST_CATEGORY,
+				  "attributes", "general::description",
+				  "display-name", _("Description (embedded)"),
+				  NULL);
+	gth_main_register_object (GTH_TYPE_TEST,
+				  "general::tags",
+				  GTH_TYPE_TEST_CATEGORY,
+				  "attributes", "general::tags",
+				  "display-name", _("Tag (embedded)"),
+				  NULL);
 }
diff --git a/extensions/comments/gth-test-category.c b/gthumb/gth-test-category.c
similarity index 97%
rename from extensions/comments/gth-test-category.c
rename to gthumb/gth-test-category.c
index 05eaebc..195f8a1 100644
--- a/extensions/comments/gth-test-category.c
+++ b/gthumb/gth-test-category.c
@@ -26,6 +26,13 @@
 #include <glib/gi18n.h>
 #include <glib.h>
 #include <gtk/gtk.h>
+#include "dom.h"
+#include "glib-utils.h"
+#include "gth-duplicable.h"
+#include "gth-enum-types.h"
+#include "gth-main.h"
+#include "gth-monitor.h"
+#include "gth-test.h"
 #include "gth-test-category.h"
 
 
@@ -244,7 +251,7 @@ gth_test_category_real_match (GthTest     *test,
 		GList         *list, *scan;
 		char          *test_category_casefolded;
 
-		string_list = (GthStringList *) g_file_info_get_attribute_object (file->info, "comment::categories");
+		string_list = (GthStringList *) g_file_info_get_attribute_object (file->info, gth_test_get_attributes (GTH_TEST (test_category)));
 		if (string_list != NULL)
 			list = gth_string_list_get_list (string_list);
 		else
@@ -368,6 +375,7 @@ gth_test_category_real_duplicate (GthDuplicable *duplicable)
 
 	new_test = g_object_new (GTH_TYPE_TEST_CATEGORY,
 				 "id", gth_test_get_id (GTH_TEST (test)),
+				 "attributes", gth_test_get_attributes (GTH_TEST (test)),
 				 "display-name", gth_test_get_display_name (GTH_TEST (test)),
 				 "visible", gth_test_is_visible (GTH_TEST (test)),
 				 NULL);
@@ -417,7 +425,6 @@ static void
 gth_test_category_init (GthTestCategory *test)
 {
 	test->priv = g_new0 (GthTestCategoryPrivate, 1);
-	g_object_set (test, "attributes", "comment::categories", NULL);
 	test->priv->monitor_events = 0;
 }
 
diff --git a/extensions/comments/gth-test-category.h b/gthumb/gth-test-category.h
similarity index 99%
rename from extensions/comments/gth-test-category.h
rename to gthumb/gth-test-category.h
index c93cb81..1c6a22c 100644
--- a/extensions/comments/gth-test-category.h
+++ b/gthumb/gth-test-category.h
@@ -25,7 +25,6 @@
 
 #include <glib-object.h>
 #include <gtk/gtk.h>
-#include <gthumb.h>
 
 #define GTH_TYPE_TEST_CATEGORY         (gth_test_category_get_type ())
 #define GTH_TEST_CATEGORY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GTH_TYPE_TEST_CATEGORY, GthTestCategory))
diff --git a/gthumb/gth-test.c b/gthumb/gth-test.c
index 9a1c04b..423b348 100644
--- a/gthumb/gth-test.c
+++ b/gthumb/gth-test.c
@@ -331,6 +331,7 @@ gth_test_init (GthTest *self)
 {
 	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_TEST, GthTestPrivate);
 	self->priv->id = g_strdup ("");
+	self->priv->attributes = g_strdup ("");
 	self->priv->display_name = g_strdup ("");
 	self->priv->visible = FALSE;
 }



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