[gnome-tweak-tool] startup: Force a pixel icon size
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] startup: Force a pixel icon size
- Date: Tue, 18 Aug 2015 14:53:53 +0000 (UTC)
commit 696b127c97fecc4bb950acd13def961afbf6d48f
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Aug 18 15:29:24 2015 +0200
startup: Force a pixel icon size
If we don't set a pixel size gtk+ doesn't scale the resulting pixbuf
unless the source icon is in a scalable format such as SVG.
https://bugzilla.gnome.org/show_bug.cgi?id=742947
gtweak/tweaks/tweak_group_startup.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_startup.py b/gtweak/tweaks/tweak_group_startup.py
index 3c84460..ea60e24 100644
--- a/gtweak/tweaks/tweak_group_startup.py
+++ b/gtweak/tweaks/tweak_group_startup.py
@@ -26,6 +26,12 @@ from gtweak.tweakmodel import Tweak
from gtweak.widgets import ListBoxTweakGroup, UI_BOX_SPACING
from gtweak.utils import AutostartManager, AutostartFile
+def _image_from_gicon(gicon):
+ image = Gtk.Image.new_from_gicon(gicon, Gtk.IconSize.DIALOG)
+ (_, _, h) = Gtk.IconSize.lookup(Gtk.IconSize.DIALOG)
+ image.set_pixel_size(h)
+ return image
+
def _list_header_func(row, before, user_data):
if before and not row.get_header():
row.set_header (Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL))
@@ -127,7 +133,7 @@ class _AppChooser(Gtk.Dialog):
return None
icn = a.get_icon()
if icn:
- img = Gtk.Image.new_from_gicon(a.get_icon(),Gtk.IconSize.DIALOG)
+ img = _image_from_gicon(icn)
g.attach(img, 0, 0, 1, 1)
img.props.hexpand = False
else:
@@ -210,7 +216,7 @@ class _StartupTweak(Gtk.ListBoxRow, Tweak):
icn = df.get_icon()
if icn:
- img = Gtk.Image.new_from_gicon(icn,Gtk.IconSize.DIALOG)
+ img = _image_from_gicon(icn)
grid.attach(img, 0, 0, 1, 1)
else:
img = None #attach_next_to treats this correctly
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]