aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-28 02:38:28 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-28 02:38:28 +0800
commitd65d1d8a4694e0dd9fb28d5a8defaa16927bc155 (patch)
tree362905858c943b5f2ca699f1679232d24ed11792 /src
parent4d94003629211bb7cb57189742b718201d2c27bd (diff)
downloadgsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.tar
gsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.tar.gz
gsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.tar.bz2
gsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.tar.lz
gsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.tar.xz
gsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.tar.zst
gsoc2013-epiphany-d65d1d8a4694e0dd9fb28d5a8defaa16927bc155.zip
Emit removed signal after the node is actually removed. This could cause
2003-04-27 Marco Pesenti Gritti <marco@it.gnome.org> * lib/ephy-node.c: (real_remove_child): Emit removed signal after the node is actually removed. This could cause bugs, test test test ;) * src/bookmarks/ephy-bookmarks.c: (topics_removed_cb): Update topics list and uncategorized folder on topics removal.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks.c120
1 files changed, 73 insertions, 47 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 955a7ef35..99e5d5078 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -460,12 +460,85 @@ bookmarks_removed_cb (EphyNode *node,
ephy_bookmarks_emit_data_changed (eb);
}
+static char *
+get_topics_list (EphyBookmarks *eb,
+ EphyNode *bookmark,
+ gboolean *no_topics)
+{
+ GPtrArray *children;
+ int i;
+ GString *list;
+
+ list = g_string_new (NULL);
+ *no_topics = TRUE;
+
+ children = ephy_node_get_children (eb->priv->keywords);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+
+ kid = g_ptr_array_index (children, i);
+
+ if (kid != eb->priv->notcategorized &&
+ kid != eb->priv->favorites &&
+ kid != eb->priv->bookmarks &&
+ ephy_node_has_child (kid, bookmark))
+ {
+ const char *topic;
+ topic = ephy_node_get_property_string
+ (kid, EPHY_NODE_KEYWORD_PROP_NAME);
+ g_string_append (list, topic);
+ no_topics = FALSE;
+ }
+ }
+ ephy_node_thaw (eb->priv->keywords);
+
+ return g_string_free (list, FALSE);
+}
+
+static void
+update_topics_list (EphyNode *bookmark, const char *list)
+{
+ GValue value = { 0, };
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, list);
+ ephy_node_set_property (bookmark, EPHY_NODE_BMK_PROP_KEYWORDS,
+ &value);
+ g_value_unset (&value);
+}
+
+
static void
topics_removed_cb (EphyNode *node,
EphyNode *child,
EphyBookmarks *eb)
{
long id;
+ GPtrArray *children;
+ int i;
+
+ children = ephy_node_get_children (child);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+ gboolean no_topics;
+ char *list;
+
+ kid = g_ptr_array_index (children, i);
+ list = get_topics_list (eb, kid, &no_topics);
+
+ if (no_topics &&
+ !ephy_node_has_child (eb->priv->notcategorized, kid))
+ {
+ ephy_node_add_child
+ (eb->priv->notcategorized, kid);
+ }
+
+ update_topics_list (kid, list);
+
+ g_free (list);
+ }
+ ephy_node_thaw (child);
id = ephy_node_get_id (child);
g_signal_emit (eb, ephy_bookmarks_signals[TOPIC_REMOVE],
@@ -920,53 +993,6 @@ ephy_bookmarks_has_keyword (EphyBookmarks *eb,
return ephy_node_has_child (keyword, bookmark);
}
-static char *
-get_topics_list (EphyBookmarks *eb,
- EphyNode *bookmark,
- gboolean *no_topics)
-{
- GPtrArray *children;
- int i;
- GString *list;
-
- list = g_string_new (NULL);
- *no_topics = TRUE;
-
- children = ephy_node_get_children (eb->priv->keywords);
- for (i = 0; i < children->len; i++)
- {
- EphyNode *kid;
-
- kid = g_ptr_array_index (children, i);
-
- if (kid != eb->priv->notcategorized &&
- kid != eb->priv->favorites &&
- kid != eb->priv->bookmarks &&
- ephy_node_has_child (kid, bookmark))
- {
- const char *topic;
- topic = ephy_node_get_property_string
- (kid, EPHY_NODE_KEYWORD_PROP_NAME);
- g_string_append (list, topic);
- no_topics = FALSE;
- }
- }
- ephy_node_thaw (eb->priv->keywords);
-
- return g_string_free (list, FALSE);
-}
-
-static void
-update_topics_list (EphyNode *bookmark, const char *list)
-{
- GValue value = { 0, };
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, list);
- ephy_node_set_property (bookmark, EPHY_NODE_BMK_PROP_KEYWORDS,
- &value);
- g_value_unset (&value);
-}
-
void
ephy_bookmarks_set_keyword (EphyBookmarks *eb,
EphyNode *keyword,