]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- work on dbus interface
authorArvin Schnell <aschnell@suse.de>
Wed, 11 Jul 2012 10:49:46 +0000 (12:49 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 11 Jul 2012 10:49:46 +0000 (12:49 +0200)
client/snapper.cc
dbus/DBusMessage.h
snapper/File.cc
snapper/Snapper.h
testsuite-real/common.cc

index 3d3bdaee29d61152938cc985697e2bc9da54c025..2163cf92c1d734d8edbe98737c66d666d7589195 100644 (file)
@@ -1019,38 +1019,6 @@ help()
 }
 
 
-struct CompareCallbackImpl : public CompareCallback
-{
-    void start() { cout << _("comparing snapshots...") << flush; }
-    void stop() { cout << " " << _("done") << endl; }
-};
-
-CompareCallbackImpl compare_callback_impl;
-
-
-struct UndoCallbackImpl : public UndoCallback
-{
-    void start() { cout << _("undoing change...") << endl; }
-    void stop() { cout << _("undoing change done") << endl; }
-
-    void createInfo(const string& name)
-       { if (verbose) cout << sformat(_("creating %s"), name.c_str()) << endl; }
-    void modifyInfo(const string& name)
-       { if (verbose) cout << sformat(_("modifying %s"), name.c_str()) << endl; }
-    void deleteInfo(const string& name)
-       { if (verbose) cout << sformat(_("deleting %s"), name.c_str()) << endl; }
-
-    void createError(const string& name)
-       { cerr << sformat(_("failed to create %s"), name.c_str()) << endl; }
-    void modifyError(const string& name)
-       { cerr << sformat(_("failed to modify %s"), name.c_str()) << endl; }
-    void deleteError(const string& name)
-       { cerr << sformat(_("failed to delete %s"), name.c_str()) << endl; }
-};
-
-UndoCallbackImpl undo_callback_impl;
-
-
 int
 main(int argc, char** argv)
 {
index 0d865218b6113f523abf91ebd2855b17f575ab5e..c5aa0792172eae03477c00951942299c7967920e 100644 (file)
@@ -113,7 +113,7 @@ namespace DBus
     public:
 
        MessageMethodCall(const char* service, const char* object, const char* interface,
-                     const char* method)
+                         const char* method)
            : Message(dbus_message_new_method_call(service, object, interface, method))
        {
        }
index bd8317b549c63dfca771ad2493abeda332c7e02b..b841c3fe51993061ac6d11e904a0f2fa513ca0ee 100644 (file)
@@ -118,7 +118,7 @@ namespace snapper
              comparison->getSnapshot2()->getNum());
 
        if (getSnapper()->getCompareCallback())
-           getSnapper()->getCompareCallback()->start();
+           getSnapper()->getCompareCallback()->start(comparison);
 
        if (!comparison->getSnapshot1()->isCurrent())
            comparison->getSnapshot1()->mountFilesystemSnapshot();
@@ -137,7 +137,7 @@ namespace snapper
        sort(entries.begin(), entries.end());
 
        if (getSnapper()->getCompareCallback())
-           getSnapper()->getCompareCallback()->stop();
+           getSnapper()->getCompareCallback()->stop(comparison);
 
        y2mil("found " << entries.size() << " lines");
     }
@@ -686,9 +686,9 @@ namespace snapper
        {
            switch (getAction())
            {
-               case CREATE: getSnapper()->getUndoCallback()->createInfo(name); break;
-               case MODIFY: getSnapper()->getUndoCallback()->modifyInfo(name); break;
-               case DELETE: getSnapper()->getUndoCallback()->deleteInfo(name); break;
+               case CREATE: getSnapper()->getUndoCallback()->createInfo(comparison, name); break;
+               case MODIFY: getSnapper()->getUndoCallback()->modifyInfo(comparison, name); break;
+               case DELETE: getSnapper()->getUndoCallback()->deleteInfo(comparison, name); break;
            }
        }
 
@@ -716,9 +716,9 @@ namespace snapper
        {
            switch (getAction())
            {
-               case CREATE: getSnapper()->getUndoCallback()->createError(name); break;
-               case MODIFY: getSnapper()->getUndoCallback()->modifyError(name); break;
-               case DELETE: getSnapper()->getUndoCallback()->deleteError(name); break;
+               case CREATE: getSnapper()->getUndoCallback()->createError(comparison, name); break;
+               case MODIFY: getSnapper()->getUndoCallback()->modifyError(comparison, name); break;
+               case DELETE: getSnapper()->getUndoCallback()->deleteError(comparison, name); break;
            }
        }
 
index 346d2e3326ddc9fe69f563d86a3040fd697aa282..3083a3044f5f8abcc233c3f59c1424843e1a50c5 100644 (file)
@@ -37,6 +37,7 @@ namespace snapper
 
     class SysconfigFile;
     class Filesystem;
+    class Comparison;
 
 
     struct CompareCallback
@@ -44,8 +45,8 @@ namespace snapper
        CompareCallback() {}
        virtual ~CompareCallback() {}
 
-       virtual void start() = 0;
-       virtual void stop() = 0;
+       virtual void start(const Comparison* comparison) = 0;
+       virtual void stop(const Comparison* comparison) = 0;
     };
 
 
@@ -57,13 +58,13 @@ namespace snapper
        virtual void start() = 0;
        virtual void stop() = 0;
 
-       virtual void createInfo(const string& name) = 0;
-       virtual void modifyInfo(const string& name) = 0;
-       virtual void deleteInfo(const string& name) = 0;
+       virtual void createInfo(const Comparison* comparison, const string& name) = 0;
+       virtual void modifyInfo(const Comparison* comparison, const string& name) = 0;
+       virtual void deleteInfo(const Comparison* comparison, const string& name) = 0;
 
-       virtual void createError(const string& name) = 0;
-       virtual void modifyError(const string& name) = 0;
-       virtual void deleteError(const string& name) = 0;
+       virtual void createError(const Comparison* comparison, const string& name) = 0;
+       virtual void modifyError(const Comparison* comparison, const string& name) = 0;
+       virtual void deleteError(const Comparison* comparison, const string& name) = 0;
     };
 
 
index a422defdef8ed73631ea73fd44960031be56d352..1792cf6f73dd40f24f4976764b0fa897c8c8b127 100644 (file)
@@ -32,8 +32,8 @@ unsigned int numCreateErrors, numModifyErrors, numDeleteErrors;
 
 struct CompareCallbackImpl : public CompareCallback
 {
-    void start() { cout << "comparing snapshots..." << flush; }
-    void stop() { cout << " done" << endl; }
+    void start(const Comparison* comparison) { cout << "comparing snapshots..." << flush; }
+    void stop(const Comparison* comparison) { cout << " done" << endl; }
 };
 
 CompareCallbackImpl compare_callback_impl;
@@ -44,13 +44,19 @@ struct UndoCallbackImpl : public UndoCallback
     void start() { cout << "undoing..." << endl; }
     void stop() { cout << "undoing done" << endl; }
 
-    void createInfo(const string& name) { cout << "creating " << name << endl; }
-    void modifyInfo(const string& name) { cout << "modifying " << name << endl; }
-    void deleteInfo(const string& name) { cout << "deleting " << name << endl; }
-
-    void createError(const string& name) { cout << "failed to create " << name << endl; numCreateErrors++; }
-    void modifyError(const string& name) { cout << "failed to modify " << name << endl; numModifyErrors++; }
-    void deleteError(const string& name) { cout << "failed to delete " << name << endl; numDeleteErrors++; }
+    void createInfo(const Comparison* comparison, const string& name)
+       { cout << "creating " << name << endl; }
+    void modifyInfo(const Comparison* comparison, const string& name)
+       { cout << "modifying " << name << endl; }
+    void deleteInfo(const Comparison* comparison, const string& name)
+       { cout << "deleting " << name << endl; }
+
+    void createError(const Comparison* comparison, const string& name)
+       { cout << "failed to create " << name << endl; numCreateErrors++; }
+    void modifyError(const Comparison* comparison, const string& name)
+       { cout << "failed to modify " << name << endl; numModifyErrors++; }
+    void deleteError(const Comparison* comparison, const string& name)
+       { cout << "failed to delete " << name << endl; numDeleteErrors++; }
 };
 
 UndoCallbackImpl undo_callback_impl;