[Xfce4-commits] <xfmpc:master> Add shortcuts dialog
Mike Massonnet
noreply at xfce.org
Sat Aug 13 10:54:11 CEST 2011
Updating branch refs/heads/master
to 2ac24d5b03a1135c8f098f899edbb24348b93e4b (commit)
from 022bbda173c650f86f99b04ac87fa6e3634340d7 (commit)
commit 2ac24d5b03a1135c8f098f899edbb24348b93e4b
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Sat Aug 13 10:51:52 2011 +0200
Add shortcuts dialog
Show list of available shortcuts in a small dialog.
Add menu item in context menu with item "Shortcuts" to bring the dialog up.
src/Makefile.am | 1 +
src/extended-interface.vala | 9 +++++
src/shortcuts-dialog.vala | 75 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 68ad1db..33f306d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,6 +9,7 @@ INCLUDES = \
bin_PROGRAMS = xfmpc
xfmpc_SOURCES = \
+ shortcuts-dialog.vala \
preferences-dialog.vala \
song-dialog.vala \
statusbar.vala \
diff --git a/src/extended-interface.vala b/src/extended-interface.vala
index 8db7fef..90d8aa5 100644
--- a/src/extended-interface.vala
+++ b/src/extended-interface.vala
@@ -186,6 +186,10 @@ namespace Xfmpc {
imi.activate.connect (cb_preferences);
this.context_menu.append (imi);
+ var mi = new Gtk.MenuItem.with_mnemonic (_("_Shortcuts"));
+ mi.activate.connect (cb_shortcuts);
+ this.context_menu.append (mi);
+
imi = new Gtk.ImageMenuItem.from_stock (Gtk.STOCK_ABOUT, null);
imi.activate.connect (cb_about);
this.context_menu.append (imi);
@@ -254,6 +258,11 @@ namespace Xfmpc {
dialog.show ();
}
+ private void cb_shortcuts () {
+ var dialog = new Xfmpc.ShortcutsDialog ();
+ dialog.show();
+ }
+
private void cb_about () {
string[] authors = {"Mike Massonnet <mmassonnet at xfce.org>",
"Vincent Legout <vincent at xfce.org>"};
diff --git a/src/shortcuts-dialog.vala b/src/shortcuts-dialog.vala
new file mode 100644
index 0000000..61e40d7
--- /dev/null
+++ b/src/shortcuts-dialog.vala
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011 Mike Massonnet <mmassonnet at xfce.org>
+ * Copyright (c) 2011 Vincent Legout <vincent at xfce.org>
+ *
+ * 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.
+ */
+
+namespace Xfmpc {
+
+ public class ShortcutsDialog : Xfce.TitledDialog {
+
+ construct {
+ this.has_separator = true;
+ this.skip_taskbar_hint = true;
+ this.icon_name = "stock_volume";
+ this.resizable = false;
+ this.title = _("Xfmpc Shortcuts");
+ this.subtitle = _("Control your MPD client with your keyboard");
+
+ add_button (Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE);
+ this.response.connect ((response) => {
+ switch (response) {
+ case Gtk.ResponseType.CLOSE:
+ destroy ();
+ break;
+ }
+ });
+
+ var content_area = (Gtk.VBox)get_content_area ();
+
+ var vbox = new Gtk.VBox (true, 6);
+ vbox.set_border_width (6);
+ content_area.add (vbox);
+
+ /* Shortcuts labels */
+ var label = new Gtk.Label (_("Quit: CTRL+q"));
+ label.set_alignment (0.0f, 0.5f);
+ vbox.add (label);
+
+ label = new Gtk.Label (_("Previous: CTRL+b"));
+ label.set_alignment (0.0f, 0.5f);
+ vbox.add (label);
+
+ label = new Gtk.Label (_("Play/Pause: CTRL+p"));
+ label.set_alignment (0.0f, 0.5f);
+ vbox.add (label);
+
+ label = new Gtk.Label (_("Stop: CTRL+s"));
+ label.set_alignment (0.0f, 0.5f);
+ vbox.add (label);
+
+ label = new Gtk.Label (_("Next: CTRL+f"));
+ label.set_alignment (0.0f, 0.5f);
+ vbox.add (label);
+
+ label = new Gtk.Label (_("Volume: CTRL+v"));
+ label.set_alignment (0.0f, 0.5f);
+ vbox.add (label);
+
+ show_all ();
+ }
+ }
+}
More information about the Xfce4-commits
mailing list