[gthumb: 3/5] media viewer: added commands to go back/forward one second




commit c61e9e7c66d40789b2097aaad51b33bac824cb04
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Aug 8 20:06:49 2020 +0200

    media viewer: added commands to go back/forward one second

 extensions/gstreamer_tools/actions.c               | 24 +++++++++++
 extensions/gstreamer_tools/actions.h               |  2 +
 extensions/gstreamer_tools/callbacks.c             |  2 +
 extensions/gstreamer_tools/data/ui/mediabar.ui     | 48 +++++++++++++++++-----
 extensions/gstreamer_tools/gth-media-viewer-page.c | 27 ++++++++++++
 5 files changed, 93 insertions(+), 10 deletions(-)
---
diff --git a/extensions/gstreamer_tools/actions.c b/extensions/gstreamer_tools/actions.c
index 08e30d1de..13467e162 100644
--- a/extensions/gstreamer_tools/actions.c
+++ b/extensions/gstreamer_tools/actions.c
@@ -271,6 +271,18 @@ gth_browser_activate_next_video_frame (GSimpleAction       *action,
 }
 
 
+void
+gth_browser_activate_skip_forward_smallest (GSimpleAction      *action,
+                                           GVariant            *state,
+                                           gpointer             user_data)
+{
+       GthBrowser         *browser = GTH_BROWSER (user_data);
+       GthMediaViewerPage *page = GTH_MEDIA_VIEWER_PAGE (gth_browser_get_viewer_page (browser));;
+
+       gth_media_viewer_page_skip (page, 1);
+}
+
+
 void
 gth_browser_activate_skip_forward_smaller (GSimpleAction       *action,
                                           GVariant             *state,
@@ -319,6 +331,18 @@ gth_browser_activate_skip_forward_bigger (GSimpleAction    *action,
 }
 
 
+void
+gth_browser_activate_skip_back_smallest (GSimpleAction *action,
+                                        GVariant               *state,
+                                        gpointer                user_data)
+{
+       GthBrowser         *browser = GTH_BROWSER (user_data);
+       GthMediaViewerPage *page = GTH_MEDIA_VIEWER_PAGE (gth_browser_get_viewer_page (browser));;
+
+       gth_media_viewer_page_skip (page, -1);
+}
+
+
 void
 gth_browser_activate_skip_back_smaller (GSimpleAction  *action,
                                        GVariant                *state,
diff --git a/extensions/gstreamer_tools/actions.h b/extensions/gstreamer_tools/actions.h
index aa807c05a..2a7d966c6 100644
--- a/extensions/gstreamer_tools/actions.h
+++ b/extensions/gstreamer_tools/actions.h
@@ -31,10 +31,12 @@ DEF_ACTION_CALLBACK (gth_browser_activate_play_faster)
 DEF_ACTION_CALLBACK (gth_browser_activate_play_slower)
 DEF_ACTION_CALLBACK (gth_browser_activate_video_zoom_fit)
 DEF_ACTION_CALLBACK (gth_browser_activate_next_video_frame)
+DEF_ACTION_CALLBACK (gth_browser_activate_skip_forward_smallest)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_forward_smaller)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_forward_small)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_forward_big)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_forward_bigger)
+DEF_ACTION_CALLBACK (gth_browser_activate_skip_back_smallest)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_back_smaller)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_back_small)
 DEF_ACTION_CALLBACK (gth_browser_activate_skip_back_big)
diff --git a/extensions/gstreamer_tools/callbacks.c b/extensions/gstreamer_tools/callbacks.c
index 38b400174..d50efdbf4 100644
--- a/extensions/gstreamer_tools/callbacks.c
+++ b/extensions/gstreamer_tools/callbacks.c
@@ -35,10 +35,12 @@ static const GthShortcut shortcuts[] = {
        { "play-faster", N_("Play faster"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, 
"plus" },
        { "play-slower", N_("Play slower"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, 
"minus" },
        { "next-frame", N_("Next frame"), GTH_SHORTCUT_CONTEXT_VIEWER, GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, 
"period" },
+       { "skip-forward-smallest", N_("Go forward 1 second"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, NULL },
        { "skip-forward-smaller", N_("Go forward 5 seconds"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Shift>Right" },
        { "skip-forward-small", N_("Go forward 10 seconds"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Alt>Right" },
        { "skip-forward-big", N_("Go forward 1 minute"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Primary>Right" },
        { "skip-forward-bigger", N_("Go forward 5 minutes"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Primary><Alt>Right" },
+       { "skip-back-smallest", N_("Go back 1 second"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, NULL },
        { "skip-back-smaller", N_("Go back 5 seconds"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Shift>Left" },
        { "skip-back-small", N_("Go back 10 seconds"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Alt>Left" },
        { "skip-back-big", N_("Go back 1 minute"), GTH_SHORTCUT_CONTEXT_VIEWER, 
GTH_SHORTCUT_CATEGORY_MEDIA_VIEWER, "<Primary>Left" },
diff --git a/extensions/gstreamer_tools/data/ui/mediabar.ui b/extensions/gstreamer_tools/data/ui/mediabar.ui
index 2135133b7..064581b7b 100644
--- a/extensions/gstreamer_tools/data/ui/mediabar.ui
+++ b/extensions/gstreamer_tools/data/ui/mediabar.ui
@@ -288,7 +288,7 @@ audio-volume-medium-symbolic</property>
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">1</property>
-            <property name="width">4</property>
+            <property name="width">5</property>
           </packing>
         </child>
         <child>
@@ -301,7 +301,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
+            <property name="left_attach">1</property>
             <property name="top_attach">0</property>
           </packing>
         </child>
@@ -315,7 +315,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">1</property>
+            <property name="left_attach">2</property>
             <property name="top_attach">0</property>
           </packing>
         </child>
@@ -329,7 +329,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">2</property>
+            <property name="left_attach">3</property>
             <property name="top_attach">0</property>
           </packing>
         </child>
@@ -343,7 +343,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">3</property>
+            <property name="left_attach">4</property>
             <property name="top_attach">0</property>
           </packing>
         </child>
@@ -357,7 +357,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">0</property>
+            <property name="left_attach">1</property>
             <property name="top_attach">2</property>
           </packing>
         </child>
@@ -371,7 +371,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">1</property>
+            <property name="left_attach">2</property>
             <property name="top_attach">2</property>
           </packing>
         </child>
@@ -385,7 +385,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">2</property>
+            <property name="left_attach">3</property>
             <property name="top_attach">2</property>
           </packing>
         </child>
@@ -399,7 +399,7 @@ audio-volume-medium-symbolic</property>
             <property name="relief">none</property>
           </object>
           <packing>
-            <property name="left_attach">3</property>
+            <property name="left_attach">4</property>
             <property name="top_attach">2</property>
           </packing>
         </child>
@@ -432,11 +432,39 @@ audio-volume-medium-symbolic</property>
             </child>
           </object>
           <packing>
-            <property name="left_attach">4</property>
+            <property name="left_attach">5</property>
             <property name="top_attach">0</property>
             <property name="height">3</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkButton" id="skip_back_smallest_button">
+            <property name="label" translatable="yes" comments="minus 1 second">-1s</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="tooltip_text" translatable="yes">Go back 1 second</property>
+            <property name="relief">none</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="skip_forward_smallest_button">
+            <property name="label" translatable="yes" comments="plus 1 second">+1s</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="tooltip_text" translatable="yes">Go forward 1 second</property>
+            <property name="relief">none</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
       </object>
     </child>
   </object>
diff --git a/extensions/gstreamer_tools/gth-media-viewer-page.c 
b/extensions/gstreamer_tools/gth-media-viewer-page.c
index 90a1c14f8..91c775999 100644
--- a/extensions/gstreamer_tools/gth-media-viewer-page.c
+++ b/extensions/gstreamer_tools/gth-media-viewer-page.c
@@ -97,10 +97,12 @@ static const GActionEntry actions[] = {
        { "play-faster", gth_browser_activate_play_faster },
        { "play-slower", gth_browser_activate_play_slower },
        { "next-frame", gth_browser_activate_next_video_frame },
+       { "skip-forward-smallest", gth_browser_activate_skip_forward_smallest },
        { "skip-forward-smaller", gth_browser_activate_skip_forward_smaller },
        { "skip-forward-small", gth_browser_activate_skip_forward_small },
        { "skip-forward-big", gth_browser_activate_skip_forward_big },
        { "skip-forward-bigger", gth_browser_activate_skip_forward_bigger },
+       { "skip-back-smallest", gth_browser_activate_skip_back_smallest },
        { "skip-back-smaller", gth_browser_activate_skip_back_smaller },
        { "skip-back-small", gth_browser_activate_skip_back_small },
        { "skip-back-big", gth_browser_activate_skip_back_big },
@@ -945,6 +947,22 @@ skip_back_smaller_button_clicked_cb (GtkButton *button,
 }
 
 
+static void
+skip_back_smallest_button_clicked_cb (GtkButton *button,
+                                     gpointer   user_data)
+{
+       gth_media_viewer_page_skip (GTH_MEDIA_VIEWER_PAGE (user_data), -1);
+}
+
+
+static void
+skip_forward_smallest_button_clicked_cb (GtkButton *button,
+                                        gpointer   user_data)
+{
+       gth_media_viewer_page_skip (GTH_MEDIA_VIEWER_PAGE (user_data), 1);
+}
+
+
 static void
 skip_forward_smaller_button_clicked_cb (GtkButton *button,
                                        gpointer   user_data)
@@ -952,6 +970,7 @@ skip_forward_smaller_button_clicked_cb (GtkButton *button,
        gth_media_viewer_page_skip (GTH_MEDIA_VIEWER_PAGE (user_data), 5);
 }
 
+
 static void
 skip_forward_small_button_clicked_cb (GtkButton *button,
                                      gpointer   user_data)
@@ -1121,6 +1140,14 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
                          "clicked",
                          G_CALLBACK (skip_back_smaller_button_clicked_cb),
                          self);
+       g_signal_connect (GET_WIDGET ("skip_back_smallest_button"),
+                         "clicked",
+                         G_CALLBACK (skip_back_smallest_button_clicked_cb),
+                         self);
+       g_signal_connect (GET_WIDGET ("skip_forward_smallest_button"),
+                         "clicked",
+                         G_CALLBACK (skip_forward_smallest_button_clicked_cb),
+                         self);
        g_signal_connect (GET_WIDGET ("skip_forward_smaller_button"),
                          "clicked",
                          G_CALLBACK (skip_forward_smaller_button_clicked_cb),


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