gcr: Fix problem looking up the renderers
authorStef Walter <stefw@collabora.co.uk>
Wed, 30 Nov 2011 10:56:37 +0000 (11:56 +0100)
committerStef Walter <stefw@collabora.co.uk>
Wed, 30 Nov 2011 10:56:37 +0000 (11:56 +0100)
 * Fix format being copied in gcr_parsed_ref()
 * Add debug output to the lookup for importers

gcr/gcr-importer.c
gcr/gcr-parser.c

index cb57285..0eaa816 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "config.h"
 
+#define DEBUG_FLAG GCR_DEBUG_IMPORT
+#include "gcr-debug.h"
 #include "gcr-deprecated-base.h"
 #include "gcr-importer.h"
 #include "gcr-internal.h"
@@ -220,6 +222,12 @@ gcr_importer_create_for_parsed (GcrParsed *parsed)
 
        seen = g_hash_table_new (g_direct_hash, g_direct_equal);
 
+       if (_gcr_debugging) {
+               gchar *a = gck_attributes_to_string (attrs);
+               _gcr_debug ("looking for importer for: %s", a);
+               g_free (a);
+       }
+
        for (i = 0; i < registered_importers->len; ++i) {
                registered = &(g_array_index (registered_importers, GcrRegistered, i));
                n_attrs = gck_attributes_count (registered->attrs);
@@ -233,6 +241,12 @@ gcr_importer_create_for_parsed (GcrParsed *parsed)
                        }
                }
 
+               if (_gcr_debugging) {
+                       gchar *a = gck_attributes_to_string (registered->attrs);
+                       _gcr_debug ("importer %s: %s", matched ? "matched" : "didn't match", a);
+                       g_free (a);
+               }
+
                if (matched) {
                        if (check_if_seen_or_add (seen, GUINT_TO_POINTER (registered->importer_type)))
                                continue;
index 006e2ad..fdb73d4 100644 (file)
@@ -2639,6 +2639,7 @@ gcr_parsed_ref (GcrParsed *parsed)
        copy->refs = 1;
        copy->label = g_strdup (gcr_parsed_get_label (parsed));
        copy->attrs = gcr_parsed_get_attributes (parsed);
+       copy->format = gcr_parsed_get_format (parsed);
        if (copy->attrs)
                gck_attributes_ref (copy->attrs);
        copy->description = gcr_parsed_get_description (parsed);
@@ -2648,6 +2649,7 @@ gcr_parsed_ref (GcrParsed *parsed)
        while (parsed != NULL) {
                if (parsed->data != NULL) {
                        copy->data = egg_bytes_ref (parsed->data);
+                       copy->sensitive = parsed->sensitive;
                        break;
                }
                parsed = parsed->next;