Codebase list gnome-taquin / 9a7cad0
Cherry-pick 2 patches to fix build with latest vala Closes: #997196 Jeremy Bicha 2 years ago
3 changed file(s) with 360 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From: Rico Tzschichholz <ricotz@ubuntu.com>
1 Date: Sat, 16 Jan 2021 14:00:15 +0100
2 Subject: Don't alter or try to write [GtkChild] fields
3
4 See https://gitlab.gnome.org/GNOME/vala/issues/1121
5
6 (cherry picked from commit 99dea5e7863e112f33f16e59898c56a4f1a547b3)
7 ---
8 src/overlayed-list.vala | 38 +++++++++++++++++++-------------------
9 1 file changed, 19 insertions(+), 19 deletions(-)
10
11 diff --git a/src/overlayed-list.vala b/src/overlayed-list.vala
12 index 18891de..f7ed170 100644
13 --- a/src/overlayed-list.vala
14 +++ b/src/overlayed-list.vala
15 @@ -89,11 +89,11 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
16 internal void set_window_size (AdaptativeWidget.WindowSize new_size)
17 {
18 if (!AdaptativeWidget.WindowSize.is_extra_thin (new_size) && AdaptativeWidget.WindowSize.is_extra_flat (new_size))
19 - set_horizontal (ref main_context, ref edit_mode_box);
20 + set_horizontal (ref main_context, edit_mode_box);
21 else
22 - set_vertical (ref main_context, ref edit_mode_box);
23 + set_vertical (ref main_context, edit_mode_box);
24 }
25 - private static inline void set_horizontal (ref StyleContext main_context, ref Box edit_mode_box)
26 + private static inline void set_horizontal (ref StyleContext main_context, Box edit_mode_box)
27 {
28 main_context.remove_class ("vertical");
29 edit_mode_box.halign = Align.END;
30 @@ -102,7 +102,7 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
31 edit_mode_box.width_request = 160;
32 main_context.add_class ("horizontal");
33 }
34 - private static inline void set_vertical (ref StyleContext main_context, ref Box edit_mode_box)
35 + private static inline void set_vertical (ref StyleContext main_context, Box edit_mode_box)
36 {
37 main_context.remove_class ("horizontal");
38 edit_mode_box.halign = Align.CENTER;
39 @@ -118,9 +118,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
40
41 internal bool next_match ()
42 {
43 - return _next_match (ref main_list_box);
44 + return _next_match (main_list_box);
45 }
46 - private static inline bool _next_match (ref ListBox main_list_box)
47 + private static inline bool _next_match (ListBox main_list_box)
48 {
49 ListBoxRow? row = main_list_box.get_selected_row (); // TODO multiple rows and focus-only lists
50 if (row == null)
51 @@ -130,7 +130,7 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
52
53 if (row == null)
54 {
55 - _scroll_bottom (ref main_list_box);
56 + _scroll_bottom (main_list_box);
57 return false;
58 }
59 main_list_box.select_row ((!) row);
60 @@ -140,9 +140,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
61
62 internal bool previous_match ()
63 {
64 - return _previous_match (ref main_list_box);
65 + return _previous_match (main_list_box);
66 }
67 - private static inline bool _previous_match (ref ListBox main_list_box)
68 + private static inline bool _previous_match (ListBox main_list_box)
69 {
70 uint n_items = main_list_box.get_children ().length (); // FIXME OverlayedList.n_items is unreliable
71 if (n_items == 0)
72 @@ -189,9 +189,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
73
74 protected int [] get_selected_rows_indices ()
75 {
76 - return _get_selected_rows_indices (ref main_list_box);
77 + return _get_selected_rows_indices (main_list_box);
78 }
79 - private static inline int [] _get_selected_rows_indices (ref ListBox main_list_box)
80 + private static inline int [] _get_selected_rows_indices (ListBox main_list_box)
81 {
82 int [] indices = new int [0];
83 main_list_box.selected_foreach ((_list_box, selected_row) => {
84 @@ -205,9 +205,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
85
86 protected void scroll_top ()
87 {
88 - _scroll_top (ref main_list_box);
89 + _scroll_top (main_list_box);
90 }
91 - private static inline void _scroll_top (ref ListBox main_list_box)
92 + private static inline void _scroll_top (ListBox main_list_box)
93 {
94 Adjustment adjustment = main_list_box.get_adjustment ();
95 adjustment.set_value (adjustment.get_lower ());
96 @@ -215,9 +215,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
97
98 protected void scroll_bottom ()
99 {
100 - _scroll_bottom (ref main_list_box);
101 + _scroll_bottom (main_list_box);
102 }
103 - private static inline void _scroll_bottom (ref ListBox main_list_box)
104 + private static inline void _scroll_bottom (ListBox main_list_box)
105 {
106 Adjustment adjustment = main_list_box.get_adjustment ();
107 adjustment.set_value (adjustment.get_upper ());
108 @@ -225,9 +225,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
109
110 internal bool handle_copy_text (out string copy_text)
111 {
112 - return _handle_copy_text (out copy_text, ref main_list_box);
113 + return _handle_copy_text (out copy_text, main_list_box);
114 }
115 - private static inline bool _handle_copy_text (out string copy_text, ref ListBox main_list_box)
116 + private static inline bool _handle_copy_text (out string copy_text, ListBox main_list_box)
117 {
118 List<weak ListBoxRow> selected_rows = main_list_box.get_selected_rows ();
119 OverlayedListRow row;
120 @@ -283,9 +283,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
121
122 internal SelectionState get_selection_state ()
123 {
124 - return _get_selection_state (ref main_list_box, ref main_list_store);
125 + return _get_selection_state (main_list_box, ref main_list_store);
126 }
127 - private static inline SelectionState _get_selection_state (ref ListBox main_list_box, ref GLib.ListStore main_list_store)
128 + private static inline SelectionState _get_selection_state (ListBox main_list_box, ref GLib.ListStore main_list_store)
129 {
130 List<weak ListBoxRow> selected_rows = main_list_box.get_selected_rows ();
131 uint n_selected_rows = selected_rows.length ();
0 From: Rico Tzschichholz <ricotz@ubuntu.com>
1 Date: Wed, 17 Mar 2021 11:32:49 +0100
2 Subject: Reference of [GtkChild] fields is handled by GtkBuilder,
3 type must be unowned
4
5 (cherry picked from commit 66be44dc20d114e449fc33156e3939fd05dfbb16)
6 ---
7 src/base-headerbar.vala | 14 +++++++-------
8 src/base-view.vala | 4 ++--
9 src/base-window.vala | 6 +++---
10 src/game-actionbar.vala | 6 +++---
11 src/game-headerbar.vala | 4 ++--
12 src/new-game-screen.vala | 18 +++++++++---------
13 src/notifications-revealer.vala | 2 +-
14 src/overlayed-list.vala | 10 +++++-----
15 src/registry-placeholder.vala | 4 ++--
16 9 files changed, 34 insertions(+), 34 deletions(-)
17
18 diff --git a/src/base-headerbar.vala b/src/base-headerbar.vala
19 index 8cb5774..315746f 100644
20 --- a/src/base-headerbar.vala
21 +++ b/src/base-headerbar.vala
22 @@ -20,7 +20,7 @@ using Gtk;
23 [GtkTemplate (ui = "/org/gnome/Taquin/ui/base-headerbar.ui")]
24 private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
25 {
26 - [GtkChild] protected Box center_box;
27 + [GtkChild] protected unowned Box center_box;
28
29 construct
30 {
31 @@ -190,13 +190,13 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
32 * * default widgets
33 \*/
34
35 - [GtkChild] private Button go_back_button;
36 - [GtkChild] private Separator ltr_left_separator;
37 - [GtkChild] private Label title_label;
38 - [GtkChild] private MenuButton info_button;
39 - [GtkChild] private Separator ltr_right_separator;
40 + [GtkChild] private unowned Button go_back_button;
41 + [GtkChild] private unowned Separator ltr_left_separator;
42 + [GtkChild] private unowned Label title_label;
43 + [GtkChild] private unowned MenuButton info_button;
44 + [GtkChild] private unowned Separator ltr_right_separator;
45
46 - [GtkChild] protected Stack quit_button_stack;
47 + [GtkChild] protected unowned Stack quit_button_stack;
48
49 protected void set_default_widgets_states (string? title_label_text_or_null,
50 bool show_go_back_button,
51 diff --git a/src/base-view.vala b/src/base-view.vala
52 index cc54855..2c74499 100644
53 --- a/src/base-view.vala
54 +++ b/src/base-view.vala
55 @@ -20,7 +20,7 @@ using Gtk;
56 [GtkTemplate (ui = "/org/gnome/Taquin/ui/base-view.ui")]
57 private class BaseView : Stack, AdaptativeWidget
58 {
59 - [GtkChild] protected Grid main_grid;
60 + [GtkChild] protected unowned Grid main_grid;
61
62 internal virtual bool handle_copy_text (out string copy_text)
63 {
64 @@ -109,7 +109,7 @@ private class BaseView : Stack, AdaptativeWidget
65 * * notifications
66 \*/
67
68 - [GtkChild] private Overlay notifications_overlay;
69 + [GtkChild] private unowned Overlay notifications_overlay;
70
71 private bool notifications_revealer_created = false;
72 private NotificationsRevealer notifications_revealer;
73 diff --git a/src/base-window.vala b/src/base-window.vala
74 index 2c652ab..02e0de6 100644
75 --- a/src/base-window.vala
76 +++ b/src/base-window.vala
77 @@ -74,9 +74,9 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
78 * * main layout
79 \*/
80
81 - [GtkChild] private Grid main_grid;
82 - [GtkChild] private Button unfullscreen_button;
83 - [GtkChild] private Overlay main_overlay;
84 + [GtkChild] private unowned Grid main_grid;
85 + [GtkChild] private unowned Button unfullscreen_button;
86 + [GtkChild] private unowned Overlay main_overlay;
87
88 protected void add_to_main_overlay (Widget widget)
89 {
90 diff --git a/src/game-actionbar.vala b/src/game-actionbar.vala
91 index e75907e..5ff275f 100644
92 --- a/src/game-actionbar.vala
93 +++ b/src/game-actionbar.vala
94 @@ -28,8 +28,8 @@ private class GameActionBar : Revealer, AdaptativeWidget
95 [CCode (notify = false)] public string window_name { private get; protected construct set; default = "" ; }
96 [CCode (notify = false)] public Widget? game_widget { private get; protected construct ; default = null ; }
97
98 - [GtkChild] private ActionBar action_bar;
99 - [GtkChild] private Label game_label;
100 + [GtkChild] private unowned ActionBar action_bar;
101 + [GtkChild] private unowned Label game_label;
102
103 construct
104 {
105 @@ -93,7 +93,7 @@ private class GameActionBar : Revealer, AdaptativeWidget
106 [GtkTemplate (ui = "/org/gnome/Taquin/ui/game-actionbar-placeholder.ui")]
107 private class GameActionBarPlaceHolder : Revealer, AdaptativeWidget
108 {
109 - [GtkChild] private Widget placeholder_child;
110 + [GtkChild] private unowned Widget placeholder_child;
111 private GameActionBar actionbar;
112
113 internal GameActionBarPlaceHolder (GameActionBar _actionbar)
114 diff --git a/src/game-headerbar.vala b/src/game-headerbar.vala
115 index 94fb7de..324b7bd 100644
116 --- a/src/game-headerbar.vala
117 +++ b/src/game-headerbar.vala
118 @@ -23,8 +23,8 @@ using Gtk;
119 [GtkTemplate (ui = "/org/gnome/Taquin/ui/game-headerbar.ui")]
120 private class GameHeaderBar : BaseHeaderBar, AdaptativeWidget
121 {
122 - [GtkChild] private Button new_game_button;
123 - [GtkChild] private Button back_button;
124 + [GtkChild] private unowned Button new_game_button;
125 + [GtkChild] private unowned Button back_button;
126
127 [CCode (notify = false)] public bool window_has_name { private get; protected construct set; default = false; }
128 [CCode (notify = false)] public string window_name { private get; protected construct set; default = ""; }
129 diff --git a/src/new-game-screen.vala b/src/new-game-screen.vala
130 index 3e56b2f..e6919e5 100644
131 --- a/src/new-game-screen.vala
132 +++ b/src/new-game-screen.vala
133 @@ -23,11 +23,11 @@ using Gtk;
134 [GtkTemplate (ui = "/org/gnome/Taquin/ui/new-game-screen.ui")]
135 private class NewGameScreen : Box, AdaptativeWidget
136 {
137 - [GtkChild] private ModelButton modelbutton_one;
138 - [GtkChild] private ModelButton modelbutton_two;
139 + [GtkChild] private unowned ModelButton modelbutton_one;
140 + [GtkChild] private unowned ModelButton modelbutton_two;
141
142 - [GtkChild] private Gtk.MenuButton menubutton_one;
143 - [GtkChild] private Gtk.MenuButton menubutton_two;
144 + [GtkChild] private unowned Gtk.MenuButton menubutton_one;
145 + [GtkChild] private unowned Gtk.MenuButton menubutton_two;
146
147 construct
148 {
149 @@ -106,12 +106,12 @@ private class NewGameScreen : Box, AdaptativeWidget
150 map.connect (() => games_box.show ());
151 }
152
153 - [GtkChild] private Box games_box;
154 - [GtkChild] private Box options_box;
155 + [GtkChild] private unowned Box games_box;
156 + [GtkChild] private unowned Box options_box;
157
158 - [GtkChild] private Label games_label;
159 - [GtkChild] private Label options_label;
160 - [GtkChild] private Separator options_separator;
161 + [GtkChild] private unowned Label games_label;
162 + [GtkChild] private unowned Label options_label;
163 + [GtkChild] private unowned Separator options_separator;
164
165 private bool phone_size = false;
166 private bool extra_thin = false;
167 diff --git a/src/notifications-revealer.vala b/src/notifications-revealer.vala
168 index 8831e3e..92813d5 100644
169 --- a/src/notifications-revealer.vala
170 +++ b/src/notifications-revealer.vala
171 @@ -20,7 +20,7 @@ using Gtk;
172 [GtkTemplate (ui = "/org/gnome/Taquin/ui/notifications-revealer.ui")]
173 private class NotificationsRevealer : Revealer, AdaptativeWidget
174 {
175 - [GtkChild] private Label notification_label;
176 + [GtkChild] private unowned Label notification_label;
177
178 construct
179 {
180 diff --git a/src/overlayed-list.vala b/src/overlayed-list.vala
181 index 3fbb1c3..18891de 100644
182 --- a/src/overlayed-list.vala
183 +++ b/src/overlayed-list.vala
184 @@ -20,12 +20,12 @@ using Gtk;
185 [GtkTemplate (ui = "/org/gnome/Taquin/ui/overlayed-list.ui")]
186 private abstract class OverlayedList : Overlay, AdaptativeWidget
187 {
188 - [GtkChild] protected ListBox main_list_box;
189 + [GtkChild] protected unowned ListBox main_list_box;
190 private StyleContext main_list_box_context;
191 protected GLib.ListStore main_list_store = new GLib.ListStore (typeof (Widget));
192
193 - [GtkChild] private ScrolledWindow scrolled;
194 - [GtkChild] private Box edit_mode_box;
195 + [GtkChild] private unowned ScrolledWindow scrolled;
196 + [GtkChild] private unowned Box edit_mode_box;
197
198 /*\
199 * * differed construct
200 @@ -45,8 +45,8 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
201 }
202
203
204 - [GtkChild] private ModelButton enter_edit_mode_button;
205 - [GtkChild] private ModelButton leave_edit_mode_button;
206 + [GtkChild] private unowned ModelButton enter_edit_mode_button;
207 + [GtkChild] private unowned ModelButton leave_edit_mode_button;
208 [CCode (notify = false)] public string edit_mode_action_prefix
209 {
210 construct
211 diff --git a/src/registry-placeholder.vala b/src/registry-placeholder.vala
212 index b92c464..c662aff 100644
213 --- a/src/registry-placeholder.vala
214 +++ b/src/registry-placeholder.vala
215 @@ -20,8 +20,8 @@ using Gtk;
216 [GtkTemplate (ui = "/org/gnome/Taquin/ui/registry-placeholder.ui")]
217 private class RegistryPlaceholder : Grid
218 {
219 - [GtkChild] private Label placeholder_label;
220 - [GtkChild] private Image placeholder_image;
221 + [GtkChild] private unowned Label placeholder_label;
222 + [GtkChild] private unowned Image placeholder_image;
223
224 [CCode (notify = false)] public string label { internal construct set { placeholder_label.label = value; }}
225 [CCode (notify = false)] public string icon_name { private get; internal construct; }
0 Don-t-alter-or-try-to-write-GtkChild-fields.patch
1 Reference-of-GtkChild-fields-is-handled-by-GtkBuilder-typ.patch