aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-node-db.c19
-rw-r--r--lib/ephy-node.h1
-rw-r--r--lib/ephy-state.c2
3 files changed, 9 insertions, 13 deletions
diff --git a/lib/ephy-node-db.c b/lib/ephy-node-db.c
index 8f553491a..c98f7b4f7 100644
--- a/lib/ephy-node-db.c
+++ b/lib/ephy-node-db.c
@@ -504,24 +504,21 @@ ephy_node_db_write_to_xml_valist (EphyNodeDb *db,
while (node != NULL)
{
GPtrArray *children;
- guint n_exceptions, i;
- GSList *exceptions = NULL;
+ EphyNodeFilterFunc filter;
+ gpointer user_data;
+ int i;
- n_exceptions = va_arg (argptr, guint);
- for (i=0; i < n_exceptions; i++)
- {
- exceptions = g_slist_prepend (exceptions,
- va_arg (argptr, EphyNode *));
- }
+ filter = va_arg (argptr, EphyNodeFilterFunc);
+ user_data = va_arg (argptr, gpointer);
children = ephy_node_get_children (node);
- for (i=0; i < children->len; i++)
+ for (i = 0; i < children->len; i++)
{
EphyNode *kid;
kid = g_ptr_array_index (children, i);
- if (g_slist_find (exceptions, kid) == NULL)
+ if (!filter || filter (kid, user_data))
{
ret = ephy_node_write_to_xml (kid, writer);
if (ret < 0) break;
@@ -529,8 +526,6 @@ ephy_node_db_write_to_xml_valist (EphyNodeDb *db,
}
if (ret < 0) break;
- g_slist_free (exceptions);
-
node = va_arg (argptr, EphyNode *);
}
if (ret < 0) goto out;
diff --git a/lib/ephy-node.h b/lib/ephy-node.h
index 7335616dd..ecdb32588 100644
--- a/lib/ephy-node.h
+++ b/lib/ephy-node.h
@@ -47,6 +47,7 @@ typedef enum
#include "ephy-node-db.h"
typedef void (*EphyNodeCallback) (EphyNode *node, ...);
+typedef gboolean (*EphyNodeFilterFunc) (EphyNode *, gpointer);
GType ephy_node_get_type (void) G_GNUC_CONST;
diff --git a/lib/ephy-state.c b/lib/ephy-state.c
index ad8c6e018..f12ada4bc 100644
--- a/lib/ephy-state.c
+++ b/lib/ephy-state.c
@@ -67,7 +67,7 @@ ephy_states_save (void)
EPHY_STATES_XML_ROOT,
EPHY_STATES_XML_VERSION,
NULL, /* comment */
- states, 0,
+ states, NULL, NULL,
NULL);
g_free (xml_file);