[gnome-chess/mcatanzaro/gtk4: 2/3] WIP: port to GTK 4
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/mcatanzaro/gtk4: 2/3] WIP: port to GTK 4
- Date: Tue, 22 Dec 2020 21:31:40 +0000 (UTC)
commit 0d7996fafb0bd8c6ae4d9c9a4e1972c7fd9b6694
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Mon Dec 21 17:48:29 2020 -0600
WIP: port to GTK 4
data/gnome-chess.ui | 204 +++-------
data/help-overlay.ui | 20 +-
data/preferences.ui | 820 ++++++++++++++++++----------------------
data/promotion-type-selector.ui | 191 ++++------
meson.build | 2 +-
src/chess-view.vala | 18 +-
src/gnome-chess.vala | 73 ++--
7 files changed, 531 insertions(+), 797 deletions(-)
---
diff --git a/data/gnome-chess.ui b/data/gnome-chess.ui
index dbe8f03..38f7011 100644
--- a/data/gnome-chess.ui
+++ b/data/gnome-chess.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.10 -->
+ <requires lib="gtk" version="4.0"/>
<menu id="app-menu">
<section>
<item>
@@ -45,29 +45,23 @@
</menu>
<object class="GtkListStore" id="history-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name move-number -->
<column type="gint"/>
</columns>
</object>
<object class="GtkApplicationWindow" id="gnome_chess_app">
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="default-width">700</property>
- <signal name="delete-event" handler="gnome_chess_app_delete_event_cb" swapped="no"/>
+ <property name="title" translatable="yes">Chess</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="show-close-button">True</property>
- <property name="title" translatable="yes">Chess</property>
+ <property name="can-focus">0</property>
<child>
<object class="GtkButton" id="new-game-button">
- <property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="label" translatable="yes">_New Game</property>
- <property name="use-underline">True</property>
+ <property name="use-underline">1</property>
<property name="action-name">win.new</property>
<style>
<class name="text-button"/>
@@ -76,7 +70,6 @@
</child>
<child>
<object class="GtkButton" id="undo-move-button">
- <property name="visible">True</property>
<property name="valign">center</property>
<property name="action-name">win.undo</property>
<property name="tooltip-text" translatable="yes">Undo your most recent move</property>
@@ -85,8 +78,7 @@
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="icon-size">1</property>
<property name="icon-name">edit-undo-symbolic</property>
</object>
@@ -95,7 +87,6 @@
</child>
<child>
<object class="GtkButton" id="pause_button">
- <property name="visible">True</property>
<property name="valign">center</property>
<property name="action-name">win.pause-resume</property>
<style>
@@ -103,213 +94,150 @@
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
</child>
- <child>
+ <child type="end">
<object class="GtkMenuButton">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
<property name="menu-model">app-menu</property>
- <accelerator key="F10" signal="activate"/>
+<!-- <accelerator key="F10" signal="activate"/> -->
<child>
<object class="GtkImage">
- <property name="visible">True</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
</object>
- <packing>
- <property name="pack-type">end</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <object class="GtkBox" id="main_box">
+ <property name="can-focus">0</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkInfoBar" id="info_bar">
- <property name="visible">False</property>
- <child internal-child="content_area">
+ <property name="visible">0</property>
+ <child>
<object class="GtkBox">
- <property name="visible">True</property>
<child>
<object class="GtkLabel" id="info_bar_label">
- <property name="visible">True</property>
+ <property name="hexpand">1</property>
<property name="ellipsize">end</property>
<property name="justify">center</property>
- <property name="use-markup">true</property>
+ <property name="use-markup">1</property>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
</child>
</object>
</child>
</object>
</child>
- <child>
- <object class="GtkAlignment" id="view_container">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
<child>
<object class="GtkBox" id="navigation_box">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="spacing">6</property>
- <property name="margin">6</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">6</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="homogeneous">True</property>
+ <property name="can-focus">0</property>
+ <property name="homogeneous">1</property>
<style>
<class name="raised"/>
<class name="linked"/>
</style>
<child>
<object class="GtkButton" id="first_move_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
+ <property name="hexpand">1</property>
+ <property name="sensitive">0</property>
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show first
move (i.e. game start) navigation button">Rewind to the game start</property>
- <accelerator key="Left" signal="activate" modifiers="GDK_SHIFT_MASK |
GDK_MOD1_MASK"/>
+<!-- <accelerator key="Left" signal="activate" modifiers="GDK_SHIFT_MASK |
GDK_MOD1_MASK"/> -->
<signal name="clicked" handler="history_start_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="icon-size">1</property>
<property name="icon-name">go-first-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="prev_move_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
+ <property name="hexpand">1</property>
+ <property name="sensitive">0</property>
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show
previous move navigation button">Show the previous move</property>
- <accelerator key="Left" signal="activate" modifiers="GDK_MOD1_MASK"/>
+<!-- <accelerator key="Left" signal="activate" modifiers="GDK_MOD1_MASK"/> -->
<signal name="clicked" handler="history_previous_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="icon-size">1</property>
<property name="icon-name">go-previous-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="next_move_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
+ <property name="hexpand">1</property>
+ <property name="sensitive">0</property>
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show next
move navigation button">Show the next move</property>
- <accelerator key="Right" signal="activate" modifiers="GDK_MOD1_MASK"/>
+<!-- <accelerator key="Right" signal="activate" modifiers="GDK_MOD1_MASK"/> -->
<signal name="clicked" handler="history_next_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="icon-size">1</property>
<property name="icon-name">go-next-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="last_move_button">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
+ <property name="hexpand">1</property>
+ <property name="sensitive">0</property>
<property name="tooltip-text" translatable="yes" comments="Tooltip on the show
current move navigation button">Show the current move</property>
- <accelerator key="Right" signal="activate" modifiers="GDK_SHIFT_MASK |
GDK_MOD1_MASK"/>
+<!-- <accelerator key="Right" signal="activate" modifiers="GDK_SHIFT_MASK |
GDK_MOD1_MASK"/> -->
<signal name="clicked" handler="history_latest_clicked_cb" swapped="no"/>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="icon-size">1</property>
<property name="icon-name">go-last-symbolic</property>
</object>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkComboBox" id="history_combo">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
<property name="model">history-model</property>
<signal name="changed" handler="history_combo_changed_cb" swapped="no"/>
<child>
@@ -321,65 +249,31 @@
</attributes>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkBox" id="clock_box">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="spacing">6</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">1</property>
<child>
<object class="GtkDrawingArea" id="white_time_label">
- <!-- -1 means compute at runtime -->
- <property name="width-request">-1</property>
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <signal name="draw" handler="white_time_draw_cb" swapped="no"/>
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+<!-- <signal name="draw" handler="white_time_draw_cb" swapped="no"/> -->
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkDrawingArea" id="black_time_label">
- <!-- -1 means compute at runtime -->
- <property name="width-request">-1</property>
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <signal name="draw" handler="black_time_draw_cb" swapped="no"/>
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+<!-- <signal name="draw" handler="black_time_draw_cb" swapped="no"/> -->
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
</child>
</object>
</child>
diff --git a/data/help-overlay.ui b/data/help-overlay.ui
index 51a088e..21ea074 100644
--- a/data/help-overlay.ui
+++ b/data/help-overlay.ui
@@ -1,68 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.17 -->
+ <requires lib="gtk" version="4.0"/>
<object class="GtkShortcutsWindow" id="help_overlay">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
- <property name="visible">1</property>
<property name="max-height">8</property>
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes" context="shortcut window">General</property>
- <property name="visible">1</property>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Ctrl>N</property>
<property name="title" translatable="yes" context="shortcut window">Start a new
game</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Ctrl>O</property>
<property name="title" translatable="yes" context="shortcut window">Open a saved
game</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Ctrl>P Pause</property>
<property name="title" translatable="yes" context="shortcut window">Pause the game</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Ctrl>S</property>
<property name="title" translatable="yes" context="shortcut window">Save the game</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Shift><Ctrl>S</property>
<property name="title" translatable="yes" context="shortcut window">Save the game with a
different name</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Ctrl>Z</property>
<property name="title" translatable="yes" context="shortcut window">Undo move</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Ctrl>Q</property>
<property name="title" translatable="yes" context="shortcut window">Quit</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator">F10</property>
<property name="title" translatable="yes" context="shortcut window">Open menu</property>
</object>
@@ -72,31 +62,26 @@
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes" context="shortcut window">History</property>
- <property name="visible">1</property>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Shift><Alt>Left</property>
<property name="title" translatable="yes" context="shortcut window">Rewind to the game
start</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Alt>Left</property>
<property name="title" translatable="yes" context="shortcut window">Show the previous
move</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Alt>Right</property>
<property name="title" translatable="yes" context="shortcut window">Show the next
move</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Shift><Alt>Right</property>
<property name="title" translatable="yes" context="shortcut window">Show the current
move</property>
</object>
@@ -106,17 +91,14 @@
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes" context="shortcut window">Help</property>
- <property name="visible">1</property>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator">F1</property>
<property name="title" translatable="yes" context="shortcut window">Show Help</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
- <property name="visible">1</property>
<property name="accelerator"><Primary>question</property>
<property name="title" translatable="yes" context="shortcut window">Show Keyboard
Shortcuts</property>
</object>
diff --git a/data/preferences.ui b/data/preferences.ui
index 80f89da..9ce4df0 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.12 -->
+ <requires lib="gtk" version="4.0"/>
<object class="GtkListStore" id="custom-duration-units-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name multiplier -->
<column type="gint"/>
</columns>
<data>
@@ -21,9 +19,7 @@
</object>
<object class="GtkListStore" id="timer-increment-units-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name multiplier -->
<column type="gint"/>
</columns>
<data>
@@ -39,9 +35,7 @@
</object>
<object class="GtkListStore" id="clock-type-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name clock-type -->
<column type="gint"/>
</columns>
<data>
@@ -61,9 +55,7 @@
</object>
<object class="GtkListStore" id="difficulty-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name difficulty -->
<column type="gchararray"/>
</columns>
<data>
@@ -97,9 +89,7 @@
</object>
<object class="GtkListStore" id="duration-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name duration -->
<column type="gint"/>
</columns>
<data>
@@ -139,9 +129,7 @@
</object>
<object class="GtkListStore" id="move-format-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name move-format -->
<column type="gchararray"/>
</columns>
<data>
@@ -165,9 +153,7 @@
</object>
<object class="GtkListStore" id="opponent-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name opposing-player -->
<column type="gchararray"/>
</columns>
<data>
@@ -179,9 +165,7 @@
</object>
<object class="GtkListStore" id="orientation-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name board-orientation -->
<column type="gchararray"/>
</columns>
<data>
@@ -205,9 +189,7 @@
</object>
<object class="GtkListStore" id="piece-style-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name piece-style -->
<column type="gchararray"/>
</columns>
<data>
@@ -222,521 +204,437 @@
</data>
</object>
<object class="GtkDialog" id="preferences">
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="title" translatable="yes" comments="Title for preferences dialog">Preferences</property>
- <property name="resizable">False</property>
- <property name="destroy-with-parent">True</property>
- <property name="type-hint">dialog</property>
+ <property name="resizable">0</property>
+ <property name="destroy-with-parent">1</property>
<property name="use-header-bar">1</property>
<signal name="delete-event" handler="preferences_delete_event_cb" swapped="no"/>
<signal name="response" handler="preferences_response_cb" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<child>
<object class="GtkNotebook">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="border-width">5</property>
<child>
- <object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="border-width">10</property>
- <property name="column-spacing">5</property>
- <property name="row-spacing">5</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
clock type (Fischer/Bronstein) combo box">_Clock type:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">clock_type_combo</property>
- </object>
- <packing>
- <property name="top-attach">5</property>
- <property name="left-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="timer_increment_label">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
timer increment combo box">Timer _increment:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">timer-increment-spin</property>
- </object>
- <packing>
- <property name="top-attach">6</property>
- <property name="left-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="clock_type_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">clock-type-model</property>
- <signal name="changed" handler="clock_type_changed_cb" swapped="no"/>
+ <object class="GtkNotebookPage">
+ <property name="child">
+ <object class="GtkGrid">
+ <property name="can-focus">0</property>
+ <property name="column-spacing">5</property>
+ <property name="row-spacing">5</property>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
clock type (Fischer/Bronstein) combo box">_Clock type:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">clock_type_combo</property>
+ <layout>
+ <property name="row">5</property>
+ <property name="column">0</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="top-attach">5</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
player side (white/black) combo box">_Play as:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">side_combo</property>
- </object>
- <packing>
- <property name="top-attach">1</property>
- <property name="left-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
opposing player combo box">_Opposing player:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">opponent_combo</property>
- </object>
- <packing>
- <property name="top-attach">0</property>
- <property name="left-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
difficulty level combo box">_Difficulty:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">difficulty_combo</property>
- </object>
- <packing>
- <property name="top-attach">2</property>
- <property name="left-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="timer_increment_box">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkSpinButton" id="timer-increment-spin">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="invisible-char">•</property>
- <property name="adjustment">timer_increment_adjustment</property>
- <property name="climb-rate">1</property>
- <property name="numeric">True</property>
+ <object class="GtkLabel" id="timer_increment_label">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
timer increment combo box">Timer _increment:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">timer-increment-spin</property>
+ <layout>
+ <property name="row">6</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkComboBox" id="timer_increment_units_combo">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="model">timer-increment-units-model</property>
- <signal name="changed" handler="timer_increment_units_changed_cb" swapped="no"/>
+ <object class="GtkComboBox" id="clock_type_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">clock-type-model</property>
+ <signal name="changed" handler="clock_type_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
+ <layout>
+ <property name="row">5</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
- </object>
- <packing>
- <property name="top-attach">6</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="side_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">side-model</property>
- <signal name="changed" handler="side_combo_changed_cb" swapped="no"/>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
player side (white/black) combo box">_Play as:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">side_combo</property>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">0</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="top-attach">1</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="opponent_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">opponent-model</property>
- <signal name="changed" handler="opponent_combo_changed_cb" swapped="no"/>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
opposing player combo box">_Opposing player:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">opponent_combo</property>
+ <layout>
+ <property name="row">0</property>
+ <property name="column">0</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="top-attach">0</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="difficulty_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">difficulty-model</property>
- <signal name="changed" handler="difficulty_combo_changed_cb" swapped="no"/>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
difficulty level combo box">_Difficulty:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">difficulty_combo</property>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">0</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="top-attach">2</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="custom_duration_box">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkSpinButton">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="invisible-char">•</property>
- <property name="adjustment">duration_adjustment</property>
- <property name="climb-rate">1</property>
- <property name="numeric">True</property>
+ <object class="GtkBox" id="timer_increment_box">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkSpinButton" id="timer-increment-spin">
+ <property name="hexpand">1</property>
+ <property name="adjustment">timer_increment_adjustment</property>
+ <property name="climb-rate">1</property>
+ <property name="numeric">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="timer_increment_units_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">timer-increment-units-model</property>
+ <signal name="changed" handler="timer_increment_units_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <layout>
+ <property name="row">6</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkComboBox" id="custom_duration_units_combo">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="model">custom-duration-units-model</property>
- <signal name="changed" handler="duration_units_changed_cb" swapped="no"/>
+ <object class="GtkComboBox" id="side_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">side-model</property>
+ <signal name="changed" handler="side_combo_changed_cb" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
- </object>
- <packing>
- <property name="top-attach">4</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
game timer settings">_Time limit:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">duration_combo</property>
- </object>
- <packing>
- <property name="top-attach">3</property>
- <property name="left-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="duration_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">duration-model</property>
- <signal name="changed" handler="duration_combo_changed_cb" swapped="no"/>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkComboBox" id="opponent_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">opponent-model</property>
+ <signal name="changed" handler="opponent_combo_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <layout>
+ <property name="row">0</property>
+ <property name="column">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="difficulty_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">difficulty-model</property>
+ <signal name="changed" handler="difficulty_combo_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">1</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="top-attach">3</property>
- <property name="left-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="spacing">5</property>
<child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="icon-name">dialog-information-symbolic</property>
- <property name="icon-size">6</property>
+ <object class="GtkBox" id="custom_duration_box">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkSpinButton">
+ <property name="hexpand">1</property>
+ <property name="adjustment">duration_adjustment</property>
+ <property name="climb-rate">1</property>
+ <property name="numeric">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="custom_duration_units_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">custom-duration-units-model</property>
+ <signal name="changed" handler="duration_units_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <layout>
+ <property name="row">4</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences dialog: Label to
notify user that the settings are applied for the next game">Changes will take effect for the next
game.</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
game timer settings">_Time limit:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">duration_combo</property>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">0</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="duration_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">duration-model</property>
+ <signal name="changed" handler="duration_combo_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkImage">
+ <property name="can-focus">0</property>
+ <property name="icon-name">dialog-information-symbolic</property>
+ <property name="icon-size">6</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences dialog: Label to
notify user that the settings are applied for the next game">Changes will take effect for the next
game.</property>
+ </object>
+ </child>
+ <layout>
+ <property name="row">7</property>
+ <property name="column">0</property>
+ <property name="column-span">2</property>
+ </layout>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="top-attach">7</property>
- <property name="left-attach">0</property>
- <property name="width">2</property>
- </packing>
- </child>
- </object>
- </child>
- <child type="tab">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Tab title for game
preferences">_Game</property>
- <property name="use-underline">True</property>
+ </property>
+ <property name="tab">
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Tab title for
game preferences">_Game</property>
+ <property name="use-underline">1</property>
+ </object>
+ </property>
</object>
- <packing>
- <property name="tab-fill">False</property>
- </packing>
</child>
<child>
- <object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="border-width">10</property>
- <property name="column-spacing">5</property>
- <property name="row-spacing">5</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
board orientation combo box">Board _orientation:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">orientation_combo</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
move format combo box">Move _format:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">move_format_combo</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Label before
piece style combo box">_Piece style:</property>
- <property name="use-underline">True</property>
- <property name="mnemonic-widget">piece_style_combo</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="orientation_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">orientation-model</property>
- <signal name="changed" handler="orientation_combo_changed_cb" swapped="no"/>
+ <object class="GtkNotebookPage">
+ <property name="child">
+ <object class="GtkGrid">
+ <property name="can-focus">0</property>
+ <property name="column-spacing">5</property>
+ <property name="row-spacing">5</property>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
board orientation combo box">Board _orientation:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">orientation_combo</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="move_format_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">False</property>
- <property name="model">move-format-model</property>
- <signal name="changed" handler="move_format_combo_changed_cb" swapped="no"/>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
move format combo box">Move _format:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">move_format_combo</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
+ </object>
</child>
- </object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="piece_style_combo">
- <property name="visible">True</property>
- <property name="hexpand">True</property>
- <property name="can-focus">True</property>
- <property name="model">piece-style-model</property>
- <signal name="changed" handler="piece_style_combo_changed_cb" swapped="no"/>
<child>
- <object class="GtkCellRendererText"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Label before
piece style combo box">_Piece style:</property>
+ <property name="use-underline">1</property>
+ <property name="mnemonic-widget">piece_style_combo</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">2</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="orientation_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">orientation-model</property>
+ <signal name="changed" handler="orientation_combo_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="move_format_combo">
+ <property name="hexpand">1</property>
+ <property name="can-focus">0</property>
+ <property name="model">move-format-model</property>
+ <signal name="changed" handler="move_format_combo_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="piece_style_combo">
+ <property name="hexpand">1</property>
+ <property name="model">piece-style-model</property>
+ <signal name="changed" handler="piece_style_combo_changed_cb" swapped="no"/>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">2</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_numbering_check">
+ <property name="label" translatable="yes" comments="Preferences Dialog: Check box
for selecting if board numbering is visible">_Board numbering</property>
+ <property name="use-underline">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">3</property>
+ <property name="column-span">2</property>
+ </layout>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_move_hints_check">
+ <property name="label" translatable="yes" comments="Preferences Dialog: Check box
for selecting if move hints are visible">_Move hints</property>
+ <property name="use-underline">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">4</property>
+ <property name="column-span">2</property>
+ </layout>
+ </object>
</child>
</object>
- <packing>
- <property name="left-attach">1</property>
- <property name="top-attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="show_numbering_check">
- <property name="label" translatable="yes" comments="Preferences Dialog: Check box for
selecting if board numbering is visible">_Board numbering</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
- <property name="use-underline">True</property>
- <property name="draw-indicator">True</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">3</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="show_move_hints_check">
- <property name="label" translatable="yes" comments="Preferences Dialog: Check box for
selecting if move hints are visible">_Move hints</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">False</property>
- <property name="use-underline">True</property>
- <property name="draw-indicator">True</property>
+ </property>
+ <property name="tab">
+ <object class="GtkLabel">
+ <property name="can-focus">0</property>
+ <property name="label" translatable="yes" comments="Preferences Dialog: Title of
appearance options tab">_Appearance</property>
+ <property name="use-underline">1</property>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">4</property>
- <property name="width">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child type="tab">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- <property name="label" translatable="yes" comments="Preferences Dialog: Title of appearance
options tab">_Appearance</property>
- <property name="use-underline">True</property>
+ </property>
</object>
- <packing>
- <property name="position">1</property>
- <property name="tab-fill">False</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="side-model">
<columns>
- <!-- column-name label -->
<column type="gchararray"/>
- <!-- column-name play-as -->
<column type="gint"/>
</columns>
<data>
diff --git a/data/promotion-type-selector.ui b/data/promotion-type-selector.ui
index 6d48fca..acd120f 100644
--- a/data/promotion-type-selector.ui
+++ b/data/promotion-type-selector.ui
@@ -1,224 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.12 -->
+ <requires lib="gtk" version="4.0"/>
<object class="GtkDialog" id="dialog_promotion_type_selector">
- <property name="can-focus">False</property>
- <property name="border-width">5</property>
+ <property name="can-focus">0</property>
<property name="title" translatable="yes">Select Promotion Type</property>
- <property name="type-hint">dialog</property>
- <property name="has-resize-grip">False</property>
<property name="use-header-bar">1</property>
<child internal-child="vbox">
<object class="GtkBox">
+ <property name="visible">0</property>
<child>
- <object class="GtkButtonBox" id="button_box">
- <property name="visible">true</property>
- <property name="can-focus">False</property>
- <property name="margin">6</property>
- <property name="layout-style">expand</property>
+ <object class="GtkBox" id="button_box">
+ <property name="can-focus">0</property>
+ <property name="margin-start">6</property>
+ <property name="margin-end">6</property>
+ <property name="margin-top">6</property>
+ <property name="margin-bottom">6</property>
<child>
<object class="GtkButton" id="button_queen">
<property name="width-request">100</property>
<property name="height-request">120</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="use-underline">True</property>
- <property name="image-position">top</property>
+ <property name="receives-default">1</property>
+ <property name="use-underline">1</property>
<signal name="clicked" handler="queen_selected_cb"/>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="label" translatable="yes">_Queen</property>
- <property name="use-underline">True</property>
+ <property name="use-underline">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkImage" id="image_queen">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="button_knight">
<property name="width-request">100</property>
<property name="height-request">120</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="use-underline">True</property>
- <property name="image-position">top</property>
+ <property name="receives-default">1</property>
+ <property name="use-underline">1</property>
<signal name="clicked" handler="knight_selected_cb"/>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="label" translatable="yes">_Knight</property>
- <property name="use-underline">True</property>
+ <property name="use-underline">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkImage" id="image_knight">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="button_rook">
<property name="width-request">100</property>
<property name="height-request">120</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="use-underline">True</property>
- <property name="image-position">top</property>
+ <property name="receives-default">1</property>
+ <property name="use-underline">1</property>
<signal name="clicked" handler="rook_selected_cb"/>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="label" translatable="yes">_Rook</property>
- <property name="use-underline">True</property>
+ <property name="use-underline">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkImage" id="image_rook">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
<child>
<object class="GtkButton" id="button_bishop">
<property name="width-request">100</property>
<property name="height-request">120</property>
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="receives-default">True</property>
- <property name="use-underline">True</property>
- <property name="image-position">top</property>
+ <property name="receives-default">1</property>
+ <property name="use-underline">1</property>
<signal name="clicked" handler="bishop_selected_cb"/>
<child>
<object class="GtkGrid">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
<property name="label" translatable="yes">_Bishop</property>
- <property name="use-underline">True</property>
+ <property name="use-underline">1</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
<child>
<object class="GtkImage" id="image_bishop">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
+ <property name="can-focus">0</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">0</property>
+ </layout>
</object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
</object>
</child>
diff --git a/meson.build b/meson.build
index 5cb3cee..5bd07da 100644
--- a/meson.build
+++ b/meson.build
@@ -32,7 +32,7 @@ min_glib_version = '2.44.0'
gio = dependency('gio-unix-2.0', version: '>=' + min_glib_version)
glib = dependency('glib-2.0', version: '>=' + min_glib_version)
gmodule = dependency('gmodule-2.0', version: '>=' + min_glib_version)
-gtk = dependency('gtk+-3.0', version: '>= 3.20.0')
+gtk = dependency('gtk4')
librsvg = dependency('librsvg-2.0', version: '>= 2.46.0')
posix = meson.get_compiler('vala').find_library('posix')
diff --git a/src/chess-view.vala b/src/chess-view.vala
index dda4866..b8a3603 100644
--- a/src/chess-view.vala
+++ b/src/chess-view.vala
@@ -19,7 +19,7 @@ public class ChessView : Gtk.DrawingArea
private Cairo.Surface? selected_model_surface;
private string loaded_theme_name = "";
- private Gtk.GestureMultiPress click_controller; // for keeping in memory
+ private Gtk.GestureClick click_controller; // for keeping in memory
private ChessScene _scene;
public ChessScene scene
@@ -40,14 +40,12 @@ public class ChessView : Gtk.DrawingArea
construct
{
- add_events (Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK);
-
init_mouse ();
}
- public override bool configure_event (Gdk.EventConfigure event)
+ public override void size_allocate (int width, int height, int baseline)
{
- int short_edge = int.min (get_allocated_width (), get_allocated_height ());
+ int short_edge = int.min (width, height);
square_size = (int) Math.floor ((short_edge - 2 * border) / 9.0);
var extra = square_size * 0.1;
@@ -55,7 +53,7 @@ public class ChessView : Gtk.DrawingArea
extra = 3;
selected_square_size = square_size + 2 * (int) (extra + 0.5);
- return true;
+ base.size_allocate (width, height, baseline);
}
private void render_piece (Cairo.Context c1, Cairo.Context c2, string name, int offset)
@@ -109,6 +107,7 @@ public class ChessView : Gtk.DrawingArea
loaded_theme_name = scene.theme_name;
}
+#if 0
public override bool draw (Cairo.Context c)
{
load_theme (c);
@@ -260,6 +259,7 @@ public class ChessView : Gtk.DrawingArea
return true;
}
+#endif
private void draw_piece (Cairo.Context c, Cairo.Surface surface, int size, ChessPiece piece, double
alpha)
{
@@ -274,13 +274,13 @@ public class ChessView : Gtk.DrawingArea
c.paint_with_alpha (alpha);
}
- private inline void init_mouse ()
+ private void init_mouse ()
{
- click_controller = new Gtk.GestureMultiPress (this); // only reacts to Gdk.BUTTON_PRIMARY
+ click_controller = new Gtk.GestureClick (); // only reacts to Gdk.BUTTON_PRIMARY
click_controller.pressed.connect (on_click);
}
- private inline void on_click (Gtk.GestureMultiPress _click_controller, int n_press, double event_x,
double event_y)
+ private void on_click (Gtk.GestureClick _click_controller, int n_press, double event_x, double event_y)
{
if (scene.game == null || scene.game.should_show_paused_overlay)
return;
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 751b6a9..086dc94 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -28,9 +28,9 @@ public class ChessApplication : Gtk.Application
private GLib.Settings settings;
private ApplicationWindow window;
+ private Box main_box;
private InfoBar info_bar;
private Label info_bar_label;
- private Container view_container;
private ChessScene scene;
private ChessView view;
private Button pause_resume_button;
@@ -148,9 +148,8 @@ Copyright © 2015–2016 Sahil Sareen""";
window.set_default_size (settings.get_int ("width"), settings.get_int ("height"));
if (settings.get_boolean ("maximized"))
window.maximize ();
- window.size_allocate.connect (size_allocate_cb);
- window.window_state_event.connect (window_state_event_cb);
+ main_box = (Box) builder.get_object ("main_box");
info_bar = (InfoBar) builder.get_object ("info_bar");
info_bar_label = (Label) builder.get_object ("info_bar_label");
pause_resume_button = (Button) builder.get_object ("pause_button");
@@ -163,9 +162,7 @@ Copyright © 2015–2016 Sahil Sareen""";
clock_box = (Box) builder.get_object ("clock_box");
white_time_label = (Widget) builder.get_object ("white_time_label");
black_time_label = (Widget) builder.get_object ("black_time_label");
- view_container = (Container) builder.get_object ("view_container");
headerbar = (HeaderBar) builder.get_object ("headerbar");
- builder.connect_signals (this);
update_pause_resume_button ();
@@ -193,7 +190,7 @@ Copyright © 2015–2016 Sahil Sareen""";
view = new ChessView ();
view.set_size_request (100, 100);
view.scene = scene;
- view_container.add (view);
+ main_box.insert_child_after (view, info_bar);
view.show ();
var system_engine_cfg = Path.build_filename (SYSCONFDIR, "gnome-chess", "engines.conf", null);
@@ -268,26 +265,20 @@ Copyright © 2015–2016 Sahil Sareen""";
navigation_box.set_orientation (layout_mode == LayoutMode.NORMAL ? Orientation.HORIZONTAL :
Orientation.VERTICAL);
}
- private void size_allocate_cb (Allocation allocation)
+#if 0
+ private override void size_allocate (int width, int height, int baseline)
{
- if (is_maximized || is_tiled)
+ base.size_allocate (width, height, baseline);
+
+ if (fullscreened || maximized)
return;
- window.get_size (out window_width, out window_height);
- if (window_width <= 500 && layout_mode == LayoutMode.NORMAL)
+
+ if (default_width <= 500 && layout_mode == LayoutMode.NORMAL)
set_layout_mode (LayoutMode.NARROW);
- else if (window_width > 500 && layout_mode == LayoutMode.NARROW)
+ else if (default_width > 500 && layout_mode == LayoutMode.NARROW)
set_layout_mode (LayoutMode.NORMAL);
}
-
- private bool window_state_event_cb (Gdk.EventWindowState event)
- {
- if ((event.changed_mask & Gdk.WindowState.MAXIMIZED) != 0)
- is_maximized = (event.new_window_state & Gdk.WindowState.MAXIMIZED) != 0;
- /* We don’t save this state, but track it for saving size allocation */
- if ((event.changed_mask & Gdk.WindowState.TILED) != 0)
- is_tiled = (event.new_window_state & Gdk.WindowState.TILED) != 0;
- return false;
- }
+#endif
[CCode (cname = "queen_selected_cb", instance_pos = -1)]
public void queen_selected_cb (Button button)
@@ -319,12 +310,13 @@ Copyright © 2015–2016 Sahil Sareen""";
public PieceType? show_promotion_type_selector ()
{
+#if 0
var promotion_type_selector_builder = new Builder.from_resource
("/org/gnome/Chess/ui/promotion-type-selector.ui");
promotion_type_selector_dialog = (Dialog) promotion_type_selector_builder.get_object
("dialog_promotion_type_selector");
promotion_type_selector_dialog.transient_for = window;
- var button_box = (ButtonBox) promotion_type_selector_builder.get_object ("button_box");
+ var button_box = (Box) promotion_type_selector_builder.get_object ("button_box");
if (layout_mode == LayoutMode.NARROW)
button_box.orientation = Orientation.VERTICAL;
@@ -346,8 +338,6 @@ Copyright © 2015–2016 Sahil Sareen""";
filename = Path.build_filename (PKGDATADIR, "pieces", scene.theme_name, "%sBishop.svg".printf
(color));
set_piece_image ((Image) promotion_type_selector_builder.get_object ("image_bishop"), filename);
- promotion_type_selector_builder.connect_signals (this);
-
PieceType? selection = null;
int choice = promotion_type_selector_dialog.run ();
switch (choice)
@@ -369,10 +359,13 @@ Copyright © 2015–2016 Sahil Sareen""";
promotion_type_selector_dialog = null;
return selection;
+#endif
+return null;
}
private void set_piece_image (Image image, string filename)
{
+#if 0
int width, height;
if (!icon_size_lookup (IconSize.DIALOG, out width, out height))
return;
@@ -393,6 +386,7 @@ Copyright © 2015–2016 Sahil Sareen""";
warning ("Failed to load image %s: %s", filename, e.message);
return;
}
+#endif
}
enum PromotionTypeSelected
@@ -475,10 +469,12 @@ Copyright © 2015–2016 Sahil Sareen""";
{
starting = true;
+#if 0
if (game_file != null && game_file.get_path () != autosave_filename)
headerbar.subtitle = game_file.get_basename ();
else
headerbar.subtitle = null;
+#endif
var model = (Gtk.ListStore) history_combo.model;
model.clear ();
@@ -1325,7 +1321,7 @@ Copyright © 2015–2016 Sahil Sareen""";
private void update_game_status (string? title = null, string? info = null)
{
- headerbar.title = title != null ? title : compute_current_title ();
+ window.title = title != null ? title : compute_current_title ();
info_bar_label.label = info != null ? info : compute_status_info ();
/* Setting the label to null actually just sets it to an empty string. */
info_bar.visible = info_bar_label.label != "";
@@ -1337,7 +1333,7 @@ Copyright © 2015–2016 Sahil Sareen""";
pause_resume_button.hide ();
else
pause_resume_button.show ();
-
+#if 0
if (game != null && game.is_paused)
{
pause_resume_button.image = new Image.from_icon_name ("media-playback-start-symbolic",
@@ -1350,6 +1346,7 @@ Copyright © 2015–2016 Sahil Sareen""";
IconSize.BUTTON);
pause_resume_button.tooltip_text = _("Pause the game");
}
+#endif
}
private void game_end_cb ()
@@ -1476,15 +1473,18 @@ Copyright © 2015–2016 Sahil Sareen""";
black_time_label.queue_draw ();
}
+#if 0
[CCode (cname = "gnome_chess_app_delete_event_cb", instance_pos = -1)]
public bool gnome_chess_app_delete_event_cb (Widget widget, Gdk.Event event)
{
quit_game ();
return false;
}
+#endif
private bool prompt_save_game (string prompt_text)
{
+#if 0
if (!game_needs_saving)
return true;
@@ -1525,12 +1525,14 @@ Copyright © 2015–2016 Sahil Sareen""";
autosave ();
}
+#endif
return true;
}
private void present_claim_draw_dialog ()
requires (game.can_claim_draw ())
{
+#if 0
game.pause (false);
var dialog = new MessageDialog (window,
@@ -1569,6 +1571,7 @@ Copyright © 2015–2016 Sahil Sareen""";
{
game.current_player.claim_draw ();
}
+#endif
}
public void new_game_cb ()
@@ -1579,6 +1582,7 @@ Copyright © 2015–2016 Sahil Sareen""";
public void resign_cb ()
{
+#if 0
game.pause (false);
var dialog = new MessageDialog (window,
@@ -1607,6 +1611,7 @@ Copyright © 2015–2016 Sahil Sareen""";
else
game.current_player.resign ();
}
+#endif
}
public void undo_move_cb ()
@@ -1785,6 +1790,7 @@ Copyright © 2015–2016 Sahil Sareen""";
public void preferences_cb ()
{
+#if 0
if (preferences_dialog != null)
{
preferences_dialog.run ();
@@ -1866,6 +1872,7 @@ Copyright © 2015–2016 Sahil Sareen""";
}
preferences_dialog.run ();
+#endif
}
private void set_combo (ComboBox combo, int value_index, string value)
@@ -2253,7 +2260,9 @@ Copyright © 2015–2016 Sahil Sareen""";
{
try
{
+#if 0
show_uri_on_window (window, "help:gnome-chess", get_current_event_time ());
+#endif
}
catch (Error e)
{
@@ -2285,12 +2294,15 @@ Copyright © 2015–2016 Sahil Sareen""";
about_dialog.translator_credits = _("translator-credits");
about_dialog.website = "https://wiki.gnome.org/Apps/Chess";
about_dialog.logo_icon_name = "org.gnome.Chess";
+#if 0
about_dialog.response.connect (about_response_cb);
about_dialog.show ();
+#endif
}
private void run_invalid_pgn_dialog ()
{
+#if 0
var invalid_pgn_dialog = new MessageDialog (window,
DialogFlags.MODAL,
MessageType.ERROR,
@@ -2300,10 +2312,12 @@ Copyright © 2015–2016 Sahil Sareen""";
invalid_pgn_dialog.run ();
invalid_pgn_dialog.destroy ();
+#endif
}
private void run_invalid_move_dialog (string error_message)
{
+#if 0
var invalid_move_dialog = new MessageDialog (window,
DialogFlags.MODAL,
MessageType.ERROR,
@@ -2313,6 +2327,7 @@ Copyright © 2015–2016 Sahil Sareen""";
invalid_move_dialog.run ();
invalid_move_dialog.destroy ();
+#endif
}
private void about_response_cb (int response_id)
@@ -2333,6 +2348,7 @@ Copyright © 2015–2016 Sahil Sareen""";
private void present_save_dialog ()
{
+#if 0
/* Show active dialog */
if (save_dialog == null)
{
@@ -2397,7 +2413,9 @@ Copyright © 2015–2016 Sahil Sareen""";
disable_window_action (SAVE_GAME_ACTION_NAME);
game_needs_saving = false;
+#if 0
headerbar.subtitle = game_file.get_basename ();
+#endif
}
catch (Error e)
{
@@ -2413,6 +2431,7 @@ Copyright © 2015–2016 Sahil Sareen""";
error_dialog.destroy ();
}
}
+#endif
}
public void save_game_cb ()
@@ -2444,6 +2463,7 @@ Copyright © 2015–2016 Sahil Sareen""";
public void open_game_cb ()
{
+#if 0
if (!prompt_save_game (_("Save this game before loading another one?")))
return;
@@ -2479,6 +2499,7 @@ Copyright © 2015–2016 Sahil Sareen""";
load_game (game_file);
}
+#endif
}
private void start_new_game ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]