[gnome-boxes] properties: if edition change is not valid keep editing



commit 40f16411bda3e8ddfa34a446ce9f6fb3103874c7
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Wed Jul 18 19:14:07 2012 +0200

    properties: if edition change is not valid keep editing
    
    If changed cb throws a Boxes.INVALID error, keep editing the state. It
    can be cancelled/escaped with Escape key.
    
    We may want to have a (x) icon to indicate the error, that would need
    further discussion with UI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680187

 src/editable-entry.vala        |    2 +-
 src/i-properties-provider.vala |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/editable-entry.vala b/src/editable-entry.vala
index e4a6f3e..31689b8 100644
--- a/src/editable-entry.vala
+++ b/src/editable-entry.vala
@@ -116,7 +116,7 @@ private class Boxes.EditableEntry: Alignment {
         update_entry_font (entry);
     }
 
-    private void start_editing () {
+    public void start_editing () {
         notebook.page = Page.ENTRY;
     }
 
diff --git a/src/i-properties-provider.vala b/src/i-properties-provider.vala
index 068b780..ed8d78c 100644
--- a/src/i-properties-provider.vala
+++ b/src/i-properties-provider.vala
@@ -24,6 +24,8 @@ private interface Boxes.IPropertiesProvider: GLib.Object {
         entry.editing_done.connect (() => {
             try {
                 changed (entry.text);
+            } catch (Boxes.Error.INVALID error) {
+                entry.start_editing ();
             } catch (Boxes.Error error) {
                 warning (error.message);
             }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]