[gtk/better-font-rendering-demo: 5/6] gtk-demo: Font rendering - Add keynav
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/better-font-rendering-demo: 5/6] gtk-demo: Font rendering - Add keynav
- Date: Sun, 5 Sep 2021 03:06:08 +0000 (UTC)
commit b718d99d1fe19299df30a459445c3a2e15aadd9b
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Sep 4 22:30:54 2021 -0400
gtk-demo: Font rendering - Add keynav
Add mnemonics to most controls, and make
Ctrl+/- change the zoom.
demos/gtk-demo/fontrendering.c | 14 +++++++++----
demos/gtk-demo/fontrendering.ui | 45 +++++++++++++++++++++++++++++++++--------
2 files changed, 47 insertions(+), 12 deletions(-)
---
diff --git a/demos/gtk-demo/fontrendering.c b/demos/gtk-demo/fontrendering.c
index f5bb8957b5..0901de0fb9 100644
--- a/demos/gtk-demo/fontrendering.c
+++ b/demos/gtk-demo/fontrendering.c
@@ -288,20 +288,26 @@ update_buttons (void)
gtk_widget_set_sensitive (down_button, scale > 1);
}
-static void
-scale_up (void)
+static gboolean
+scale_up (GtkWidget *widget,
+ GVariant *args,
+ gpointer user_data)
{
scale += 1;
update_buttons ();
update_image ();
+ return TRUE;
}
-static void
-scale_down (void)
+static gboolean
+scale_down (GtkWidget *widget,
+ GVariant *args,
+ gpointer user_data)
{
scale -= 1;
update_buttons ();
update_image ();
+ return TRUE;
}
GtkWidget *
diff --git a/demos/gtk-demo/fontrendering.ui b/demos/gtk-demo/fontrendering.ui
index c6eb48d5a3..44b65c9a19 100644
--- a/demos/gtk-demo/fontrendering.ui
+++ b/demos/gtk-demo/fontrendering.ui
@@ -83,7 +83,8 @@
</child>
<child>
<object class="GtkCheckButton" id="show_pixels">
- <property name="label">Show Pixels</property>
+ <property name="label">Show _Pixels</property>
+ <property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">3</property>
@@ -93,7 +94,8 @@
</child>
<child>
<object class="GtkCheckButton" id="show_outlines">
- <property name="label">Show Outline</property>
+ <property name="label">Show _Outline</property>
+ <property name="use-underline">1</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
@@ -105,8 +107,9 @@
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
- <property name="label">Hinting</property>
- <property name="xalign">1</property>
+ <property name="label">_Hinting</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">hinting</property>
<style>
<class name="dim-label"/>
</style>
@@ -132,7 +135,8 @@
</child>
<child>
<object class="GtkCheckButton" id="antialias">
- <property name="label">Antialias</property>
+ <property name="label">_Antialias</property>
+ <property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">4</property>
@@ -142,7 +146,8 @@
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
- <property name="label">Hint Metrics</property>
+ <property name="label">Hint _Metrics</property>
+ <property name="use-underline">1</property>
<layout>
<property name="column">5</property>
<property name="row">1</property>
@@ -151,7 +156,8 @@
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
- <property name="label">Show Extents</property>
+ <property name="label">Show _Extents</property>
+ <property name="use-underline">1</property>
<layout>
<property name="column">6</property>
<property name="row">0</property>
@@ -160,7 +166,8 @@
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
- <property name="label">Show Grid</property>
+ <property name="label">Show _Grid</property>
+ <property name="use-underline">1</property>
<layout>
<property name="column">6</property>
<property name="row">1</property>
@@ -173,6 +180,17 @@
<style>
<class name="circular"/>
</style>
+ <child>
+ <object class="GtkShortcutController">
+ <property name="scope">managed</property>
+ <child>
+ <object class="GtkShortcut">
+ <property name="trigger"><Control>plus</property>
+ <property name="action">activate</property>
+ </object>
+ </child>
+ </object>
+ </child>
<layout>
<property name="column">7</property>
<property name="row">0</property>
@@ -185,6 +203,17 @@
<style>
<class name="circular"/>
</style>
+ <child>
+ <object class="GtkShortcutController">
+ <property name="scope">managed</property>
+ <child>
+ <object class="GtkShortcut">
+ <property name="trigger"><Control>minus</property>
+ <property name="action">activate</property>
+ </object>
+ </child>
+ </object>
+ </child>
<layout>
<property name="column">7</property>
<property name="row">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]