[gtk/matthiasc/for-master: 2/2] gtk-builder-tool: Replace can-focus with focusable
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 2/2] gtk-builder-tool: Replace can-focus with focusable
- Date: Sat, 5 Jun 2021 21:57:56 +0000 (UTC)
commit 98d2320c93ea29bcf16a45ad366bd4506a42ad08
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 5 17:56:35 2021 -0400
gtk-builder-tool: Replace can-focus with focusable
The focusable property has the meaning that can-focus had
in GTK 3.
Update tests, and mention this in the migration guide.
Fixes: #3638
docs/reference/gtk/migrating-3to4.md | 3 +
testsuite/tools/simplify-data-3to4/box.expected | 78 ++++++++++++++++++++++--
testsuite/tools/simplify-data-3to4/grid.expected | 5 ++
tools/gtk-builder-tool-simplify.c | 1 +
4 files changed, 81 insertions(+), 6 deletions(-)
---
diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md
index 52b22fd847..9bc982962a 100644
--- a/docs/reference/gtk/migrating-3to4.md
+++ b/docs/reference/gtk/migrating-3to4.md
@@ -604,6 +604,9 @@ from `FALSE` to `TRUE`. In addition, there is a [property@Gtk.Widget:focusable]
property, which controls whether an individual widget can receive
the input focus.
+The `gtk4-builder-tool` utility, when called with the `--3to4` option of the
+`simplify` command, will replace `:can-focus` by `:focusable`.
+
The feature to automatically keep the focus widget scrolled into view with
`gtk_container_set_focus_vadjustment()` has been removed together with
`GtkContainer`, and is provided by scrollable widgets instead. In the common
diff --git a/testsuite/tools/simplify-data-3to4/box.expected b/testsuite/tools/simplify-data-3to4/box.expected
index 3d452aca8b..29c80079b0 100644
--- a/testsuite/tools/simplify-data-3to4/box.expected
+++ b/testsuite/tools/simplify-data-3to4/box.expected
@@ -4,15 +4,12 @@
<object class="GtkWindow">
<property name="child">
<object class="GtkBox">
- <property name="can_focus">0</property>
<child>
<object class="GtkBox">
<property name="hexpand">1</property>
- <property name="can_focus">0</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
- <property name="can_focus">0</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="vexpand">0</property>
@@ -20,12 +17,14 @@
<object class="GtkButton">
<property name="halign">center</property>
<property name="label" translatable="yes">_</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">F</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -34,6 +33,7 @@
<property name="halign">center</property>
<property name="hexpand">1</property>
<property name="label" translatable="yes">E</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -41,6 +41,7 @@
<object class="GtkButton">
<property name="hexpand">1</property>
<property name="label" translatable="yes">FE</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -56,12 +57,14 @@
<object class="GtkButton">
<property name="halign">center</property>
<property name="label" translatable="yes">_</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">F</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -70,6 +73,7 @@
<property name="halign">center</property>
<property name="hexpand">1</property>
<property name="label" translatable="yes">E</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -77,6 +81,7 @@
<object class="GtkButton">
<property name="hexpand">1</property>
<property name="label" translatable="yes">FE</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -94,12 +99,14 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">_</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">F</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -108,6 +115,7 @@
<property name="valign">center</property>
<property name="vexpand">1</property>
<property name="label" translatable="yes">E</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -115,6 +123,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">FE</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -122,7 +131,6 @@
</child>
<child>
<object class="GtkBox">
- <property name="can_focus">0</property>
<property name="hexpand">0</property>
<property name="vexpand">1</property>
<property name="orientation">vertical</property>
@@ -130,12 +138,14 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">_I</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -144,6 +154,7 @@
<property name="valign">center</property>
<property name="vexpand">1</property>
<property name="label" translatable="yes">EI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
@@ -151,12 +162,14 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">FEI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_S</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -164,6 +177,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FS</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">start</property>
</object>
@@ -172,6 +186,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">ES</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -180,6 +195,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">FES</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">start</property>
</object>
@@ -187,6 +203,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_N</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -194,6 +211,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">end</property>
</object>
@@ -202,6 +220,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">EN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -210,6 +229,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">FEN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">end</property>
</object>
@@ -217,6 +237,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_C</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -224,6 +245,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -232,6 +254,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">EC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -240,6 +263,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">FEC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -247,6 +271,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_B</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -254,6 +279,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">baseline</property>
</object>
@@ -262,6 +288,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">EB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
</object>
@@ -270,6 +297,7 @@
<object class="GtkButton">
<property name="vexpand">1</property>
<property name="label" translatable="yes">FEB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">baseline</property>
</object>
@@ -278,7 +306,6 @@
</child>
<child>
<object class="GtkBox">
- <property name="can_focus">0</property>
<property name="hexpand">0</property>
<property name="vexpand">1</property>
<property name="orientation">vertical</property>
@@ -286,6 +313,7 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">_I</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">0</property>
</object>
@@ -293,6 +321,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">0</property>
</object>
@@ -301,6 +330,7 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">EI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">1</property>
</object>
@@ -308,6 +338,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">1</property>
</object>
@@ -315,6 +346,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_S</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">0</property>
@@ -323,6 +355,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FS</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">start</property>
<property name="vexpand">0</property>
@@ -331,6 +364,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">ES</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -339,6 +373,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FES</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">start</property>
<property name="vexpand">1</property>
@@ -347,6 +382,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_N</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">0</property>
@@ -355,6 +391,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">end</property>
<property name="vexpand">0</property>
@@ -363,6 +400,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">EN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -371,6 +409,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">end</property>
<property name="vexpand">1</property>
@@ -379,6 +418,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_C</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">0</property>
@@ -387,6 +427,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">0</property>
@@ -395,6 +436,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">EC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -403,6 +445,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -411,6 +454,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_B</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">0</property>
@@ -419,6 +463,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">baseline</property>
<property name="vexpand">0</property>
@@ -427,6 +472,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">EB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -435,6 +481,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">baseline</property>
<property name="vexpand">1</property>
@@ -444,7 +491,6 @@
</child>
<child>
<object class="GtkBox">
- <property name="can_focus">0</property>
<property name="hexpand">0</property>
<property name="vexpand">1</property>
<property name="orientation">vertical</property>
@@ -452,6 +498,7 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">_I</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">1</property>
</object>
@@ -459,6 +506,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">1</property>
</object>
@@ -467,6 +515,7 @@
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">EI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">1</property>
</object>
@@ -474,6 +523,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEI</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="vexpand">1</property>
</object>
@@ -481,6 +531,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_S</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -489,6 +540,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FS</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">start</property>
<property name="vexpand">1</property>
@@ -497,6 +549,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">ES</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -505,6 +558,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FES</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">start</property>
<property name="vexpand">1</property>
@@ -513,6 +567,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_N</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -521,6 +576,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">end</property>
<property name="vexpand">1</property>
@@ -529,6 +585,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">EN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -537,6 +594,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEN</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">end</property>
<property name="vexpand">1</property>
@@ -545,6 +603,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_C</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -553,6 +612,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -561,6 +621,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">EC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -569,6 +630,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEC</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -577,6 +639,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_B</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -585,6 +648,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">baseline</property>
<property name="vexpand">1</property>
@@ -593,6 +657,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">EB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">center</property>
<property name="vexpand">1</property>
@@ -601,6 +666,7 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">FEB</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="valign">baseline</property>
<property name="vexpand">1</property>
diff --git a/testsuite/tools/simplify-data-3to4/grid.expected
b/testsuite/tools/simplify-data-3to4/grid.expected
index b2f4f733aa..deeb8b9c59 100644
--- a/testsuite/tools/simplify-data-3to4/grid.expected
+++ b/testsuite/tools/simplify-data-3to4/grid.expected
@@ -67,6 +67,7 @@
<child>
<object class="GtkSwitch" id="button5">
<property name="active">1</property>
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<layout>
<property name="column">4</property>
@@ -76,6 +77,7 @@
</child>
<child>
<object class="GtkSwitch" id="button6">
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<layout>
<property name="column">5</property>
@@ -85,6 +87,7 @@
</child>
<child>
<object class="GtkButton" id="button7">
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="label">Text Button</property>
<layout>
@@ -95,6 +98,7 @@
</child>
<child>
<object class="GtkButton" id="button8">
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
@@ -106,6 +110,7 @@
</child>
<child>
<object class="GtkButton" id="button9">
+ <property name="focusable">1</property>
<property name="receives_default">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
diff --git a/tools/gtk-builder-tool-simplify.c b/tools/gtk-builder-tool-simplify.c
index 66c3060138..ff1f72a482 100644
--- a/tools/gtk-builder-tool-simplify.c
+++ b/tools/gtk-builder-tool-simplify.c
@@ -721,6 +721,7 @@ maybe_rename_property (Element *element, MyParserData *data)
{ "GtkHeaderBar", "custom-title", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "title-widget", { NULL, NULL,
NULL } },
{ "GtkStack", "homogeneous", GTK_TYPE_STACK, PROP_KIND_OBJECT, "hhomogeneous", { "vhomogeneous", NULL,
NULL } },
{ "GtkImage", "pixbuf", GTK_TYPE_IMAGE, PROP_KIND_OBJECT, "file", { NULL, NULL, NULL } },
+ { "GtkWidget", "can-focus", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "focusable", { NULL, NULL, NULL } },
};
int i, k, l;
PropKind kind;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]