aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--embed/ephy-history.c20
-rw-r--r--src/bookmarks/ephy-bookmarks.c17
-rw-r--r--src/ephy-history-model.c13
4 files changed, 47 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index a3b87c904..3c1327af8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2003-01-01 Marco Pesenti Gritti <marco@it.gnome.org>
+ * embed/ephy-history.c: (ephy_history_clear),
+ (ephy_history_remove):
+ * src/bookmarks/ephy-bookmarks.c:
+ (ephy_bookmarks_clean_empty_keywords):
+ * src/ephy-history-model.c: (get_one_level_path_real),
+ (get_path_real), (root_child_removed_cb):
+
+ Rewrite ephy node multiple removals to actually
+ work.
+
+2003-01-01 Marco Pesenti Gritti <marco@it.gnome.org>
+
* TODO:
* data/glade/epiphany.glade:
* embed/ephy-history.c: (page_is_obsolete),
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 7c6f08e9d..84875f721 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -719,17 +719,16 @@ ephy_history_set_page_title (EphyHistory *gh,
void
ephy_history_clear (EphyHistory *gh)
{
- GPtrArray *children;
- int i;
+ EphyNode *node;
- children = ephy_node_get_children (gh->priv->hosts);
- ephy_node_thaw (gh->priv->hosts);
- for (i = 0; i < children->len; i++)
+ while ((node = ephy_node_get_nth_child (gh->priv->pages, 0)) != NULL)
{
- EphyNode *kid;
+ ephy_node_unref (node);
+ }
- kid = g_ptr_array_index (children, i);
- ephy_node_unref (kid);
+ while ((node = ephy_node_get_nth_child (gh->priv->hosts, 0)) != NULL)
+ {
+ ephy_node_unref (node);
}
ephy_history_save (gh);
@@ -765,6 +764,11 @@ ephy_history_remove (EphyHistory *gh, EphyNode *node)
host_id = ephy_node_get_property_int (node, EPHY_NODE_PAGE_PROP_HOST_ID);
if (host_id < 0)
{
+ EphyNode *tmp;
+ while ((tmp = ephy_node_get_nth_child (node, 0)) != NULL)
+ {
+ ephy_node_unref (tmp);
+ }
ephy_node_unref (node);
return;
}
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 2432846e3..a4f5412a4 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -174,6 +174,7 @@ ephy_bookmarks_clean_empty_keywords (EphyBookmarks *eb)
{
GPtrArray *children;
int i;
+ GList *l = NULL, *tmp;
children = ephy_node_get_children (eb->priv->keywords);
ephy_node_thaw (eb->priv->keywords);
@@ -185,13 +186,21 @@ ephy_bookmarks_clean_empty_keywords (EphyBookmarks *eb)
if (ephy_node_get_n_children (kid) == 0)
{
- DEBUG_MSG (("Remove empty keyword: %s\n",
- ephy_node_get_property_string (kid,
- EPHY_NODE_KEYWORD_PROP_NAME)));
- ephy_node_unref (kid);
+ l = g_list_append (l, kid);
}
}
+ if (l == NULL) return FALSE;
+
+ for (tmp = l; tmp != NULL; tmp = tmp->next)
+ {
+ DEBUG_MSG (("Remove empty keyword: %s\n",
+ ephy_node_get_property_string (kid,
+ EPHY_NODE_KEYWORD_PROP_NAME)));
+ g_object_unref (EPHY_NODE (tmp->data));
+ }
+ g_list_free (l);
+
return FALSE;
}
diff --git a/src/ephy-history-model.c b/src/ephy-history-model.c
index c4e694bcd..baa948a7d 100644
--- a/src/ephy-history-model.c
+++ b/src/ephy-history-model.c
@@ -476,6 +476,7 @@ get_one_level_path_real (EphyHistoryModel *model,
retval = gtk_tree_path_new ();
my_parent = get_parent_node (model, node);
+ g_return_val_if_fail (my_parent != NULL, NULL);
gtk_tree_path_append_index (retval, ephy_node_get_child_index (my_parent, node));
@@ -489,8 +490,10 @@ get_path_real (EphyHistoryModel *model,
GtkTreePath *retval;
EphyNode *host;
- retval = gtk_tree_path_new ();
host = get_parent_node (model, page);
+ if (host != NULL) return NULL;
+
+ retval = gtk_tree_path_new ();
gtk_tree_path_append_index (retval, ephy_node_get_child_index (model->priv->root, host));
gtk_tree_path_append_index (retval, ephy_node_get_child_index (host, page));
@@ -776,8 +779,12 @@ root_child_removed_cb (EphyNode *node,
{
path = get_path_real (model, child);
}
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
- gtk_tree_path_free (path);
+
+ if (path)
+ {
+ gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
+ gtk_tree_path_free (path);
+ }
}
static void