aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@gnome.org>2007-08-06 17:16:45 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2007-08-06 17:16:45 +0800
commit6f07210d4d0e04a50dd64ca447952ef18ce07b8b (patch)
tree035f74fe58a16b9573518cb5c323f891959dee08
parentc4af7e945b595f32014b856a9a9a40af2d50e860 (diff)
downloadgsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.tar
gsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.tar.gz
gsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.tar.bz2
gsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.tar.lz
gsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.tar.xz
gsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.tar.zst
gsoc2013-epiphany-6f07210d4d0e04a50dd64ca447952ef18ce07b8b.zip
Make ephy_history_set_enabled actually disable history and not delete it.
2007-08-06 Diego Escalante Urrelo <diegoe@gnome.org> * embed/ephy-history.c: * embed/ephy-history.h: Make ephy_history_set_enabled actually disable history and not delete it. Also make it public. svn path=/trunk/; revision=7244
-rw-r--r--ChangeLog8
-rw-r--r--embed/ephy-history.c56
-rw-r--r--embed/ephy-history.h3
3 files changed, 49 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 31643667f..cf9a73e9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-06 Diego Escalante Urrelo <diegoe@gnome.org>
+
+ * embed/ephy-history.c:
+ * embed/ephy-history.h:
+
+ Make ephy_history_set_enabled actually disable history and not delete
+ it. Also make it public.
+
2007-08-02 Diego Escalante Urrelo <diegoe@gnome.org>
* data/ui/epiphany-ui.xml:
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index bc84c4bca..a59314865 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -125,22 +125,6 @@ ephy_history_get_type (void)
}
static void
-ephy_history_set_enabled (EphyHistory *history,
- gboolean enabled)
-{
- LOG ("ephy_history_set_enabled %d", enabled);
-
- history->priv->enabled = enabled;
-
- ephy_node_db_set_immutable (history->priv->db, !enabled);
-
- if (enabled == FALSE)
- {
- ephy_history_clear (history);
- }
-}
-
-static void
ephy_history_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -169,7 +153,7 @@ ephy_history_get_property (GObject *object,
case PROP_ENABLED:
g_value_set_boolean (value, history->priv->enabled);
break;
- }
+ }
}
static void
@@ -288,7 +272,7 @@ ephy_history_save (EphyHistory *eb)
int ret;
/* only save if there are changes */
- if (eb->priv->dirty == FALSE)
+ if (eb->priv->dirty == FALSE && eb->priv->enabled)
{
return;
}
@@ -1031,3 +1015,39 @@ ephy_history_is_enabled (EphyHistory *history)
return history->priv->enabled;
}
+
+void
+ephy_history_set_enabled (EphyHistory *history,
+ gboolean enabled)
+{
+ int ret;
+
+ ret = 1;
+
+ LOG ("ephy_history_set_enabled %d", enabled);
+
+ /* Write history only when disabling it, not when reenabling it */
+ if (!enabled && history->priv->dirty)
+ {
+ ret = ephy_node_db_write_to_xml_safe
+ (history->priv->db, (const xmlChar *)history->priv->xml_file,
+ EPHY_HISTORY_XML_ROOT,
+ EPHY_HISTORY_XML_VERSION,
+ NULL, /* comment */
+ history->priv->hosts,
+ (EphyNodeFilterFunc) save_filter, history->priv->pages,
+ history->priv->pages, NULL, NULL,
+ NULL);
+ }
+
+ if (ret >=0)
+ {
+ /* save was successful */
+ history->priv->dirty = FALSE;
+ }
+
+ history->priv->enabled = enabled;
+
+ ephy_node_db_set_immutable (history->priv->db, !enabled);
+}
+
diff --git a/embed/ephy-history.h b/embed/ephy-history.h
index 6c2d4ff7c..a65bd93aa 100644
--- a/embed/ephy-history.h
+++ b/embed/ephy-history.h
@@ -120,6 +120,9 @@ void ephy_history_clear (EphyHistory *gh);
gboolean ephy_history_is_enabled (EphyHistory *history);
+void ephy_history_set_enabled (EphyHistory *history,
+ gboolean enabled);
+
G_END_DECLS
#endif