[baobab] Force icon to be always 64x64
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Force icon to be always 64x64
- Date: Sat, 4 Aug 2012 14:03:03 +0000 (UTC)
commit e987f0a8658e9739b97780ddd8c10ea49b07a062
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Aug 4 16:01:25 2012 +0200
Force icon to be always 64x64
src/baobab-location-widget.vala | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/baobab-location-widget.vala b/src/baobab-location-widget.vala
index 6cd7b82..fa0e4f2 100644
--- a/src/baobab-location-widget.vala
+++ b/src/baobab-location-widget.vala
@@ -24,6 +24,7 @@ namespace Baobab {
public class LocationWidget : Gtk.Grid {
private static Gtk.SizeGroup name_size_group = null;
private static Gtk.SizeGroup usage_size_group = null;
+ private static Gtk.IconSize icon_size;
public Location? location { get; private set; }
@@ -31,6 +32,7 @@ namespace Baobab {
if (name_size_group == null) {
name_size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
usage_size_group = new Gtk.SizeGroup (Gtk.SizeGroupMode.HORIZONTAL);
+ icon_size = Gtk.icon_size_register ("baobab", 64, 64);
}
}
@@ -43,16 +45,9 @@ namespace Baobab {
ensure_size_groups ();
- var icon_theme = Gtk.IconTheme.get_default ();
- var icon_info = icon_theme.lookup_by_gicon (location.icon, 64, 0);
-
- try {
- var pixbuf = icon_info.load_icon ();
- var image = new Gtk.Image.from_pixbuf (pixbuf);
- attach (image, 0, 0, 1, 2);
- } catch (Error e) {
- warning ("Failed to load icon %s: %s", location.icon.to_string(), e.message);
- }
+ var image = new Gtk.Image.from_gicon (location.icon, icon_size);
+ image.set_pixel_size (64);
+ attach (image, 0, 0, 1, 2);
var escaped = GLib.Markup.escape_text (location.name, -1);
var label = new Gtk.Label ("<b>%s</b>".printf (escaped));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]