-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathApplicationGrid.vala
More file actions
54 lines (44 loc) · 1.45 KB
/
ApplicationGrid.vala
File metadata and controls
54 lines (44 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* SPDX-License-Identifier: GPL-3.0
* SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
*/
public class Dock.ApplicationGrid : Granite.Bin {
private AppCache app_cache;
private Adw.Carousel carousel;
construct {
app_cache = AppSystem.get_default ().app_cache;
carousel = new Adw.Carousel () {
hexpand = true,
vexpand = true
};
var dots = new Adw.CarouselIndicatorDots () {
carousel = carousel
};
var box = new Gtk.Box (VERTICAL, 6) {
margin_bottom = 12,
margin_top = 12,
margin_start = 12,
margin_end = 12
};
box.append (carousel);
box.append (dots);
child = box;
height_request = ApplicationMenu.HEIGHT;
width_request = ApplicationMenu.WIDTH;
repopulate_carousel ();
app_cache.apps.items_changed.connect (repopulate_carousel);
}
private void repopulate_carousel () {
var n_pages = app_cache.apps.n_items / ApplicationGridPage.PAGE_SIZE;
for (int i = 0; i < n_pages; i++) {
if (i < carousel.n_pages) {
continue;
}
var page = new ApplicationGridPage (app_cache.apps, i);
carousel.append (page);
}
// for (uint i = carousel.n_pages - 1; i >= n_pages; i--) {
// carousel.remove (carousel.get_nth_page (i));
// }
}
}