[totem/wip/hadess/track-lists: 7/7] main: Add Shift+V to toggle subtitles




commit b3c9ded43e602a279651377677edc03dd27c1609
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Feb 11 18:23:25 2022 +0100

    main: Add Shift+V to toggle subtitles
    
    Closes: #130

 data/shortcuts.ui  | 28 ++++++++++++++++++++--------
 src/totem-object.c |  5 ++++-
 2 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/data/shortcuts.ui b/data/shortcuts.ui
index dfad70605..767d1abac 100644
--- a/data/shortcuts.ui
+++ b/data/shortcuts.ui
@@ -142,13 +142,6 @@
                 <property name="title" translatable="yes" context="shortcut window">Next video or 
chapter</property>
               </object>
             </child>
-            <child>
-              <object class="GtkShortcutsShortcut" id="cycle-subtitle">
-                <property name="visible">1</property>
-                <property name="accelerator">V</property>
-                <property name="title" translatable="yes" context="shortcut window">Select next 
Subtitle</property>
-              </object>
-            </child>
           </object>
         </child>
         <child>
@@ -308,7 +301,26 @@
             </child>
           </object>
         </child>
-
+        <child>
+          <object class="GtkShortcutsGroup" id="subtitles-menu">
+            <property name="visible">1</property>
+            <property name="title" translatable="yes" context="shortcut window">Subtitles</property>
+            <child>
+              <object class="GtkShortcutsShortcut" id="cycle-subtitle">
+                <property name="visible">1</property>
+                <property name="accelerator">V</property>
+                <property name="title" translatable="yes" context="shortcut window">Select next 
subtitle</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut" id="cycle-subtitle">
+                <property name="visible">1</property>
+                <property name="accelerator">&lt;Shift&gt;V</property>
+                <property name="title" translatable="yes" context="shortcut window">Toggle 
subtitles</property>
+              </object>
+            </child>
+          </object>
+        </child>
       </object>
     </child>
   </object>
diff --git a/src/totem-object.c b/src/totem-object.c
index c242baf06..5da970f69 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -3521,7 +3521,10 @@ totem_object_handle_key_press (TotemObject *totem, GdkEventKey *event)
        case GDK_KEY_Subtitle:
        case GDK_KEY_V:
        case GDK_KEY_v:
-               bacon_video_widget_set_next_subtitle (totem->bvw);
+               if (mask == GDK_SHIFT_MASK)
+                       bacon_video_toggle_subtitles (totem->bvw);
+               else
+                       bacon_video_widget_set_next_subtitle (totem->bvw);
                break;
        case GDK_KEY_t:
        case GDK_KEY_T:


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