mirror of
https://github.com/elementary/gala.git
synced 2024-12-24 17:53:19 +03:00
add support for icon only notifications
This commit is contained in:
parent
904cf24f2e
commit
8e02d3f552
@ -37,10 +37,11 @@ namespace Gala.Plugins.Notify
|
||||
}
|
||||
}
|
||||
|
||||
public ConfirmationNotification (uint32 id, Gdk.Pixbuf? icon, int progress)
|
||||
public ConfirmationNotification (uint32 id, Gdk.Pixbuf? icon, bool icon_only, int progress)
|
||||
{
|
||||
base (id, icon, NotificationUrgency.LOW, DURATION);
|
||||
|
||||
this.icon_only = icon_only;
|
||||
this.has_progress = progress > -1;
|
||||
this.progress = progress;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ namespace Gala.Plugins.Notify
|
||||
public uint64 relevancy_time { get; private set; }
|
||||
public bool being_destroyed { get; private set; default = false; }
|
||||
|
||||
protected bool icon_only { get; protected set; default = false; }
|
||||
|
||||
GtkClutter.Texture icon_texture;
|
||||
GtkClutter.Texture close_button;
|
||||
|
||||
@ -267,7 +269,8 @@ namespace Gala.Plugins.Notify
|
||||
public override void allocate (ActorBox box, AllocationFlags flags)
|
||||
{
|
||||
var icon_alloc = ActorBox ();
|
||||
icon_alloc.set_origin (MARGIN + PADDING, MARGIN + PADDING);
|
||||
|
||||
icon_alloc.set_origin (icon_only ? (WIDTH - ICON_SIZE) / 2 : MARGIN + PADDING, MARGIN + PADDING);
|
||||
icon_alloc.set_size (ICON_SIZE, ICON_SIZE);
|
||||
icon_texture.allocate (icon_alloc, flags);
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace Gala.Plugins.Notify
|
||||
|
||||
Notification notification;
|
||||
if (confirmation)
|
||||
notification = new ConfirmationNotification (id, pixbuf,
|
||||
notification = new ConfirmationNotification (id, pixbuf, icon_only,
|
||||
progress ? hints.@get ("value").get_int32 () : -1);
|
||||
else
|
||||
notification = new NormalNotification (stack.screen, id, summary, body, pixbuf,
|
||||
@ -189,7 +189,7 @@ namespace Gala.Plugins.Notify
|
||||
|
||||
var actual_icon = icon;
|
||||
// fix icon names that are sent to notify-osd to the ones that actually exist
|
||||
if (icon.has_prefix ("notification-"))
|
||||
if (icon.has_prefix ("notification-audio"))
|
||||
actual_icon = icon.substring (13) + "-symbolic";
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user