gtk-demo: Add another shortcuts window example

The boxes shortcuts, taken straight from boxes.
This demonstrates a problem with view filtering.
This commit is contained in:
Matthias Clasen 2015-12-15 18:39:39 -05:00
parent 2bb80a9bb2
commit 5d3f28192c
4 changed files with 210 additions and 0 deletions

View File

@ -96,6 +96,7 @@
<file>shortcuts-builder.ui</file>
<file>shortcuts-gedit.ui</file>
<file>shortcuts-clocks.ui</file>
<file>shortcuts-boxes.ui</file>
</gresource>
<gresource prefix="/revealer">
<file>revealer.ui</file>

View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-boxes">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="section-name">shortcuts</property>
<property name="max-height">12</property>
<!-- Overview shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Overview</property>
<property name="view">overview</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F1</property>
<property name="title" translatable="yes">Help</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;n</property>
<property name="title" translatable="yes">Create a new box</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;f</property>
<property name="title" translatable="yes">Search</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;k</property>
<property name="title" translatable="yes">Keyboard shortcuts</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;q</property>
<property name="title" translatable="yes">Close Window/Quit Boxes</property>
</object>
</child>
</object>
</child>
<!-- Wizard and Properties shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Box Creation and Properties</property>
<property name="view">wizard</property>
<!-- LTR -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">ltr</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
<property name="title" translatable="yes">Switch to the next page</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">ltr</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Switch to the previous page</property>
</object>
</child>
<!-- RTL -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">rtl</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Switch to the next page</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">rtl</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
<property name="title" translatable="yes">Switch to the previous page</property>
</object>
</child>
</object>
</child>
<!-- Display shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Box Display</property>
<property name="view">display</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Control_L+Alt_L</property>
<property name="title" translatable="yes">Grab/Ungrab keyboard</property>
</object>
</child>
<!-- LTR -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">ltr</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Back to overview</property>
</object>
</child>
<!-- RTL -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">rtl</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
<property name="title" translatable="yes">Back to overview</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;q</property>
<property name="title" translatable="yes">Close window/Quit Boxes</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F11</property>
<property name="title" translatable="yes">Fullscreen/Restore from fullscreen</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -49,6 +49,24 @@ clocks_shortcuts_stopwatch (GtkWidget *window)
show_shortcuts (window, "shortcuts-clocks", "stopwatch");
}
static void
boxes_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", NULL);
}
static void
boxes_shortcuts_wizard (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", "wizard");
}
static void
boxes_shortcuts_display (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", "display");
}
GtkWidget *
do_shortcuts (GtkWidget *do_widget)
{
@ -73,6 +91,9 @@ do_shortcuts (GtkWidget *do_widget)
"gedit_shortcuts", G_CALLBACK (gedit_shortcuts),
"clocks_shortcuts", G_CALLBACK (clocks_shortcuts),
"clocks_shortcuts_stopwatch", G_CALLBACK (clocks_shortcuts_stopwatch),
"boxes_shortcuts", G_CALLBACK (boxes_shortcuts),
"boxes_shortcuts_wizard", G_CALLBACK (boxes_shortcuts_wizard),
"boxes_shortcuts_display", G_CALLBACK (boxes_shortcuts_display),
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));

View File

@ -38,6 +38,27 @@
<signal name="clicked" handler="clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Boxes</property>
<signal name="clicked" handler="boxes_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Boxes - Wizard</property>
<signal name="clicked" handler="boxes_shortcuts_wizard" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Boxes - Display</property>
<signal name="clicked" handler="boxes_shortcuts_display" swapped="1" object="window1"/>
</object>
</child>
</object>
</child>
</object>