mirror of
https://github.com/zoriya/ags.git
synced 2026-05-28 00:52:11 +00:00
update example configs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { Window, Box, Label } = ags.Widget;
|
||||
const { Window, Box, Label, EventBox } = ags.Widget;
|
||||
import {
|
||||
NotificationList, DNDSwitch, ClearButton, PopupList,
|
||||
} from './widgets.js';
|
||||
@@ -19,10 +19,19 @@ const NotificationCenter = () => Window({
|
||||
popup: true,
|
||||
focusable: true,
|
||||
child: Box({
|
||||
vertical: true,
|
||||
children: [
|
||||
Header(),
|
||||
NotificationList(),
|
||||
EventBox({
|
||||
hexpand: true,
|
||||
connections: [['button-press-event', () =>
|
||||
ags.App.closeWindow('notification-center')]]
|
||||
}),
|
||||
Box({
|
||||
vertical: true,
|
||||
children: [
|
||||
Header(),
|
||||
NotificationList(),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -7,10 +7,11 @@ const List = () => Box({
|
||||
vertical: true,
|
||||
vexpand: true,
|
||||
connections: [[Notifications, box => {
|
||||
box.children = Array.from(Notifications.notifications.values())
|
||||
box.children = Notifications.notifications
|
||||
.reverse()
|
||||
.map(n => Notification(n));
|
||||
|
||||
box.visible = Notifications.notifications.size > 0;
|
||||
box.visible = Notifications.notifications.length > 0;
|
||||
}]],
|
||||
});
|
||||
|
||||
@@ -25,7 +26,7 @@ const Placeholder = () => Box({
|
||||
],
|
||||
connections: [
|
||||
[Notifications, box => {
|
||||
box.visible = Notifications.notifications.size === 0;
|
||||
box.visible = Notifications.notifications.length === 0;
|
||||
}],
|
||||
],
|
||||
});
|
||||
@@ -46,7 +47,7 @@ export const NotificationList = () => Scrollable({
|
||||
export const ClearButton = () => Button({
|
||||
onClicked: Notifications.clear,
|
||||
connections: [[Notifications, button => {
|
||||
button.sensitive = Notifications.notifications.size > 0;
|
||||
button.sensitive = Notifications.notifications.length > 0;
|
||||
}]],
|
||||
child: Box({
|
||||
children: [
|
||||
@@ -57,7 +58,7 @@ export const ClearButton = () => Button({
|
||||
['false', Icon('user-trash-symbolic')],
|
||||
],
|
||||
connections: [[Notifications, stack => {
|
||||
stack.shown = `${Notifications.notifications.size > 0}`;
|
||||
stack.shown = `${Notifications.notifications.length > 0}`;
|
||||
}]],
|
||||
}),
|
||||
],
|
||||
|
||||
@@ -59,13 +59,12 @@ const Notification = () => Box({
|
||||
Icon({
|
||||
icon: 'preferences-system-notifications-symbolic',
|
||||
connections: [
|
||||
[Notifications, icon => icon.visible = Notifications.popups.size > 0],
|
||||
[Notifications, icon => icon.visible = Notifications.popups.length > 0],
|
||||
],
|
||||
}),
|
||||
Label({
|
||||
connections: [[Notifications, label => {
|
||||
// notifications is a map, to get the last elememnt lets make an array
|
||||
label.label = Array.from(Notifications.popups.values())?.pop()?.summary || '';
|
||||
label.label = Notifications.popups[0]?.summary || '';
|
||||
}]],
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user