@@ -129,31 +129,31 @@ public class EventDialog : Granite.Dialog {
129129 stack. child_set_property (reminder_panel, " icon-name" , " alarm-symbolic" );
130130 stack. child_set_property (repeat_panel, " icon-name" , " media-playlist-repeat-symbolic" );
131131
132- var stack_switcher = new Gtk .StackSwitcher ();
133- stack_switcher. homogeneous = true ;
134- stack_switcher. margin = 12 ;
135- stack_switcher. margin_top = 0 ;
136- stack_switcher. stack = stack;
137-
138- var buttonbox = new Gtk .ButtonBox (Gtk . Orientation . HORIZONTAL );
139- buttonbox. margin_top = 6 ;
140- buttonbox. margin_end = 12 ;
141- buttonbox. margin_start = 12 ;
142- buttonbox. spacing = 6 ;
132+ var stack_switcher = new Gtk .StackSwitcher () {
133+ homogeneous = true ,
134+ margin_end = 12 ,
135+ margin_start = 12 ,
136+ stack = stack
137+ };
143138
144- buttonbox. baseline_position = Gtk . BaselinePosition . CENTER ;
145- buttonbox. set_layout (Gtk . ButtonBoxStyle . END );
139+ var buttonbox = new Gtk .Box (HORIZONTAL , 6 ) {
140+ baseline_position = CENTER ,
141+ margin_end = 12 ,
142+ margin_start = 12
143+ };
146144
147145 if (date_time == null ) {
148- var delete_button = new Gtk .Button .with_label (_(" Delete Event" ));
146+ var delete_button = new Gtk .Button .with_label (_(" Delete Event…" )) {
147+ halign = START ,
148+ hexpand = true
149+ };
149150 delete_button. get_style_context (). add_class (Gtk . STYLE_CLASS_DESTRUCTIVE_ACTION );
150151 delete_button. clicked. connect (remove_event);
152+
151153 buttonbox. add (delete_button);
152- buttonbox. set_child_secondary (delete_button, true );
153- buttonbox. set_child_non_homogeneous (delete_button, true );
154154 }
155155
156- Gtk . Button create_button = new Gtk .Button ();
156+ var create_button = new Gtk .Button ();
157157 create_button. get_style_context (). add_class (Gtk . STYLE_CLASS_SUGGESTED_ACTION );
158158 create_button. clicked. connect (save_dialog);
159159
@@ -170,20 +170,22 @@ public class EventDialog : Granite.Dialog {
170170 buttonbox. add (cancel_button);
171171 buttonbox. add (create_button);
172172
173- var grid = new Gtk .Grid ();
174- grid. row_spacing = 6 ;
175- grid. column_spacing = 12 ;
176- grid. attach (stack_switcher, 0 , 0 , 1 , 1 );
177- grid. attach (stack, 0 , 1 , 1 , 1 );
178- grid. attach (buttonbox, 0 , 2 , 1 , 1 );
173+ var button_sizegroup = new Gtk .SizeGroup (HORIZONTAL );
174+ button_sizegroup. add_widget (cancel_button);
175+ button_sizegroup. add_widget (create_button);
176+
177+ var box = new Gtk .Box (VERTICAL , 24 );
178+ box. add (stack_switcher);
179+ box. add (stack);
180+ box. add (buttonbox);
181+ box. show_all ();
179182
180- (( Gtk . Container ) get_content_area ()) . add (grid );
183+ get_content_area (). add (box );
181184
182185 info_panel. valid_event. connect ((is_valid) = > {
183186 create_button. sensitive = is_valid;
184187 });
185188
186- show_all ();
187189 stack. set_visible_child_name (" infopanel" );
188190 }
189191
@@ -216,12 +218,20 @@ public class EventDialog : Granite.Dialog {
216218 private void remove_event () {
217219 assert (original_source != null );
218220 var delete_dialog = new Calendar .DeleteEventDialog (original_source, ecal, mod_type) {
221+ modal = true ,
219222 transient_for = this
220223 };
221- var response = delete_dialog. run_dialog ();
222- if (response == Gtk . ResponseType . YES ) {
223- this . destroy ();
224- }
224+
225+ delete_dialog. response. connect ((response) = > {
226+ if (response == Gtk . ResponseType . YES ) {
227+ destroy ();
228+ }
229+
230+ delete_dialog. destroy ();
231+ });
232+
233+ delete_dialog. present ();
234+
225235 }
226236 }
227237}
0 commit comments