Skip to content

Commit

Permalink
Use IconSize.DIALOG instead of IconSize.INVALID, only scale if icon i…
Browse files Browse the repository at this point in the history
…sn't already 48px in height.

Ref. #2113.
  • Loading branch information
JoshStrobl committed Apr 12, 2021
1 parent 4f239e8 commit 7a5dcfd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/raven/notifications_view.vala
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,14 @@ namespace Budgie {
// rebuild and scale the image
var pixbuf = new Gdk.Pixbuf.with_unowned_data(raw, Gdk.Colorspace.RGB,
has_alpha, bits_per_sample, width, height, rowstride, null);
var scaled_pixbuf = pixbuf.scale_simple(48, 48, Gdk.InterpType.BILINEAR);

if (height != 48) { // Height isn't 48
pixbuf = pixbuf.scale_simple(48, 48, Gdk.InterpType.BILINEAR); // Scale down (or up if it is small)
}

// set the image
if (scaled_pixbuf != null) {
image_icon.set_from_pixbuf(scaled_pixbuf);
if (pixbuf != null) {
image_icon.set_from_pixbuf(pixbuf);
return true;
} else {
return false;
Expand Down Expand Up @@ -337,8 +340,7 @@ namespace Budgie {
this.image_path = null;

if (app_icon != "") {
image_icon.set_from_icon_name(app_icon, Gtk.IconSize.INVALID);
image_icon.pixel_size = 48;
image_icon.set_from_icon_name(app_icon, Gtk.IconSize.DIALOG);
this.icon_name = app_icon;
} else {
/* Use the .desktop icon if we can */
Expand All @@ -353,17 +355,17 @@ namespace Budgie {

if (app_info != null) { // If we got the DesktopAppInfo
if (app_info.has_key("Icon")) {
image_icon.set_from_gicon(app_info.get_icon(), Gtk.IconSize.INVALID);
image_icon.set_from_gicon(app_info.get_icon(), Gtk.IconSize.DIALOG);
set_icon = true;
}
}

if (!set_icon) { // Didn't set the icon from a DesktopAppInfo
image_icon.set_from_icon_name("mail-unread-symbolic", Gtk.IconSize.INVALID);
image_icon.set_from_icon_name("mail-unread-symbolic", Gtk.IconSize.DIALOG);
this.icon_name = "mail-unread-symbolic";
}
} else {
image_icon.set_from_icon_name("mail-unread-symbolic", Gtk.IconSize.INVALID);
image_icon.set_from_icon_name("mail-unread-symbolic", Gtk.IconSize.DIALOG);
this.icon_name = "mail-unread-symbolic";
}

Expand Down

0 comments on commit 7a5dcfd

Please sign in to comment.