functions: replace deprecated get_preferred_size() with pixel_size

parent 1751b630
...@@ -42,12 +42,11 @@ namespace XimperShellNotificationCenter { ...@@ -42,12 +42,11 @@ namespace XimperShellNotificationCenter {
uri = uri.slice (URI_PREFIX.length, uri.length); uri = uri.slice (URI_PREFIX.length, uri.length);
} }
Gtk.Requisition natural_size; int size = img.pixel_size > 0 ? img.pixel_size : 64;
img.get_preferred_size (null, out natural_size);
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file_at_size ( Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.from_file_at_size (
Uri.unescape_string (uri), Uri.unescape_string (uri),
natural_size.width, natural_size.height); size, size);
Gdk.Texture texture = Gdk.Texture.for_pixbuf (pixbuf); Gdk.Texture texture = Gdk.Texture.for_pixbuf (pixbuf);
img.set_from_paintable (texture); img.set_from_paintable (texture);
...@@ -68,8 +67,7 @@ namespace XimperShellNotificationCenter { ...@@ -68,8 +67,7 @@ namespace XimperShellNotificationCenter {
public static void set_image_data (ImageData data, public static void set_image_data (ImageData data,
Gtk.Image img) { Gtk.Image img) {
Gtk.Requisition natural_size; int size = img.pixel_size > 0 ? img.pixel_size : 64;
img.get_preferred_size (null, out natural_size);
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.with_unowned_data (data.data, Gdk.Pixbuf pixbuf = new Gdk.Pixbuf.with_unowned_data (data.data,
Gdk.Colorspace.RGB, Gdk.Colorspace.RGB,
...@@ -79,8 +77,8 @@ namespace XimperShellNotificationCenter { ...@@ -79,8 +77,8 @@ namespace XimperShellNotificationCenter {
data.height, data.height,
data.rowstride, data.rowstride,
null); null);
Gdk.Pixbuf scaled = pixbuf.scale_simple (natural_size.width, Gdk.Pixbuf scaled = pixbuf.scale_simple (size,
natural_size.height, size,
Gdk.InterpType.BILINEAR); Gdk.InterpType.BILINEAR);
Gdk.Texture texture = Gdk.Texture.for_pixbuf (scaled); Gdk.Texture texture = Gdk.Texture.for_pixbuf (scaled);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment