From: Christian Dywan Date: Sat, 4 Jul 2009 23:14:39 +0000 (+0100) Subject: Store meta data in XBEL when saving KatzeArray objects X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab6ecc1625057189582a9354272f7cc71afb032b;p=midori Store meta data in XBEL when saving KatzeArray objects --- diff --git a/midori/midori-array.c b/midori/midori-array.c index af53f003..37a78873 100644 --- a/midori/midori-array.c +++ b/midori/midori-array.c @@ -283,6 +283,30 @@ katze_item_to_data (KatzeItem* item) return markup; } +static gchar* +katze_item_metadata_to_xbel (KatzeItem* item) +{ + GList* keys = katze_item_get_meta_keys (item); + GString* markup; + /* FIXME: Allow specifying an alternative namespace/ URI */ + const gchar* namespace_uri = "http://www.twotoasts.de"; + const gchar* namespace = "midori"; + gsize i; + const gchar* key; + + if (!keys) + return g_strdup (""); + + markup = g_string_new ("\n\n\n"); + return g_string_free (markup, FALSE); +} + static gchar* katze_array_to_xbel (KatzeArray* array, GError** error) @@ -291,8 +315,10 @@ katze_array_to_xbel (KatzeArray* array, guint i; KatzeItem* item; gchar* item_xml; + const gchar* namespacing; gchar* title; gchar* desc; + gchar* metadata; gchar* outer_markup; inner_markup = g_string_new (NULL); @@ -304,20 +330,25 @@ katze_array_to_xbel (KatzeArray* array, g_free (item_xml); } + namespacing = " xmlns:midori=\"http://www.twotoasts.de\""; title = _simple_xml_element ("title", katze_item_get_name (KATZE_ITEM (array))); desc = _simple_xml_element ("desc", katze_item_get_text (KATZE_ITEM (array))); + metadata = katze_item_metadata_to_xbel (KATZE_ITEM (array)); outer_markup = g_strdup_printf ( - "%s%s\n%s%s%s\n", + "%s%s\n%s%s%s%s\n", "\n", "\n", + namespacing, title, desc, + metadata, inner_markup->str); g_string_free (inner_markup, TRUE); g_free (title); g_free (desc); + g_free (metadata); return outer_markup; }