Minor grouped notifications fixes
This commit is contained in:
@@ -163,6 +163,23 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void set_icon () {
|
||||||
|
if (is_empty ()) return;
|
||||||
|
|
||||||
|
unowned Notification first = (Notification) group.widgets.first ().data;
|
||||||
|
unowned NotifyParams param = first.param;
|
||||||
|
// Get the app icon
|
||||||
|
Icon ? icon = null;
|
||||||
|
if (param.desktop_app_info != null
|
||||||
|
&& (icon = param.desktop_app_info.get_icon ()) != null) {
|
||||||
|
app_icon.set_from_gicon (icon, Gtk.IconSize.LARGE_TOOLBAR);
|
||||||
|
app_icon.show ();
|
||||||
|
} else {
|
||||||
|
app_icon.set_from_icon_name ("application-x-executable-symbolic",
|
||||||
|
Gtk.IconSize.LARGE_TOOLBAR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns if there's more than one notification
|
/// Returns if there's more than one notification
|
||||||
public bool only_single_notification () {
|
public bool only_single_notification () {
|
||||||
unowned Gtk.Widget ? widget = group.widgets.nth_data (1);
|
unowned Gtk.Widget ? widget = group.widgets.nth_data (1);
|
||||||
@@ -190,8 +207,12 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
group.add (noti);
|
group.add (noti);
|
||||||
if (!only_single_notification ()) {
|
if (!only_single_notification ()) {
|
||||||
|
if (!group.is_expanded) {
|
||||||
group.set_sensitive (false);
|
group.set_sensitive (false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
set_icon ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove_notification (Notification noti) {
|
public void remove_notification (Notification noti) {
|
||||||
@@ -240,23 +261,7 @@ namespace SwayNotificationCenter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update () {
|
public void update () {
|
||||||
if (!is_empty ()) {
|
set_icon ();
|
||||||
unowned Notification first = (Notification) group.widgets.first ().data;
|
|
||||||
unowned NotifyParams param = first.param;
|
|
||||||
// Get the app icon
|
|
||||||
Icon ? icon = null;
|
|
||||||
if (param.desktop_app_info != null
|
|
||||||
&& (icon = param.desktop_app_info.get_icon ()) != null) {
|
|
||||||
app_icon.set_from_gicon (icon, Gtk.IconSize.LARGE_TOOLBAR);
|
|
||||||
app_icon.show ();
|
|
||||||
} else {
|
|
||||||
app_icon.set_from_icon_name ("application-x-executable-symbolic",
|
|
||||||
Gtk.IconSize.LARGE_TOOLBAR);
|
|
||||||
// app_icon.hide ();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// app_icon.hide ();
|
|
||||||
}
|
|
||||||
foreach (unowned Gtk.Widget widget in group.widgets) {
|
foreach (unowned Gtk.Widget widget in group.widgets) {
|
||||||
var noti = (Notification) widget;
|
var noti = (Notification) widget;
|
||||||
if (noti != null) noti.set_time ();
|
if (noti != null) noti.set_time ();
|
||||||
|
Reference in New Issue
Block a user