From 5a4dc61b3d5599842daef9004cb4a61c28c4dffa Mon Sep 17 00:00:00 2001 From: James Willcox Date: Thu, 6 Feb 2003 01:55:50 +0000 Subject: Added the ability to import galeon and konqueror bookmarks. 2003-02-05 James Willcox * data/starthere/section.xsl: * embed/mozilla/StartHereProtocolHandler.cpp: * lib/ephy-start-here.c: (galeon_bookmarks), (attach_content): * src/bookmarks/ephy-bookmarks-import.c: (xbel_parse_single_bookmark), (xbel_parse_folder), (xbel_parse_bookmarks), (ephy_bookmarks_import_mozilla), (ephy_bookmarks_import_xbel): * src/bookmarks/ephy-bookmarks-import.h: * src/ephy-shell.c: (ephy_shell_command_cb): Added the ability to import galeon and konqueror bookmarks. --- lib/ephy-start-here.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) (limited to 'lib/ephy-start-here.c') diff --git a/lib/ephy-start-here.c b/lib/ephy-start-here.c index 40b23c452..06d08de38 100644 --- a/lib/ephy-start-here.c +++ b/lib/ephy-start-here.c @@ -220,6 +220,45 @@ mozilla_bookmarks (void) return result; } +static char * +galeon_bookmarks (void) +{ + GSList *l; + char *dir; + char *result; + + dir = g_build_filename (g_get_home_dir (), ".galeon", NULL); + l = ephy_file_find (dir, "bookmarks.xbel", 4); + g_free (dir); + + result = l ? g_strdup (l->data) : NULL; + + g_slist_foreach (l, (GFunc) g_free, NULL); + g_slist_free (l); + + return result; +} + +static char * +konqueror_bookmarks (void) +{ + GSList *l; + char *dir; + char *result; + + dir = g_build_filename (g_get_home_dir (), ".kde", "share", + "apps", "konqueror", NULL); + l = ephy_file_find (dir, "bookmarks.xml", 4); + g_free (dir); + + result = l ? g_strdup (l->data) : NULL; + + g_slist_foreach (l, (GFunc) g_free, NULL); + g_slist_free (l); + + return result; +} + static void attach_content (EphyStartHere *sh, xmlNodePtr node, xmlChar *id) { @@ -232,12 +271,35 @@ attach_content (EphyStartHere *sh, xmlNodePtr node, xmlChar *id) if (bmk_file) { child = xmlNewDocNode (sh->priv->doc, NULL, "action", - _("Import mozilla bookmarks")); - xmlSetProp (child, "id", "import-bookmarks"); + _("Import Mozilla bookmarks")); + xmlSetProp (child, "id", "import-mozilla-bookmarks"); + xmlSetProp (child, "param", bmk_file); + xmlAddChild (node, child); + } + g_free (bmk_file); + + bmk_file = galeon_bookmarks (); + if (bmk_file) + { + child = xmlNewDocNode (sh->priv->doc, NULL, "action", + _("Import Galeon bookmarks")); + xmlSetProp (child, "id", "import-galeon-bookmarks"); + xmlSetProp (child, "param", bmk_file); + xmlAddChild (node, child); + } + g_free (bmk_file); + + bmk_file = konqueror_bookmarks (); + if (bmk_file) + { + child = xmlNewDocNode (sh->priv->doc, NULL, "action", + _("Import Konqueror bookmarks")); + xmlSetProp (child, "id", "import-konqueror-bookmarks"); xmlSetProp (child, "param", bmk_file); xmlAddChild (node, child); } g_free (bmk_file); + } } -- cgit v1.2.3