File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/Library/demos/View Switcher Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #! / usr/ bin/ env - S vala workbench. vala -- pkg gtk4 -- pkg libadwaita- 1
2+
3+ public void main() {
4+ var notifications_page = workbench. builder. get_object(" page3" ) as Adw . ViewStackPage ;
5+ var notification_list = workbench. builder. get_object(" notification_list" ) as Gtk . ListBox ;
6+
7+ int notification_count = 5 ;
8+
9+ notifications_page. badge_number = notification_count;
10+
11+ for (int i = 0 ; i < notification_count; i++ ){
12+ var notification_row = new Adw .ActionRow (){
13+ title = " Notification" ,
14+ selectable = false ,
15+ };
16+
17+ var button = new Gtk .Button (){
18+ halign = Gtk . Align . CENTER ,
19+ valign = Gtk . Align . CENTER ,
20+ margin_top = 10 ,
21+ margin_bottom = 10 ,
22+ icon_name = " check-plain-symbolic"
23+ };
24+
25+ button. clicked. connect( () = > {
26+ notifications_page. badge_number = -- notification_count;
27+ notification_list. remove(notification_row);
28+
29+ if (notifications_page. badge_number == 0 )
30+ notifications_page. needs_attention = false ;
31+ });
32+
33+ notification_row. add_suffix(button);
34+
35+ notification_list. append(notification_row);
36+ }
37+ }
38+
You can’t perform that action at this time.
0 commit comments