[totem] main: Add shortcuts help window



commit 7f29f4d832d3610792cf335f3046833fb54b3854
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Nov 24 18:06:23 2015 +0100

    main: Add shortcuts help window
    
    It doesn't include shortcuts from optional plugins, yet.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=757831

 README              |   44 ++++----------------------------------------
 configure.ac        |    2 +-
 data/Makefile.am    |    3 ++-
 data/totem.ui       |    5 +++++
 po/POTFILES.in      |    1 +
 src/totem-menu.c    |    9 +++++++++
 src/totem-object.c  |   28 ++++++++++++++++++++++++++++
 src/totem-private.h |    2 ++
 8 files changed, 52 insertions(+), 42 deletions(-)
---
diff --git a/README b/README
index 0bdf806..2c557a2 100644
--- a/README
+++ b/README
@@ -29,48 +29,12 @@ gromit 20041213, for the Telestrator mode:
 Controls
 ========
 
-P, Ctrl+Space:
-       Play/Pause
-Escape (in full screen mode):
-       Switch to windowed mode
-Ctrl+F:
-       Toggle full screen
-Left arrow:
-       Go back 15 seconds
-Right arrow:
-       Go forward 60 seconds
-Shift+Left arrow:
-       Go back 5 seconds
-Shift+Right arrow:
-       Go forward 15 seconds
-Ctrl+Left arrow:
-       Go back 3 minutes
-Ctrl+Right arrow:
-       Go forward 10 minutes
-Up Arrow:
-       Increase the volume by 8%
-Down Arrow:
-       Decrease the volume by 8%
-Keypad Up / Keypad 8:
-       DVD Action Up
-Keypad Down / Keypad 2:
-       DVD Action Down
-Keypad Left / Keypad 4:
-       DVD Action Left
-Keypad Right / Keypad 6:
-       DVD Action Right
-B, Alt+Left arrow, Minus key:
-       Previous stream (Back)
-N, Alt+Right arrow, Plus key:
-       Next stream (Next)
+Ctrl+H:
+       Shortcut help
+
+Undocumented shortcuts:
 Ctrl+Q:
        Quit
-Ctrl+R, Ctrl+T:
-       Zoom in and zoom out, respectively
-Ctrl+0:
-       Reset the zoom level
-Ctrl+K:
-       Show the "Skip to" dialog
 Ctrl+D:
        Toggle drawing using Gromit
 Ctrl+E:
diff --git a/configure.ac b/configure.ac
index a8c16bd..7df12ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,7 @@ AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
 # Requirements
 GLIB_REQS=2.35.0
 GIO_REQS=2.27.92
-GTK_REQS=3.16.0
+GTK_REQS=3.19.3
 TOTEM_PLPARSER_REQS=3.10.1
 VALA_REQS=0.14.1
 PEAS_REQS=1.1.0
diff --git a/data/Makefile.am b/data/Makefile.am
index a22a1f2..db5920a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -19,7 +19,8 @@ stuff_DATA =                          \
        preferences.ui                  \
        properties.ui                   \
        uri.ui                          \
-       controls.ui
+       controls.ui                     \
+       shortcuts.ui
 EXTRA_DIST += $(stuff_DATA)
 
 # Icons
diff --git a/data/totem.ui b/data/totem.ui
index ed8197b..08160ff 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -14,6 +14,11 @@
        <section id="python-console-placeholder"/>
        <section>
                <item>
+                       <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+                       <attribute name="action">app.shortcuts</attribute>
+                       <attribute name="accel">&lt;Ctrl&gt;H</attribute>
+               </item>
+               <item>
                        <attribute name="label" translatable="yes">_Help</attribute>
                        <attribute name="action">app.help</attribute>
                        <attribute name="accel">F1</attribute>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9a6a3a2..0a2ef7e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,7 @@ data/org.gnome.Totem.desktop.in.in.in
 [type: gettext/glade]data/playlist.ui
 [type: gettext/glade]data/preferences.ui
 [type: gettext/glade]data/properties.ui
+[type: gettext/glade]data/shortcuts.ui
 [type: gettext/glade]data/totem.ui
 [type: gettext/glade]data/uri.ui
 src/backend/bacon-time-label.c
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 89a2142..dbb8e60 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -171,6 +171,14 @@ help_action_cb (GSimpleAction *action,
 }
 
 static void
+keyboard_shortcuts_action_cb (GSimpleAction *action,
+                             GVariant      *parameter,
+                             gpointer       user_data)
+{
+       totem_object_show_keyboard_shortcuts (TOTEM_OBJECT (user_data));
+}
+
+static void
 quit_action_cb (GSimpleAction *action,
                GVariant      *parameter,
                gpointer       user_data)
@@ -295,6 +303,7 @@ static GActionEntry app_entries[] = {
        { "fullscreen", toggle_action_cb, NULL, "false", fullscreen_change_state },
        { "preferences", preferences_action_cb, NULL, NULL, NULL },
        { "repeat", toggle_action_cb, NULL, "false", repeat_change_state },
+       { "shortcuts", keyboard_shortcuts_action_cb, NULL, NULL, NULL },
        { "help", help_action_cb, NULL, NULL, NULL },
        { "quit", quit_action_cb, NULL, NULL, NULL },
 
diff --git a/src/totem-object.c b/src/totem-object.c
index d04d93b..eb8cc7c 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -2190,6 +2190,27 @@ totem_object_show_help (TotemObject *totem)
        }
 }
 
+void
+totem_object_show_keyboard_shortcuts (TotemObject *totem)
+{
+       GtkBuilder *builder;
+
+       if (totem->shortcuts_win) {
+               gtk_window_present (totem->shortcuts_win);
+               return;
+       }
+
+       builder = totem_interface_load ("shortcuts.ui", FALSE, NULL, NULL);
+       totem->shortcuts_win = GTK_WINDOW (gtk_builder_get_object (builder, "shortcuts-totem"));
+       gtk_window_set_transient_for (totem->shortcuts_win, GTK_WINDOW (totem->win));
+
+       g_signal_connect (totem->shortcuts_win, "destroy",
+                         G_CALLBACK (gtk_widget_destroyed), &totem->shortcuts_win);
+
+       gtk_widget_show_all (GTK_WIDGET (totem->shortcuts_win));
+       g_object_unref (builder);
+}
+
 /* This is called in the main thread */
 static void
 totem_object_drop_files_finished (TotemPlaylist *playlist, GAsyncResult *result, TotemObject *totem)
@@ -3252,6 +3273,13 @@ totem_object_handle_key_press (TotemObject *totem, GdkEventKey *event)
        case GDK_KEY_G:
                totem_object_next_angle (totem);
                break;
+       case GDK_KEY_H:
+       case GDK_KEY_h:
+               totem_object_show_keyboard_shortcuts (totem);
+               break;
+       case GDK_KEY_question:
+               totem_object_show_keyboard_shortcuts (totem);
+               break;
        case GDK_KEY_M:
        case GDK_KEY_m:
                bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ROOT_MENU);
diff --git a/src/totem-private.h b/src/totem-private.h
index ac2ec7f..e844b8c 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -77,6 +77,7 @@ struct _TotemObject {
        BaconVideoWidget *bvw;
        GtkWidget *prefs;
        GtkBuilder *prefs_xml;
+       GtkWindow *shortcuts_win;
 
        GtkWidget *grilo;
 
@@ -171,6 +172,7 @@ void        totem_object_open_location              (Totem *totem);
 void   totem_object_eject                      (Totem *totem);
 void   totem_object_set_zoom                   (Totem *totem, gboolean zoom);
 void   totem_object_show_help                  (Totem *totem);
+void   totem_object_show_keyboard_shortcuts    (Totem *totem);
 void   totem_object_show_properties            (Totem *totem);
 void    totem_object_set_mrl                   (TotemObject *totem,
                                                 const char *mrl,


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