games-arcade/gnome-nibbles: Fix for vala 0.50.4 regression

* https://gitlab.gnome.org/GNOME/vala/issues/1121

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: David Seifert <soap@gentoo.org>
This commit is contained in:
David Seifert 2021-05-15 19:24:00 +02:00
parent 566168baf8
commit acbfede4da
No known key found for this signature in database
GPG Key ID: CE36E117202E3842
3 changed files with 250 additions and 0 deletions

View File

@ -0,0 +1,66 @@
From 1b48446068608aff9b5edf1fdbd4b8c0d9f0be94 Mon Sep 17 00:00:00 2001
From: Rico Tzschichholz <ricotz@ubuntu.com>
Date: Sat, 16 Jan 2021 13:56:10 +0100
Subject: [PATCH] Don't alter or try to write [GtkChild] fields
See https://gitlab.gnome.org/GNOME/vala/issues/1121
---
src/controls.vala | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/controls.vala b/src/controls.vala
index 4f07358..584c9ff 100644
--- a/src/controls.vala
+++ b/src/controls.vala
@@ -140,25 +140,25 @@ private class ControlsGrid : Button
arrow_left.set_from_pixbuf (arrow.rotate_simple (Gdk.PixbufRotation.COUNTERCLOCKWISE));
arrow_right.set_from_pixbuf (arrow.rotate_simple (Gdk.PixbufRotation.CLOCKWISE));
- up_handler = worm_props.notify ["up"].connect (() => configure_label (worm_props.up, ref move_up_label));
- down_handler = worm_props.notify ["down"].connect (() => configure_label (worm_props.down, ref move_down_label));
- left_handler = worm_props.notify ["left"].connect (() => configure_label (worm_props.left, ref move_left_label));
- right_handler = worm_props.notify ["right"].connect (() => configure_label (worm_props.right, ref move_right_label));
-
- configure_label (worm_props.up, ref move_up_label);
- configure_label (worm_props.down, ref move_down_label);
- configure_label (worm_props.left, ref move_left_label);
- configure_label (worm_props.right, ref move_right_label);
+ up_handler = worm_props.notify ["up"].connect (() => configure_label (worm_props.up, move_up_label));
+ down_handler = worm_props.notify ["down"].connect (() => configure_label (worm_props.down, move_down_label));
+ left_handler = worm_props.notify ["left"].connect (() => configure_label (worm_props.left, move_left_label));
+ right_handler = worm_props.notify ["right"].connect (() => configure_label (worm_props.right, move_right_label));
+
+ configure_label (worm_props.up, move_up_label);
+ configure_label (worm_props.down, move_down_label);
+ configure_label (worm_props.left, move_left_label);
+ configure_label (worm_props.right, move_right_label);
}
internal void mark_duplicated_keys (GenericSet<uint> duplicate_keys)
{
- set_duplicate_class (worm_props.up in duplicate_keys, ref move_up_label);
- set_duplicate_class (worm_props.down in duplicate_keys, ref move_down_label);
- set_duplicate_class (worm_props.left in duplicate_keys, ref move_left_label);
- set_duplicate_class (worm_props.right in duplicate_keys, ref move_right_label);
+ set_duplicate_class (worm_props.up in duplicate_keys, move_up_label);
+ set_duplicate_class (worm_props.down in duplicate_keys, move_down_label);
+ set_duplicate_class (worm_props.left in duplicate_keys, move_left_label);
+ set_duplicate_class (worm_props.right in duplicate_keys, move_right_label);
}
- private static void set_duplicate_class (bool new_value, ref Label label)
+ private static void set_duplicate_class (bool new_value, Label label)
{
if (new_value)
label.get_style_context ().add_class ("duplicate");
@@ -175,7 +175,7 @@ private class ControlsGrid : Button
worm_props.disconnect (color_handler);
}
- private static void configure_label (uint key_value, ref Label label)
+ private static void configure_label (uint key_value, Label label)
{
string? key_name = Gdk.keyval_name (key_value);
if (key_name == "Up")
--
GitLab

View File

@ -0,0 +1,178 @@
From 62964e9256fcac616109af874dbb2bd8342a9853 Mon Sep 17 00:00:00 2001
From: Rico Tzschichholz <ricotz@ubuntu.com>
Date: Wed, 17 Mar 2021 11:25:05 +0100
Subject: [PATCH] Reference of [GtkChild] fields is handled by GtkBuilder, type
must be unowned
---
src/controls.vala | 20 ++++++++++----------
src/nibbles-window.vala | 26 +++++++++++++-------------
src/players.vala | 6 +++---
src/preferences-dialog.vala | 30 +++++++++++++++---------------
src/scoreboard.vala | 6 +++---
5 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/src/controls.vala b/src/controls.vala
index 584c9ff..f95d210 100644
--- a/src/controls.vala
+++ b/src/controls.vala
@@ -22,7 +22,7 @@ using Gtk;
[GtkTemplate (ui = "/org/gnome/Nibbles/ui/controls.ui")]
private class Controls : Box
{
- [GtkChild] private Box grids_box;
+ [GtkChild] private unowned Box grids_box;
private Gee.LinkedList<ControlsGrid> grids = new Gee.LinkedList<ControlsGrid> ();
private Gdk.Pixbuf arrow_pixbuf;
@@ -100,15 +100,15 @@ private class Controls : Box
[GtkTemplate (ui = "/org/gnome/Nibbles/ui/controls-grid.ui")]
private class ControlsGrid : Button
{
- [GtkChild] private Label name_label;
- [GtkChild] private Image arrow_up;
- [GtkChild] private Image arrow_down;
- [GtkChild] private Image arrow_left;
- [GtkChild] private Image arrow_right;
- [GtkChild] private Label move_up_label;
- [GtkChild] private Label move_down_label;
- [GtkChild] private Label move_left_label;
- [GtkChild] private Label move_right_label;
+ [GtkChild] private unowned Label name_label;
+ [GtkChild] private unowned Image arrow_up;
+ [GtkChild] private unowned Image arrow_down;
+ [GtkChild] private unowned Image arrow_left;
+ [GtkChild] private unowned Image arrow_right;
+ [GtkChild] private unowned Label move_up_label;
+ [GtkChild] private unowned Label move_down_label;
+ [GtkChild] private unowned Label move_left_label;
+ [GtkChild] private unowned Label move_right_label;
internal WormProperties worm_props;
internal ulong external_handler;
diff --git a/src/nibbles-window.vala b/src/nibbles-window.vala
index 6961326..6bfb74a 100644
--- a/src/nibbles-window.vala
+++ b/src/nibbles-window.vala
@@ -40,30 +40,30 @@ private class NibblesWindow : ApplicationWindow
private int window_height;
/* Main widgets */
- [GtkChild] private Stack main_stack;
- [GtkChild] private Overlay overlay;
+ [GtkChild] private unowned Stack main_stack;
+ [GtkChild] private unowned Overlay overlay;
/* HeaderBar */
- [GtkChild] private HeaderBar headerbar;
- [GtkChild] private MenuButton hamburger_menu;
- [GtkChild] private Button new_game_button;
- [GtkChild] private Button pause_button;
+ [GtkChild] private unowned HeaderBar headerbar;
+ [GtkChild] private unowned MenuButton hamburger_menu;
+ [GtkChild] private unowned Button new_game_button;
+ [GtkChild] private unowned Button pause_button;
/* Pre-game screen widgets */
- [GtkChild] private Players players;
- [GtkChild] private Speed speed;
- [GtkChild] private Controls controls;
+ [GtkChild] private unowned Players players;
+ [GtkChild] private unowned Speed speed;
+ [GtkChild] private unowned Controls controls;
/* Statusbar widgets */
- [GtkChild] private Stack statusbar_stack;
- [GtkChild] private Label countdown;
- [GtkChild] private Scoreboard scoreboard;
+ [GtkChild] private unowned Stack statusbar_stack;
+ [GtkChild] private unowned Label countdown;
+ [GtkChild] private unowned Scoreboard scoreboard;
private Gdk.Pixbuf scoreboard_life;
/* Rendering of the game */
private NibblesView? view;
- [GtkChild] private Box game_box;
+ [GtkChild] private unowned Box game_box;
private Games.GridFrame frame;
/* Game being played */
diff --git a/src/players.vala b/src/players.vala
index 9198412..4bde18e 100644
--- a/src/players.vala
+++ b/src/players.vala
@@ -21,9 +21,9 @@ using Gtk;
[GtkTemplate (ui = "/org/gnome/Nibbles/ui/players.ui")]
private class Players : Box
{
- [GtkChild] private ToggleButton worms4;
- [GtkChild] private ToggleButton worms5;
- [GtkChild] private ToggleButton worms6;
+ [GtkChild] private unowned ToggleButton worms4;
+ [GtkChild] private unowned ToggleButton worms5;
+ [GtkChild] private unowned ToggleButton worms6;
private SimpleAction nibbles_number_action;
private SimpleAction players_number_action;
diff --git a/src/preferences-dialog.vala b/src/preferences-dialog.vala
index 216a1e2..2d3a7bf 100644
--- a/src/preferences-dialog.vala
+++ b/src/preferences-dialog.vala
@@ -24,21 +24,21 @@ private class PreferencesDialog : Window
private GLib.Settings settings;
private Gee.ArrayList<GLib.Settings> worm_settings;
- [GtkChild] private Stack stack;
- [GtkChild] private Stack headerbar_stack;
- [GtkChild] private ComboBoxText worm_combobox;
- [GtkChild] private Gtk.ListStore list_store_1;
- [GtkChild] private Gtk.ListStore list_store_2;
- [GtkChild] private Gtk.ListStore list_store_3;
- [GtkChild] private Gtk.ListStore list_store_4;
- [GtkChild] private TreeView tree_view_1;
- [GtkChild] private TreeView tree_view_2;
- [GtkChild] private TreeView tree_view_3;
- [GtkChild] private TreeView tree_view_4;
- [GtkChild] private ComboBoxText combo_box_1;
- [GtkChild] private ComboBoxText combo_box_2;
- [GtkChild] private ComboBoxText combo_box_3;
- [GtkChild] private ComboBoxText combo_box_4;
+ [GtkChild] private unowned Stack stack;
+ [GtkChild] private unowned Stack headerbar_stack;
+ [GtkChild] private unowned ComboBoxText worm_combobox;
+ [GtkChild] private unowned Gtk.ListStore list_store_1;
+ [GtkChild] private unowned Gtk.ListStore list_store_2;
+ [GtkChild] private unowned Gtk.ListStore list_store_3;
+ [GtkChild] private unowned Gtk.ListStore list_store_4;
+ [GtkChild] private unowned TreeView tree_view_1;
+ [GtkChild] private unowned TreeView tree_view_2;
+ [GtkChild] private unowned TreeView tree_view_3;
+ [GtkChild] private unowned TreeView tree_view_4;
+ [GtkChild] private unowned ComboBoxText combo_box_1;
+ [GtkChild] private unowned ComboBoxText combo_box_2;
+ [GtkChild] private unowned ComboBoxText combo_box_3;
+ [GtkChild] private unowned ComboBoxText combo_box_4;
private Gee.ArrayList<Gtk.ListStore> list_stores;
private Gee.ArrayList<TreeView> tree_views;
diff --git a/src/scoreboard.vala b/src/scoreboard.vala
index a41aee1..aebc1cc 100644
--- a/src/scoreboard.vala
+++ b/src/scoreboard.vala
@@ -59,9 +59,9 @@ private class Scoreboard : Box
[GtkTemplate (ui = "/org/gnome/Nibbles/ui/player-score-box.ui")]
private class PlayerScoreBox : Box
{
- [GtkChild] private Label name_label;
- [GtkChild] private Label score_label;
- [GtkChild] private Grid lives_grid;
+ [GtkChild] private unowned Label name_label;
+ [GtkChild] private unowned Label score_label;
+ [GtkChild] private unowned Grid lives_grid;
private Gee.LinkedList<Image> life_images = new Gee.LinkedList<Image> ();
--
GitLab

View File

@ -32,6 +32,12 @@ BDEPEND="
media-libs/gsound[vala]
"
PATCHES=(
# backport for https://gitlab.gnome.org/GNOME/gnome-nibbles/-/issues/52
"${FILESDIR}"/${P}-vala-0.50.4-GtkChild-1.patch
"${FILESDIR}"/${P}-vala-0.50.4-GtkChild-2.patch
)
src_prepare() {
xdg_src_prepare
vala_src_prepare