[gnome-contacts: 1/2] Contacts.Window: "Done" button actively grabs focus



commit cbae988280a6d6edbe4cb0658fdfeeddff7f2617
Author: Frank Zschage <frank reissan de>
Date:   Mon Sep 24 18:05:37 2018 +0200

    Contacts.Window: "Done" button actively grabs focus
    
    Some input fields, especially SpinButtons, do not update their internal buffer if they do not drop the 
focus. If you enter a number into a SpinButton input field without leaving it, press the "Done" button and 
the button does not gain the focus then, the newly entered value of the SpinButton gets lost. Hence the 
"Done" button gains the focus on click now.
    
    Fixes #82

 src/contacts-window.vala | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 04c2632..e517f27 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -211,9 +211,12 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     this.cancel_button.visible
         = this.done_button.visible
         = this.state.editing ();
-    if (this.state.editing ())
+    if (this.state.editing ()) {
       this.done_button.label = (this.state == UiState.CREATING)? _("Add") : _("Done");
-
+      // Cast is required because Gtk.Button.set_focus_on_click is deprecated and
+      // we have to use Gtk.Widget.set_focus_on_click instead
+      ((Widget) this.done_button).set_focus_on_click (true);
+    }
     // When selecting or editing, we get special headerbars
     if (this.state == UiState.SELECTING || this.state.editing ()) {
       this.left_header.get_style_context ().add_class ("selection-mode");


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