summaryrefslogtreecommitdiffstats
path: root/src/document-undo.cpp
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2008-01-15 04:27:00 +0000
committermental <mental@users.sourceforge.net>2008-01-15 04:27:00 +0000
commit2fff772bdd81459304cae888312766fe99dfb360 (patch)
tree291896e86aa9a58e4e4080a4d4bb2a2dd1368153 /src/document-undo.cpp
parentwhitespace cleanup (diff)
downloadinkscape-2fff772bdd81459304cae888312766fe99dfb360.tar.gz
inkscape-2fff772bdd81459304cae888312766fe99dfb360.zip
abstract use of sodipodi:modified
(bzr r4490)
Diffstat (limited to 'src/document-undo.cpp')
-rw-r--r--src/document-undo.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index 7556d2e8f..2acd740f2 100644
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -66,6 +66,15 @@
#include "debug/timestamp.h"
#include "event.h"
+bool SPDocument::isModified() const {
+ return rroot ? rroot->attribute("sodipodi:modified") != NULL : false;
+}
+void SPDocument::setModified(bool modified) {
+ if (rroot) {
+ rroot->setAttribute("sodipodi:modified", "true");
+ }
+}
+
/*
* Undo & redo
@@ -199,9 +208,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev
doc->actionkey = key;
doc->virgin = FALSE;
- if (!doc->rroot->attribute("sodipodi:modified")) {
- doc->rroot->setAttribute("sodipodi:modified", "true");
- }
+ doc->setModified();
sp_repr_begin_transaction (doc->rdoc);
@@ -267,7 +274,7 @@ sp_document_undo (SPDocument *doc)
sp_repr_undo_log (log->event);
doc->priv->redo = g_slist_prepend (doc->priv->redo, log);
- doc->rroot->setAttribute("sodipodi:modified", "true");
+ doc->setModified();
doc->priv->undoStackObservers.notifyUndoEvent(log);
ret = TRUE;
@@ -313,7 +320,7 @@ sp_document_redo (SPDocument *doc)
sp_repr_replay_log (log->event);
doc->priv->undo = g_slist_prepend (doc->priv->undo, log);
- doc->rroot->setAttribute("sodipodi:modified", "true");
+ doc->setModified();
doc->priv->undoStackObservers.notifyRedoEvent(log);
ret = TRUE;