[Xfce4-commits] [apps/parole] 01/01: Add keyboard shortcuts helper to Parole

noreply at xfce.org noreply at xfce.org
Fri May 26 12:39:54 CEST 2017


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/parole.

commit b0763aeff02c4630ac8aeb2d4951f8b5a2b1c1e2
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Fri May 26 06:39:47 2017 -0400

    Add keyboard shortcuts helper to Parole
---
 data/interfaces/Makefile.am  |   6 +-
 data/interfaces/parole.ui    |  11 ++-
 data/interfaces/shortcuts.ui | 205 +++++++++++++++++++++++++++++++++++++++++++
 po/POTFILES.in               |   1 +
 src/Makefile.am              |   2 +
 src/parole-player.c          |   9 ++
 src/parole-shortcuts.c       | 105 ++++++++++++++++++++++
 src/parole-shortcuts.h       |  42 +++++++++
 8 files changed, 379 insertions(+), 2 deletions(-)

diff --git a/data/interfaces/Makefile.am b/data/interfaces/Makefile.am
index 5050dfa..887cee8 100644
--- a/data/interfaces/Makefile.am
+++ b/data/interfaces/Makefile.am
@@ -5,7 +5,8 @@ interfaces =					\
 	mediachooser.ui				\
 	save-playlist.ui			\
 	plugins.ui				\
-	open-location.ui
+	open-location.ui			\
+	shortcuts.ui
 
 interfaces_h = 					\
 	$(interfaces:.ui=_ui.h)
@@ -34,6 +35,9 @@ open-location_ui.h: open-location.ui
 plugins_ui.h: plugins.ui
 	xdt-csource --static --strip-comments --strip-content --name=plugins_ui $< > $@
 
+shortcuts_ui.h: shortcuts.ui
+	xdt-csource --static --strip-comments --strip-content --name=shortcuts_ui $< > $@
+
 endif
 
 DISTCLEANFILES =					\
diff --git a/data/interfaces/parole.ui b/data/interfaces/parole.ui
index fe36134..0cc0e7b 100644
--- a/data/interfaces/parole.ui
+++ b/data/interfaces/parole.ui
@@ -328,8 +328,8 @@
                         <property name="label" translatable="yes">Volume _Up</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="parole_player_volume_up" swapped="no"/>
-                        <accelerator key="equal" signal="activate"/>
                         <accelerator key="plus" signal="activate"/>
+                        <accelerator key="equal" signal="activate"/>
                       </object>
                     </child>
                     <child>
@@ -564,6 +564,15 @@
                       </object>
                     </child>
                     <child>
+                      <object class="GtkMenuItem" id="shortcuts">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">_Keyboard Shortcuts</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="parole_show_shortcuts" swapped="no"/>
+                      </object>
+                    </child>
+                    <child>
                       <object class="GtkMenuItem" id="contents">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
diff --git a/data/interfaces/shortcuts.ui b/data/interfaces/shortcuts.ui
new file mode 100644
index 0000000..8fb01e2
--- /dev/null
+++ b/data/interfaces/shortcuts.ui
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.17 -->
+
+  <object class="GtkShortcutsWindow" id="shortcuts">
+    <property name="modal">1</property>
+    <child>
+      <object class="GtkShortcutsSection">
+        <property name="visible">1</property>
+        <property name="section-name">shortcuts</property>
+        <property name="max-height">10</property>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="view">general</property>
+            <property name="title" translatable="yes">General</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator"><ctrl>O</property>
+                <property name="title" translatable="yes">Open file</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator"><ctrl>L</property>
+                <property name="title" translatable="yes">Open location</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator"><ctrl>Q <alt>F4</property>
+                <property name="title" translatable="yes">Quit</property>
+              </object>
+            </child>
+          </object>
+        </child>
+       <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="view">view</property>
+            <property name="title" translatable="yes">View</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">F F11</property>
+                <property name="title" translatable="yes">Toggle fullscreen</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Escape</property>
+                <property name="title" translatable="yes">Exit fullscreen</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator"><ctrl>M</property>
+                <property name="title" translatable="yes">Toggle menubar</property>
+              </object>
+            </child>
+          </object>
+        </child>
+		<child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="view">volume</property>
+            <property name="title" translatable="yes">Volume</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">plus equal</property>
+                <property name="title" translatable="yes">Increase volume</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">minus</property>
+                <property name="title" translatable="yes">Decrease volume</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">0</property>
+                <property name="title" translatable="yes">Mute</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="view">playlist</property>
+            <property name="title" translatable="yes">Playlist</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">F9</property>
+                <property name="title" translatable="yes">Toggle playlist</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Up</property>
+                <property name="title" translatable="yes">Select previous item</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Down</property>
+                <property name="title" translatable="yes">Select next item</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Delete</property>
+                <property name="title" translatable="yes">Remove selected item</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkShortcutsGroup">
+            <property name="visible">1</property>
+            <property name="view">playback</property>
+            <property name="title" translatable="yes">Playback</property>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">P space</property>
+                <property name="title" translatable="yes">Play/Pause</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">B</property>
+                <property name="title" translatable="yes">Previous track</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">N</property>
+                <property name="title" translatable="yes">Next track</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Left</property>
+                <property name="title" translatable="yes">Go back 10 seconds</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Right</property>
+                <property name="title" translatable="yes">Go forward 10 seconds</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator"><ctrl>Left</property>
+                <property name="title" translatable="yes">Go back 60 seconds</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator"><ctrl>Right</property>
+                <property name="title" translatable="yes">Go forward 60 seconds</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Page_Down</property>
+                <property name="title" translatable="yes">Go back 10 minutes</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">1</property>
+                <property name="accelerator">Page_Up</property>
+                <property name="title" translatable="yes">Go forward 10 minutes</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7d10a06..072ae90 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@
 [type: gettext/glade]data/interfaces/parole-settings.ui
 [type: gettext/glade]data/interfaces/save-playlist.ui
 [type: gettext/glade]data/interfaces/open-location.ui
+[type: gettext/glade]data/interfaces/shortcuts.ui
 data/desktop/org.xfce.Parole.desktop.in.in
 data/appdata/parole.appdata.xml.in
 src/common/parole-common.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d20013..21762bf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -64,6 +64,8 @@ parole_SOURCES =				\
 	parole-module.h				\
 	parole-about.c				\
 	parole-about.h				\
+	parole-shortcuts.c				\
+	parole-shortcuts.h				\
 	parole-builder.c			\
 	parole-builder.h			\
 	parole-subtitle-encoding.c		\
diff --git a/src/parole-player.c b/src/parole-player.c
index 672c560..a228a1b 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -50,6 +50,7 @@
 
 #include "parole-builder.h"
 #include "parole-about.h"
+#include "parole-shortcuts.h"
 
 #include "parole-player.h"
 #include "parole-gst.h"
@@ -263,6 +264,9 @@ parole_player_gst_widget_motion_notify_event        (GtkWidget *widget,
 void        parole_show_about                       (GtkWidget *widget,
                                                      ParolePlayer *player);
 
+void        parole_show_shortcuts                   (GtkWidget *widget,
+                                                     ParolePlayer *player);
+
 void        parole_player_set_audiotrack_radio_menu_item_selected(
                                                      ParolePlayer *player,
                                                      gint audio_index);
@@ -473,6 +477,11 @@ void parole_show_about  (GtkWidget *widget, ParolePlayer *player)
     parole_about (GTK_WINDOW (player->priv->window));
 }
 
+void parole_show_shortcuts  (GtkWidget *widget, ParolePlayer *player)
+{
+    parole_shortcuts (GTK_WIDGET (player->priv->window));
+}
+
 void ratio_none_toggled_cb (GtkWidget *widget, ParolePlayer *player)
 {
     g_object_set (G_OBJECT (player->priv->conf),
diff --git a/src/parole-shortcuts.c b/src/parole-shortcuts.c
new file mode 100644
index 0000000..7ac348f
--- /dev/null
+++ b/src/parole-shortcuts.c
@@ -0,0 +1,105 @@
+/*
+ * * Copyright (C) 2017 Sean Davis <smd.seandavis at gmail.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "parole-shortcuts.h"
+#include "parole-rc-utils.h"
+#include "parole-builder.h"
+
+#include "interfaces/shortcuts_ui.h"
+
+static void parole_shortcuts_finalize   (GObject *object);
+
+struct ParoleShortcuts
+{
+    GObject             parent;
+};
+
+struct ParoleShortcutsClass
+{
+    GObjectClass    parent_class;
+};
+
+G_DEFINE_TYPE (ParoleShortcuts, parole_shortcuts, G_TYPE_OBJECT)
+
+/*
+static void
+parole_shortcuts_close_cb (GtkShortcutsWindow *window, ParoleShortcuts *self)
+{
+    gtk_widget_destroy (GTK_WIDGET (window));
+}
+*/
+
+static void
+parole_shortcuts_class_init (ParoleShortcutsClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->finalize = parole_shortcuts_finalize;
+}
+
+static void
+parole_shortcuts_init (ParoleShortcuts *self)
+{
+}
+
+static void
+parole_shortcuts_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (parole_shortcuts_parent_class)->finalize (object);
+}
+
+ParoleShortcuts *parole_shortcuts (GtkWidget *parent)
+{
+    ParoleShortcuts *self;
+    GtkWidget *window;
+    GtkBuilder *builder;
+
+    self = g_object_new (PAROLE_TYPE_SHORTCUTS, NULL);
+
+    builder = parole_builder_new_from_string (shortcuts_ui, shortcuts_ui_length);
+
+    window = GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts"));
+
+    if ( parent )
+        gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));
+
+    gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ON_PARENT);
+
+    g_signal_connect (window, "delete-event",
+                      G_CALLBACK (gtk_widget_destroy), NULL);
+
+    g_signal_connect (window, "close",
+                      G_CALLBACK (gtk_widget_destroy), NULL);
+
+    gtk_widget_show_all (window);
+    g_object_unref (builder);
+
+    return self;
+}
diff --git a/src/parole-shortcuts.h b/src/parole-shortcuts.h
new file mode 100644
index 0000000..72a952d
--- /dev/null
+++ b/src/parole-shortcuts.h
@@ -0,0 +1,42 @@
+/*
+ * * Copyright (C) 2017 Sean Davis <smd.seandavis at gmail.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __PAROLE_SHORTCUTS_H
+#define __PAROLE_SHORTCUTS_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_SHORTCUTS       (parole_shortcuts_get_type () )
+#define PAROLE_SHORTCUTS(o)         (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_SHORTCUTS, ParoleShortcuts))
+#define PAROLE_IS_SHORTCUTS(o)      (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_SHORTCUTS))
+
+typedef struct ParoleShortcuts       ParoleShortcuts;
+typedef struct ParoleShortcutsClass  ParoleShortcutsClass;
+
+GType                parole_shortcuts_get_type   (void) G_GNUC_CONST;
+
+ParoleShortcuts     *parole_shortcuts            (GtkWidget *parent);
+
+G_END_DECLS
+
+#endif /* __PAROLE_SHORTCUTS_H */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list