@@ -25,7 +25,7 @@ public class MainWindow : Gtk.ApplicationWindow {
2525 private Gtk . Entry body_entry;
2626 private Gtk . Entry icon_entry;
2727 private Gtk . Entry id_entry;
28- private Gtk . ComboBoxText priority_combobox ;
28+ private Gtk . DropDown priority_dropdown ;
2929 private Gtk . SpinButton action_spinbutton;
3030
3131 public MainWindow (Gtk .Application application ) {
@@ -60,51 +60,56 @@ public class MainWindow : Gtk.ApplicationWindow {
6060
6161 var priority_label = new Gtk .Label (" Priority:" );
6262
63- priority_combobox = new Gtk .ComboBoxText () {
64- hexpand = true
63+ string [] priorities = {
64+ " Low" ,
65+ " Normal" ,
66+ " High" ,
67+ " Urgent" ,
68+ };
69+ priority_dropdown = new Gtk .DropDown .from_strings (priorities) {
70+ hexpand = true ,
71+ selected = 1
6572 };
66- priority_combobox. append_text (" Low" );
67- priority_combobox. append_text (" Normal" );
68- priority_combobox. append_text (" High" );
69- priority_combobox. append_text (" Urgent" );
70- priority_combobox. set_active (1 );
7173
7274 var action_label = new Gtk .Label (" Actions:" );
7375
7476 action_spinbutton = new Gtk .SpinButton .with_range (0 , 3 , 1 );
7577
7678 var send_button = new Gtk .Button .with_label (" Send Notification" ) {
77- can_default = true ,
7879 halign = Gtk . Align . END ,
7980 margin_top = 12
8081 };
81- send_button. get_style_context () . add_class ( Gtk . STYLE_CLASS_SUGGESTED_ACTION );
82+ send_button. add_css_class ( Granite . CssClass . SUGGESTED );
8283
8384 var grid = new Gtk .Grid () {
8485 valign = Gtk . Align . CENTER ,
8586 column_spacing = 12 ,
8687 row_spacing = 12 ,
87- margin = 12
88+ margin_top = 12 ,
89+ margin_bottom = 12 ,
90+ margin_start = 12 ,
91+ margin_end = 12
8892 };
8993 grid. attach (title_entry, 0 , 0 , 2 );
9094 grid. attach (body_entry, 0 , 1 , 2 );
9195 grid. attach (id_entry, 0 , 2 , 2 );
9296 grid. attach (icon_entry, 0 , 3 , 2 );
9397 grid. attach (priority_label, 0 , 4 );
94- grid. attach (priority_combobox , 1 , 4 );
98+ grid. attach (priority_dropdown , 1 , 4 );
9599 grid. attach (action_label, 0 , 5 );
96100 grid. attach (action_spinbutton, 1 , 5 );
97101 grid. attach (send_button, 0 , 6 , 2 );
98102
99- var toast = new Granite .Widgets . Toast (" " );
103+ var toast = new Granite .Toast (" " );
100104
101- var overlay = new Gtk .Overlay ();
102- overlay. add (grid);
105+ var overlay = new Gtk .Overlay () {
106+ child = grid
107+ };
103108 overlay. add_overlay (toast);
104109
105- add (overlay);
110+ child = overlay;
111+ default_widget = send_button;
106112
107- send_button. has_default = true ;
108113 send_button. clicked. connect (send_notification);
109114
110115 var toast_action = new SimpleAction (" toast" , VariantType . STRING );
@@ -119,7 +124,7 @@ public class MainWindow : Gtk.ApplicationWindow {
119124
120125 private void send_notification () {
121126 NotificationPriority priority;
122- switch (priority_combobox . active ) {
127+ switch (priority_dropdown . selected ) {
123128 case 3 :
124129 priority = NotificationPriority . URGENT ;
125130 break ;
0 commit comments