Code

glib/gtestutils.h is not available on gutsy, so switching to include of
[inkscape.git] / src / xml / event.cpp
index d91dd681fb5ae912cb7f3909952d82b874cc5b7d..d713200e574f9161c7ec5eb5ac1773f2bfd91cf3 100644 (file)
@@ -13,6 +13,8 @@
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
+#include <glib.h> // g_assert()
+
 #include "event.h"
 #include "event-fns.h"
 #include "util/reverse-list.h"
@@ -26,8 +28,6 @@ using Inkscape::Util::reverse_list;
 
 int Inkscape::XML::Event::_next_serial=0;
 
-using Inkscape::XML::Session;
-
 void
 sp_repr_begin_transaction (Inkscape::XML::Document *doc)
 {
@@ -38,9 +38,7 @@ sp_repr_begin_transaction (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("begin-transaction");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       session->beginTransaction();
+       doc->beginTransaction();
 }
 
 void
@@ -53,9 +51,7 @@ sp_repr_rollback (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("rollback");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       session->rollback();
+       doc->rollback();
 }
 
 void
@@ -68,9 +64,7 @@ sp_repr_commit (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("commit");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       session->commit();
+       doc->commit();
 }
 
 Inkscape::XML::Event *
@@ -83,9 +77,7 @@ sp_repr_commit_undoable (Inkscape::XML::Document *doc)
        EventTracker<SimpleEvent<Event::XML> > tracker("commit");
 
        g_assert(doc != NULL);
-       Session *session=doc->session();
-       g_assert(session != NULL);
-       return session->commitUndoable();
+       return doc->commitUndoable();
 }
 
 namespace {
@@ -148,8 +140,8 @@ sp_repr_undo_log (Inkscape::XML::Event *log)
 
        EventTracker<SimpleEvent<Event::XML> > tracker("undo-log");
 
-       if (log) {
-               g_assert(!log->repr->session()->inTransaction());
+       if (log && log->repr) {
+               g_assert(!log->repr->document()->inTransaction());
        }
 
        Inkscape::XML::undo_log_to_observer(log, LogPerformer::instance());
@@ -206,12 +198,8 @@ sp_repr_replay_log (Inkscape::XML::Event *log)
        EventTracker<SimpleEvent<Event::XML> > tracker("replay-log");
 
        if (log) {
-               // Nodes created by the whiteboard deserializer tend to not 
-               // have an associated session.  This conditional hacks a way around that,
-               // but what's the best way to fix the whiteboard code so that new nodes
-               // will have an associated session? -- yipdw
-               if (log->repr->session()) {
-                       g_assert(!log->repr->session()->inTransaction());
+               if (log->repr->document()) {
+                       g_assert(!log->repr->document()->inTransaction());
                }
        }