KatzeArray* array,
gchar* folder);
+void
+midori_bookmarks_export_array_db (sqlite3* db,
+ KatzeArray* array,
+ const gchar* folder);
+
void
midori_bookmarks_insert_item_db (sqlite3* db,
KatzeItem* item,
GtkWidget* file_dialog;
gchar* path = NULL;
GError* error;
+ sqlite3* db;
if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
return;
return;
error = NULL;
+ db = g_object_get_data (G_OBJECT (browser->history), "db");
+ midori_bookmarks_export_array_db (db, browser->bookmarks, "");
if (!midori_array_to_file (browser->bookmarks, path, "xbel", &error))
{
sokoke_message_dialog (GTK_MESSAGE_ERROR,
return STOCK_BOOKMARKS;
}
+void
+midori_bookmarks_export_array_db (sqlite3* db,
+ KatzeArray* array,
+ const gchar* folder)
+{
+ gchar* sqlcmd;
+ KatzeArray* root_array;
+ KatzeArray* subarray;
+ KatzeItem* item;
+ int i = 0;
+
+ sqlcmd = g_strdup_printf ("SELECT * FROM bookmarks where folder='%s'", folder);
+ root_array = katze_array_from_sqlite (db, sqlcmd);
+ g_free (sqlcmd);
+
+ while ((item = katze_array_get_nth_item (KATZE_ARRAY (root_array), i++)))
+ {
+ if (KATZE_ITEM_IS_FOLDER (item))
+ {
+ subarray = katze_array_new (KATZE_TYPE_ARRAY);
+ katze_item_set_name (KATZE_ITEM (subarray), katze_item_get_name (item));
+ midori_bookmarks_export_array_db (db, subarray, katze_item_get_name (item));
+ katze_array_add_item (array, subarray);
+ }
+ else
+ katze_array_add_item (array, item);
+ }
+}
+
void
midori_bookmarks_import_array_db (sqlite3* db,
KatzeArray* array,