aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-12-14 06:52:23 +0800
committerChristian Persch <chpe@src.gnome.org>2003-12-14 06:52:23 +0800
commit1616c205631056fa19b85aec166ea9019881f425 (patch)
treedcbec7af01f76d57544d647ae5f2903717cfb51d /src/bookmarks
parentc7fa7407b02c593b79492a2c57369af10032ec0d (diff)
downloadgsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.tar
gsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.tar.gz
gsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.tar.bz2
gsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.tar.lz
gsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.tar.xz
gsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.tar.zst
gsoc2013-epiphany-1616c205631056fa19b85aec166ea9019881f425.zip
Better way of mapping hierarchy to topics when importing bookmarks from
2003-12-13 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-bookmarks-import.c: (ephy_bookmarks_import_mozilla): Better way of mapping hierarchy to topics when importing bookmarks from mozilla. Fixes bug #124145.
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
index c58479922..53849cc1c 100644
--- a/src/bookmarks/ephy-bookmarks-import.c
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -568,7 +568,7 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
GString *name = g_string_new (NULL);
gchar *parsedname;
GString *url = g_string_new (NULL);
- char *current_folder = NULL;
+ GList *folders = NULL, *l;
if (!(bf = fopen (filename, "r"))) {
g_warning ("Failed to open file: %s\n", filename);
@@ -576,19 +576,49 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
}
while (!feof (bf)) {
+ EphyNode *node;
NSItemType t;
t = ns_get_bookmark_item (bf, name, url);
switch (t)
{
case NS_FOLDER:
- g_free (current_folder);
- current_folder = g_strdup (name->str);
+ folders = g_list_prepend (folders, g_strdup (name->str));
+ break;
+ case NS_FOLDER_END:
+ if (folders)
+ {
+ /* remove first entry */
+ g_free (folders->data);
+ folders = g_list_delete_link (folders, folders);
+ }
break;
case NS_SITE:
parsedname = ns_parse_bookmark_item (name);
- bookmark_add (bookmarks, parsedname,
- url->str, current_folder);
+ node = bookmark_add (bookmarks, parsedname, url->str, NULL);
+
+ if (node == NULL)
+ {
+ node = ephy_bookmarks_find_bookmark (bookmarks, url->str);
+ }
+
+ for (l = folders; l != NULL; l = l->next)
+ {
+ char *topic = (char *) l->data;
+ EphyNode *keyword;
+
+ keyword = ephy_bookmarks_find_keyword (bookmarks, topic, FALSE);
+
+ if (keyword == NULL)
+ {
+ keyword = ephy_bookmarks_add_keyword (bookmarks, topic);
+ }
+
+ if (node != NULL && keyword != NULL)
+ {
+ ephy_bookmarks_set_keyword (bookmarks, keyword, node);
+ }
+ }
break;
default:
break;