Use KATZE_ARRAY_FOREACH_ITEM_L for export

This commit is contained in:
Paweł Forysiuk 2011-01-22 21:17:08 +01:00 committed by Christian Dywan
parent 59e924fb9a
commit 2e8d6558d0
2 changed files with 9 additions and 3 deletions

View file

@ -580,15 +580,17 @@ string_append_item (GString* string,
{
KatzeItem* _item;
KatzeArray* array = KATZE_ARRAY (item);
GList* list;
g_string_append (string, "<folder>\n");
/* FIXME: " folded=\"no\" */
string_append_xml_element (string, "title", katze_item_get_name (item));
string_append_xml_element (string, "desc", katze_item_get_text (item));
KATZE_ARRAY_FOREACH_ITEM (_item, array)
KATZE_ARRAY_FOREACH_ITEM_L (_item, array, list)
string_append_item (string, _item);
g_string_append (string, metadata);
g_string_append (string, "</folder>\n");
g_list_free (list);
}
else if (katze_item_get_uri (item))
{
@ -668,6 +670,7 @@ katze_array_to_xbel (KatzeArray* array,
{
gchar* metadata = katze_item_metadata_to_xbel (KATZE_ITEM (array));
KatzeItem* item;
GList* list;
GString* markup = g_string_new (
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
@ -680,11 +683,12 @@ katze_array_to_xbel (KatzeArray* array,
string_append_xml_element (markup, "title", katze_item_get_name (KATZE_ITEM (array)));
string_append_xml_element (markup, "desc", katze_item_get_text (KATZE_ITEM (array)));
g_string_append (markup, metadata);
KATZE_ARRAY_FOREACH_ITEM (item, array)
KATZE_ARRAY_FOREACH_ITEM_L (item, array, list)
string_append_item (markup, item);
g_string_append (markup, "</xbel>\n");
g_free (metadata);
g_list_free (list);
return g_string_free (markup, FALSE);
}

View file

@ -131,12 +131,13 @@ midori_bookmarks_export_array_db (sqlite3* db,
KatzeArray* root_array;
KatzeArray* subarray;
KatzeItem* item;
GList* list;
sqlcmd = g_strdup_printf ("SELECT * FROM bookmarks where folder='%s'", folder);
root_array = katze_array_from_sqlite (db, sqlcmd);
g_free (sqlcmd);
KATZE_ARRAY_FOREACH_ITEM (item, root_array)
KATZE_ARRAY_FOREACH_ITEM_L (item, root_array, list)
{
if (KATZE_ITEM_IS_FOLDER (item))
{
@ -148,6 +149,7 @@ midori_bookmarks_export_array_db (sqlite3* db,
else
katze_array_add_item (array, item);
}
g_list_free (list);
}
void