Skip to content

Commit 7037022

Browse files
authored
Merge branch 'main' into lenemter/remove-custom-close-animation
2 parents eb074b7 + 2db9b55 commit 7037022

File tree

5 files changed

+26
-59
lines changed

5 files changed

+26
-59
lines changed

demo/Application.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Application : Gtk.Application {
4141
});
4242

4343
var window = new MainWindow (this);
44-
window.show_all ();
44+
window.present ();
4545
}
4646

4747
public static int main (string[] args) {

demo/MainWindow.vala

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

demo/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ executable(
33
'Application.vala',
44
'MainWindow.vala',
55
dependencies : [
6-
dependency ('granite'),
7-
dependency ('gtk+-3.0'),
6+
dependency ('granite-7', version: '>=7.7.0'),
7+
dependency ('gtk4'),
88
],
99
install : true
1010
)

meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ gnome = import('gnome')
88
i18n = import('i18n')
99

1010
add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c')
11-
add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')], language: 'vala')
1211

1312
css_gresource = gnome.compile_resources(
1413
'css-resource',

vapi/libcanberra-gtk3.vapi

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)