Pavel,

Is there a good reason to reload the buffer after the user presses cancel in the VC->register dialog ?

Would the attached patch make sense ?

Vincent
Index: src/LyXFunc.cpp
===================================================================
--- src/LyXFunc.cpp     (revision 27632)
+++ src/LyXFunc.cpp     (working copy)
@@ -1058,8 +1058,8 @@
                        if (!ensureBufferClean(view()) || buffer->isUnnamed())
                                break;
                        if (!buffer->lyxvc().inUse()) {
-                               buffer->lyxvc().registrer();
-                               reloadBuffer();
+                               if (buffer->lyxvc().registrer())
+                                       reloadBuffer();
                        }
                        updateFlags = Update::Force;
                        break;
Index: src/LyXVC.cpp
===================================================================
--- src/LyXVC.cpp       (revision 27632)
+++ src/LyXVC.cpp       (working copy)
@@ -91,7 +91,7 @@
 }
 
 
-void LyXVC::registrer()
+bool LyXVC::registrer()
 {
        FileName const filename = owner_->fileName();
 
@@ -100,7 +100,7 @@
                Alert::error(_("Document not saved"),
                             _("You must save the document "
                                            "before it can be registered."));
-               return;
+               return false;
        }
 
        // it is very likely here that the vcs is not created yet...
@@ -134,11 +134,12 @@
                        _("(no initial description)"));
        if (!ok) {
                LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
-               return;
+               return false;
        }
        if (response.empty())
                response = _("(no initial description)");
        vcs->registrer(to_utf8(response));
+       return true;
 }
 
 
Index: src/LyXVC.h
===================================================================
--- src/LyXVC.h (revision 27632)
+++ src/LyXVC.h (working copy)
@@ -65,7 +65,7 @@
        void setBuffer(Buffer *);
 
        /// Register the document as an VC file.
-       void registrer();
+       bool registrer();
 
        /// Unlock and commit changes. Returns log.
        std::string checkIn();

Reply via email to