[gnome-clocks] Focus on the start button for timer and stopwatch



commit 3489640c41b822fb9f4fb175c7caaad10358fb1d
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Apr 15 09:03:08 2013 +0200

    Focus on the start button for timer and stopwatch
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=682232
    Based on a patch by Andrea Basso <voluntatefaber gmail com>

 src/stopwatch.vala | 4 ++++
 src/timer.vala     | 6 ++++++
 src/window.vala    | 1 +
 3 files changed, 11 insertions(+)
---
diff --git a/src/stopwatch.vala b/src/stopwatch.vala
index 7620cea..030782e 100644
--- a/src/stopwatch.vala
+++ b/src/stopwatch.vala
@@ -228,6 +228,10 @@ public class MainPanel : Gtk.Box, Clocks.Clock {
 
         return true;
     }
+
+    public override void grab_focus () {
+        left_button.grab_focus ();
+    }
 }
 
 } // namespace Stopwatch
diff --git a/src/timer.vala b/src/timer.vala
index 91d71d7..1ca4ee1 100644
--- a/src/timer.vala
+++ b/src/timer.vala
@@ -226,6 +226,12 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
         // Note that the format uses unicode RATIO character
         time_label.set_text ("%02i∶%02i∶%02i".printf (h, m, s));
     }
+
+    public override void grab_focus () {
+        if (visible_child == setup_panel) {
+            start_button.grab_focus ();
+        }
+    }
 }
 
 } // namespace Timer
diff --git a/src/window.vala b/src/window.vala
index eca549c..180a2d6 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -156,6 +156,7 @@ public class Window : Gtk.ApplicationWindow {
         var clock = (Clock) stack.visible_child;
         if (clock != null) {
             clock.update_header_bar ();
+            ((Gtk.Widget) clock).grab_focus ();
         }
     }
 }


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