aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks/ephy-bookmarks.c
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2003-05-13 03:22:27 +0800
committerXan Lopez <xan@src.gnome.org>2003-05-13 03:22:27 +0800
commitbacb58f2fda5bef60b55500aa79e17be7aa8a384 (patch)
treec317366a2a1f6e84cdcc386257a5c68a932b0b35 /src/bookmarks/ephy-bookmarks.c
parent1044f92a19ab225a74e7829561cfe1733aee6913 (diff)
downloadgsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.gz
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.bz2
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.lz
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.xz
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.tar.zst
gsoc2013-epiphany-bacb58f2fda5bef60b55500aa79e17be7aa8a384.zip
Don't allow to have more than one bookmark with the same URL^H^H^Haddress,
Don't allow to have more than one bookmark with the same URL^H^H^Haddress, warn the user with a nice dialog. Fixes #110854.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r--src/bookmarks/ephy-bookmarks.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 529ad0d5d..730caf91e 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -229,8 +229,8 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass)
static void
ephy_bookmarks_init_defaults (EphyBookmarks *eb)
{
- int i;
- int id;
+ int i, id;
+ EphyNode *node;
EphyToolbarsModel *model;
model = ephy_shell_get_toolbars_model (ephy_shell);
@@ -246,7 +246,9 @@ ephy_bookmarks_init_defaults (EphyBookmarks *eb)
default_bookmarks[i].location,
default_bookmarks[i].smart_url);
- id = ephy_bookmarks_get_bookmark_id (eb, default_bookmarks[i].location);
+ node = ephy_bookmarks_find_bookmark (eb, default_bookmarks[i].location);
+ if (node == NULL) break;
+ id = ephy_node_get_id (node);
ephy_toolbars_model_add_bookmark (model, FALSE, id);
}
@@ -441,10 +443,8 @@ history_site_visited_cb (EphyHistory *gh, const char *url, EphyBookmarks *eb)
EphyNode *node;
guint id;
- id = ephy_bookmarks_get_bookmark_id (eb, url);
- if (id == 0) return;
-
- node = ephy_node_get_from_id (id);
+ node = ephy_bookmarks_find_bookmark (eb, url);
+ if (node == NULL) return;
if (add_to_favorites (eb, node, gh))
{
@@ -738,9 +738,9 @@ ephy_bookmarks_add (EphyBookmarks *eb,
return bm;
}
-guint
-ephy_bookmarks_get_bookmark_id (EphyBookmarks *eb,
- const char *url)
+EphyNode*
+ephy_bookmarks_find_bookmark (EphyBookmarks *eb,
+ const char *url)
{
GPtrArray *children;
int i;
@@ -757,12 +757,12 @@ ephy_bookmarks_get_bookmark_id (EphyBookmarks *eb,
if (strcmp (url, location) == 0)
{
ephy_node_thaw (eb->priv->bookmarks);
- return ephy_node_get_id (kid);
+ return kid;
}
}
ephy_node_thaw (eb->priv->bookmarks);
- return 0;
+ return NULL;
}
void
@@ -776,10 +776,8 @@ ephy_bookmarks_set_icon (EphyBookmarks *eb,
g_return_if_fail (icon != NULL);
- id = ephy_bookmarks_get_bookmark_id (eb, url);
- if (id == 0) return;
-
- node = ephy_node_get_from_id (id);
+ node = ephy_bookmarks_find_bookmark (eb, url);
+ if (node == NULL) return;
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, icon);
@@ -969,7 +967,8 @@ ephy_bookmarks_add_keyword (EphyBookmarks *eb,
return key;
}
-void ephy_bookmarks_remove_keyword (EphyBookmarks *eb,
+void
+ephy_bookmarks_remove_keyword (EphyBookmarks *eb,
EphyNode *keyword)
{
ephy_node_remove_child (eb->priv->keywords, keyword);