aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-03-22 20:56:37 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-03-22 20:56:37 +0800
commit7038fa5c1a3d6eee199e0731e1fae8430498eeab (patch)
tree978d9639b217ee5e1b6b8250b0c10b40a0d29f58 /src/bookmarks/ephy-bookmarks.c
parent2b29eae9bd4e37d8f7fe1ff84a74cb8e7f0c527b (diff)
downloadgsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.tar
gsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.tar.gz
gsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.tar.bz2
gsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.tar.lz
gsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.tar.xz
gsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.tar.zst
gsoc2013-epiphany-7038fa5c1a3d6eee199e0731e1fae8430498eeab.zip
Begin bookmarks editor redesign. Please still dont use it or you really
2003-03-22 Marco Pesenti Gritti <marco@it.gnome.org> * data/ui/epiphany-bookmark-editor-ui.xml.in: * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmark-properties.c: (ephy_bookmark_properties_get_type), (ephy_bookmark_properties_class_init), (ephy_bookmark_properties_finalize), (ephy_bookmark_properties_set_bookmark), (ephy_bookmark_properties_set_property), (ephy_bookmark_properties_get_property), (bookmark_properties_response_cb), (build_ui), (ephy_bookmark_properties_init), (ephy_bookmark_properties_new): * src/bookmarks/ephy-bookmark-properties.h: * src/bookmarks/ephy-bookmarks-editor.c: (popup_cmd_bookmark_properties), (ephy_bookmarks_editor_get_type), (keyword_node_selected_cb), (ephy_bookmarks_editor_construct): * src/bookmarks/ephy-bookmarks-editor.h: * src/bookmarks/ephy-bookmarks-import.c: (mozilla_parse_bookmarks), (xbel_parse_single_bookmark), (xbel_parse_folder): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_add), (ephy_bookmarks_set_keyword), (ephy_bookmarks_unset_keyword): * src/bookmarks/ephy-bookmarks.h: * src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_add), (build_editing_table), (ephy_new_bookmark_construct): * src/bookmarks/ephy-topics-selector.c: (ephy_topics_selector_get_type), (ephy_topics_selector_class_init), (ephy_topics_selector_finalize), (ephy_topics_selector_set_bookmark), (ephy_topics_selector_set_property), (ephy_topics_selector_get_property), (fill_model), (topic_toggled), (ephy_topics_selector_apply), (ephy_topics_build_ui), (ephy_topics_selector_init), (ephy_topics_selector_new): * src/bookmarks/ephy-topics-selector.h: Begin bookmarks editor redesign. Please still dont use it or you really want backup your bookmarks ;)
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r--src/bookmarks/ephy-bookmarks.c94
1 files changed, 5 insertions, 89 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 8425ad92a..81a06e738 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -552,8 +552,7 @@ EphyNode *
ephy_bookmarks_add (EphyBookmarks *eb,
const char *title,
const char *url,
- const char *smart_url,
- const char *keywords)
+ const char *smart_url)
{
EphyNode *bm;
GValue value = { 0, };
@@ -578,14 +577,6 @@ ephy_bookmarks_add (EphyBookmarks *eb,
&value);
g_value_unset (&value);
- ephy_bookmarks_update_keywords (eb, keywords, bm);
-
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, keywords);
- ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_KEYWORDS,
- &value);
- g_value_unset (&value);
-
ephy_node_add_child (eb->priv->bookmarks, bm);
ephy_bookmarks_emit_data_changed (eb);
@@ -868,6 +859,8 @@ ephy_bookmarks_set_keyword (EphyBookmarks *eb,
EphyNode *keyword,
EphyNode *bookmark)
{
+ if (ephy_node_has_child (keyword, bookmark)) return;
+
ephy_node_add_child (keyword, bookmark);
}
@@ -876,89 +869,12 @@ ephy_bookmarks_unset_keyword (EphyBookmarks *eb,
EphyNode *keyword,
EphyNode *bookmark)
{
+ if (!ephy_node_has_child (keyword, bookmark)) return;
+
ephy_node_remove_child (keyword, bookmark);
ephy_bookmarks_clean_empty_keywords (eb);
}
-static GList *
-diff_keywords (char **ks1, char **ks2)
-{
- GList *result = NULL;
- int i, j;
-
- for (i = 0; ks1 != NULL && ks1[i] != NULL; i++)
- {
- gboolean found = FALSE;
-
- LOG ("Diff keywords, keyword:\"%s\"", ks1[i])
-
- for (j = 0; ks2 != NULL && ks2[j] != NULL; j++)
- {
- if (strcmp (ks1[i], ks2[j]) == 0)
- {
- found = TRUE;
- }
- }
-
- if (!found && g_utf8_strlen (ks1[i], -1) > 0)
- {
- result = g_list_append (result, ks1[i]);
- }
- }
-
- return result;
-}
-
-void
-ephy_bookmarks_update_keywords (EphyBookmarks *eb,
- const char *keywords,
- EphyNode *node)
-{
- const char *prop;
- char **ks, **old_ks = NULL;
- GList *diffs, *l;
- EphyNode *keyword;
-
- prop = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_KEYWORDS);
- ks = g_strsplit (keywords, " ", 10);
- if (prop != NULL)
- {
- old_ks = g_strsplit (prop, " ", 10);
- }
-
- diffs = diff_keywords (ks, old_ks);
- for (l = diffs; l != NULL; l = l->next)
- {
- char *word = (char *)l->data;
-
- keyword = ephy_bookmarks_find_keyword
- (eb, word, FALSE);
-
- if (!keyword)
- {
- keyword = ephy_bookmarks_add_keyword
- (eb, word);
- }
-
- ephy_bookmarks_set_keyword (eb, keyword, node);
- }
- g_list_free (diffs);
-
- diffs = diff_keywords (old_ks, ks);
- for (l = diffs; l != NULL; l = l->next)
- {
- keyword = ephy_bookmarks_find_keyword (eb,
- (char *)l->data, FALSE);
- g_return_if_fail (keyword != NULL);
-
- ephy_bookmarks_unset_keyword (eb, keyword, node);
- }
- g_list_free (diffs);
-
- g_strfreev (ks);
- g_strfreev (old_ks);
-}
-
EphyNode *
ephy_bookmarks_get_keywords (EphyBookmarks *eb)
{