[gnome-sound-recorder/bilelmoussaoui/better-shortcuts: 5/11] row: properly grab focus on play/pause




commit 3fdcf39ee79f9abcef15b1fdd9a7cbec2f23bf8e
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Wed Sep 9 15:30:13 2020 +0200

    row: properly grab focus on play/pause

 data/ui/row.ui | 4 ++--
 src/row.js     | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/row.ui b/data/ui/row.ui
index 5cf6b46..9a60ffe 100644
--- a/data/ui/row.ui
+++ b/data/ui/row.ui
@@ -327,7 +327,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <child>
-                              <object class="GtkButton">
+                              <object class="GtkButton" id="playBtn">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="valign">center</property>
@@ -353,7 +353,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkButton">
+                              <object class="GtkButton" id="pauseBtn">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="valign">center</property>
diff --git a/src/row.js b/src/row.js
index 48aa32f..e33e8d2 100644
--- a/src/row.js
+++ b/src/row.js
@@ -13,7 +13,7 @@ var Row = GObject.registerClass({
     InternalChildren: [
         'playbackStack', 'mainStack', 'waveformStack', 'rightStack',
         'name', 'entry', 'date', 'duration', 'revealer', 'playbackControls',
-        'saveBtn',
+        'saveBtn', 'playBtn', 'pauseBtn',
     ],
     Signals: {
         'play': { param_types: [GObject.TYPE_STRING] },
@@ -210,10 +210,12 @@ var Row = GObject.registerClass({
         case RowState.PLAYING:
             this.actionGroup.lookup('play').enabled = false;
             this._playbackStack.visible_child_name = 'pause';
+            this._pauseBtn.grab_focus();
             break;
         case RowState.PAUSED:
             this.actionGroup.lookup('play').enabled = true;
             this._playbackStack.visible_child_name = 'play';
+            this._playBtn.grab_focus();
             break;
         }
     }


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