aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-04-08 21:26:25 +0800
committerChristian Persch <chpe@src.gnome.org>2005-04-08 21:26:25 +0800
commit30cfaa4a4929d85f303b3afc9c8ec240d548ff87 (patch)
tree833970d4a40cf2aabd3fb62b87ca16e640c0523f /lib
parent3ddeef804136e9f47f66c38c80d126a4285d525d (diff)
downloadgsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.tar
gsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.tar.gz
gsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.tar.bz2
gsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.tar.lz
gsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.tar.xz
gsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.tar.zst
gsoc2013-epiphany-30cfaa4a4929d85f303b3afc9c8ec240d548ff87.zip
Implement a more flexible approach at saving a EphyNodeDb, by allowing to
2005-04-08 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-favicon-cache.c: (ephy_favicon_cache_finalize): * embed/ephy-history.c: (save_filter), (ephy_history_save): * lib/ephy-node-db.c: (ephy_node_db_write_to_xml_valist): * lib/ephy-node.h: * lib/ephy-state.c: (ephy_states_save): * src/bookmarks/ephy-bookmarks.c: (save_filter), (ephy_bookmarks_save): Implement a more flexible approach at saving a EphyNodeDb, by allowing to specify a filter func to exclude certain nodes, instead of a fixed list.
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);