aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.c
diff options
context:
space:
mode:
authorPeter Harvey <peter.a.harvey@gmail.com>2006-01-29 23:30:40 +0800
committerPeter Anthony Harvey <paharvey@src.gnome.org>2006-01-29 23:30:40 +0800
commit7134d369d44b5bddde985808cc531b6a7edef2a0 (patch)
treeefe2279b0240a5110ac13d9bd334c4e6997b4a02 /src/bookmarks/ephy-bookmarks.c
parente98c2ee0d286bea538229374d0fa8194ec81a875 (diff)
downloadgsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.tar
gsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.tar.gz
gsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.tar.bz2
gsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.tar.lz
gsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.tar.xz
gsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.tar.zst
gsoc2013-epiphany-7134d369d44b5bddde985808cc531b6a7edef2a0.zip
src/bookmarks/ephy-bookmark-properties.c src/bookmarks/ephy-bookmarks.c
2006-01-29 Peter Harvey <peter.a.harvey@gmail.com> * src/bookmarks/ephy-bookmark-properties.c * src/bookmarks/ephy-bookmarks.c * src/bookmarks/ephy-bookmarks.h Added better widget to handle duplicate bookmarks. * src/bookmarks/ephy-topics-entry.c Corrected handling of UTF8 strings. * src/bookmarks/ephy-topics-palette.c Removed unnecessary use of g_idle_*..
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r--src/bookmarks/ephy-bookmarks.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 7770265f7..207b55e62 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -1186,11 +1186,12 @@ ephy_bookmarks_find_bookmark (EphyBookmarks *eb,
return NULL;
}
-EphyNode *
-ephy_bookmarks_find_duplicate (EphyBookmarks *eb,
- EphyNode *bookmark)
+GPtrArray *
+ephy_bookmarks_find_duplicates (EphyBookmarks *eb,
+ EphyNode *bookmark)
{
GPtrArray *children;
+ GPtrArray *result;
const char *url;
int i;
@@ -1202,6 +1203,8 @@ ephy_bookmarks_find_duplicate (EphyBookmarks *eb,
(bookmark, EPHY_NODE_BMK_PROP_LOCATION);
g_return_val_if_fail (url != NULL, NULL);
+
+ result = g_ptr_array_new ();
children = ephy_node_get_children (eb->priv->bookmarks);
for (i = 0; i < children->len; i++)
@@ -1220,11 +1223,54 @@ ephy_bookmarks_find_duplicate (EphyBookmarks *eb,
if (location != NULL && strcmp (url, location) == 0)
{
- return kid;
+ g_ptr_array_add (result, kid);
}
}
- return NULL;
+ return result;
+}
+
+gint
+ephy_bookmarks_count_duplicates (EphyBookmarks *eb,
+ EphyNode *bookmark)
+{
+ GPtrArray *children;
+ const char *url;
+ int i, result;
+
+ g_return_val_if_fail (EPHY_IS_BOOKMARKS (eb), -1);
+ g_return_val_if_fail (eb->priv->bookmarks != NULL, -1);
+ g_return_val_if_fail (bookmark != NULL, -1);
+
+ url = ephy_node_get_property_string
+ (bookmark, EPHY_NODE_BMK_PROP_LOCATION);
+
+ g_return_val_if_fail (url != NULL, -1);
+
+ result = 0;
+
+ children = ephy_node_get_children (eb->priv->bookmarks);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+ const char *location;
+
+ kid = g_ptr_array_index (children, i);
+ if (kid == bookmark)
+ {
+ continue;
+ }
+
+ location = ephy_node_get_property_string
+ (kid, EPHY_NODE_BMK_PROP_LOCATION);
+
+ if (location != NULL && strcmp (url, location) == 0)
+ {
+ result++;
+ }
+ }
+
+ return result;
}
void