1717 * Authored by: Corentin Noël <corentin@elementaryos.org>
1818 */
1919
20- public class Maya.View.Widgets.CalendarChooser : Gtk .Grid {
20+ public class Maya.View.Widgets.CalendarChooser : Gtk .Box {
2121
2222 /* * A searchable list of calendars for the user to choose from.
2323 *
@@ -45,10 +45,13 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Grid {
4545
4646 current_source = registry. default_calendar;
4747
48- search_entry = new Gtk .SearchEntry ();
49- search_entry. margin = 12 ;
50- search_entry. margin_bottom = 6 ;
51- search_entry. placeholder_text = _(" Search Calendars" );
48+ search_entry = new Gtk .SearchEntry () {
49+ margin_top = 12 ,
50+ margin_end = 12 ,
51+ margin_bottom = 6 ,
52+ margin_start = 12 ,
53+ placeholder_text = _ ("Search Calendars ")
54+ };
5255
5356 var placeholder = new Granite .Widgets .AlertView (
5457 _(" No Results" ),
@@ -57,19 +60,22 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Grid {
5760 );
5861 placeholder.show_all ();
5962
60- var list_box = new Gtk .ListBox ();
61- list_box. activate_on_single_click = true ;
63+ var list_box = new Gtk .ListBox () {
64+ activate_on_single_click = true
65+ };
6266 list_box.set_placeholder (placeholder );
6367
64- var scrolled = new Gtk .ScrolledWindow (null , null );
65- scrolled. hscrollbar_policy = Gtk . PolicyType . NEVER ;
66- scrolled. add (list_box);
67- scrolled. max_content_height = 300 ;
68- scrolled. propagate_natural_height = true ;
68+ var scrolled = new Gtk .ScrolledWindow (null , null ) {
69+ child = list_box,
70+ hscrollbar_policy = NEVER ,
71+ max_content_height = 300 ,
72+ propagate_natural_height = true
73+ };
6974
7075 margin_bottom = 6 ;
71- attach (search_entry, 0 , 0 );
72- attach (scrolled, 0 , 1 );
76+ orientation = VERTICAL ;
77+ add (search_entry );
78+ add (scrolled );
7379 show_all ();
7480
7581 list_box.set_filter_func (filter_function );
@@ -125,12 +131,16 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Grid {
125131
126132 // Populate list_box
127133 foreach (var source in sources ) {
128- var calrow = new CalendarRow (source);
129- calrow. margin = 6 ;
130- calrow. margin_start = 12 ;
131-
132- var row = new Gtk .ListBoxRow ();
133- row. add (calrow);
134+ var calrow = new CalendarRow (source) {
135+ margin_top = 6 ,
136+ margin_end = 6 ,
137+ margin_bottom = 6 ,
138+ margin_start = 12
139+ };
140+
141+ var row = new Gtk .ListBoxRow () {
142+ child = calrow
143+ };
134144 row. show_all ();
135145
136146 list_box. add (row);
@@ -163,9 +173,11 @@ public class Maya.View.Widgets.CalendarChooser : Gtk.Grid {
163173 }
164174 }
165175
166- var header = new Granite .HeaderLabel (row_location);
167- header. margin = 6 ;
168- header. margin_bottom = 0 ;
176+ var header = new Granite .HeaderLabel (row_location) {
177+ margin_top = 6 ,
178+ margin_end = 6 ,
179+ margin_start = 6
180+ };
169181
170182 row. set_header (header);
171183
0 commit comments