From c2c4329845a9f8f7fa448516e75c21e09ec4e8a2 Mon Sep 17 00:00:00 2001 From: mental Date: Sun, 6 May 2007 21:30:36 +0000 Subject: [PATCH] instrument undo commits --- src/document-undo.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 9ce1dad60..911258ee0 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -63,6 +63,7 @@ #include "inkscape.h" #include "debug/event-tracker.h" #include "debug/simple-event.h" +#include "debug/timestamp.h" #include "event.h" @@ -129,6 +130,37 @@ sp_document_reset_key (Inkscape::Application *inkscape, SPDesktop *desktop, GtkO doc->actionkey = NULL; } +namespace { + +using Inkscape::Debug::Event; +using Inkscape::Debug::SimpleEvent; +using Inkscape::Util::share_static_string; +using Inkscape::Debug::timestamp; +using Inkscape::Verb; + +typedef SimpleEvent InteractionEvent; + +class CommitEvent : public InteractionEvent { +public: + + CommitEvent(SPDocument *doc, const gchar *key, const unsigned int type, + Glib::ustring const &description) + : InteractionEvent(share_static_string("commit")) + { + _addProperty(share_static_string("timestamp"), timestamp()); + Verb *verb = Verb::get(type); + if (verb) { + _addProperty(share_static_string("verb"), verb->get_id()); + } + if (key) { + _addProperty(share_static_string("merge-key"), key); + } + _addProperty(share_static_string("description"), description.c_str()); + } +}; + +} + void sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type, Glib::ustring event_description) @@ -137,6 +169,8 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev g_assert (doc->priv != NULL); g_assert (doc->priv->sensitive); + Inkscape::Debug::Logger::write(doc, key, event_type, event_description); + doc->collectOrphans(); sp_document_ensure_up_to_date (doc); -- 2.30.2