Skip to content

Commit fdb864e

Browse files
authored
Update Gtk.Popover construction (#1764)
1 parent 1fc959d commit fdb864e

4 files changed

Lines changed: 18 additions & 19 deletions

File tree

‎src/Widgets/ChooseProjectButton.vala‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ public class Code.ChooseProjectButton : Gtk.MenuButton {
110110
popover_content.show_all ();
111111

112112
var project_popover = new Gtk.Popover (this) {
113-
position = Gtk.PositionType.BOTTOM
113+
position = Gtk.PositionType.BOTTOM,
114+
child = popover_content
114115
};
115-
116-
project_popover.add (popover_content);
117-
118116
popover = project_popover;
119117

120118
// Initialise with any pre-existing projects (needed for second and subsequent window)

‎src/Widgets/FormatBar.vala‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ public class Code.FormatBar : Gtk.Box {
119119

120120
popover_content.show_all ();
121121

122-
var lang_popover = new Gtk.Popover (lang_menubutton);
123-
lang_popover.position = Gtk.PositionType.BOTTOM;
124-
lang_popover.add (popover_content);
125-
122+
var lang_popover = new Gtk.Popover (lang_menubutton) {
123+
position = Gtk.PositionType.BOTTOM,
124+
child = popover_content
125+
};
126126
lang_menubutton.popover = lang_popover;
127127

128128
lang_selection_listbox.row_activated.connect ((row) => {
@@ -180,10 +180,9 @@ public class Code.FormatBar : Gtk.Box {
180180
box.show_all ();
181181

182182
var tab_popover = new Gtk.Popover (tab_menubutton) {
183-
position = Gtk.PositionType.BOTTOM
183+
position = Gtk.PositionType.BOTTOM,
184+
child = box
184185
};
185-
tab_popover.add (box);
186-
187186
tab_menubutton.popover = tab_popover;
188187

189188
Scratch.settings.changed["indent-width"].connect (format_tab_header_from_global_settings);
@@ -251,10 +250,10 @@ public class Code.FormatBar : Gtk.Box {
251250
line_grid.attach (goto_entry, 1, 0, 1, 1);
252251
line_grid.show_all ();
253252

254-
var line_popover = new Gtk.Popover (line_menubutton);
255-
line_popover.position = Gtk.PositionType.BOTTOM;
256-
line_popover.add (line_grid);
257-
253+
var line_popover = new Gtk.Popover (line_menubutton) {
254+
position = Gtk.PositionType.BOTTOM,
255+
child = line_grid
256+
};
258257
line_menubutton.popover = line_popover;
259258

260259
// We need to connect_after because otherwise, the text isn't parsed into the "value" property and we only get the previous value

‎src/Widgets/HeaderBar.vala‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ public class Scratch.HeaderBar : Hdy.HeaderBar {
225225
menu_box.add (preferences_menuitem);
226226
menu_box.show_all ();
227227

228-
var menu = new Gtk.Popover (null);
229-
menu.add (menu_box);
228+
var menu = new Gtk.Popover (null) {
229+
child = menu_box
230+
};
230231

231232
var app_menu = new Gtk.MenuButton () {
232233
image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR),

‎src/Widgets/SearchBar.vala‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ namespace Scratch.Widgets {
172172
search_option_box.add (whole_word_search_button);
173173
search_option_box.add (regex_search_button);
174174

175-
var search_popover = new Gtk.Popover (null);
176-
search_popover.add (search_option_box);
175+
var search_popover = new Gtk.Popover (null) {
176+
child = search_option_box
177+
};
177178
search_popover.show_all ();
178179

179180
var search_buttonbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);

0 commit comments

Comments
 (0)