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



commit 6edf341a7782e710e414f37921e92a76a2750602
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 59c6d8b..3ac4cc0 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -209,9 +209,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]