From 2ece342de27439295aa1814c65a0fcce36f72ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sun, 18 Nov 2018 18:03:08 +0100 Subject: [PATCH] Notification: Use load_icon() --- gajim/gtk/util.py | 8 +++++--- gajim/gtkgui_helpers.py | 2 -- gajim/notify.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gajim/gtk/util.py b/gajim/gtk/util.py index 75f6c5e63..cc6cf599a 100644 --- a/gajim/gtk/util.py +++ b/gajim/gtk/util.py @@ -98,10 +98,12 @@ def icon_exists(name: str) -> bool: return _icon_theme.has_icon(name) -def load_icon(icon_name, widget, size=16, pixbuf=False, - flags=Gtk.IconLookupFlags.FORCE_SIZE): +def load_icon(icon_name, widget=None, size=16, pixbuf=False, + scale=None, flags=Gtk.IconLookupFlags.FORCE_SIZE): + + if widget is not None: + scale = widget.get_scale_factor() - scale = widget.get_scale_factor() if not scale: log.warning('Could not determine scale factor') scale = 1 diff --git a/gajim/gtkgui_helpers.py b/gajim/gtkgui_helpers.py index b2b2871f5..69e0dc7fd 100644 --- a/gajim/gtkgui_helpers.py +++ b/gajim/gtkgui_helpers.py @@ -49,8 +49,6 @@ from gajim.common.const import PEPEventType, ACTIVITIES, MOODS log = logging.getLogger('gajim.gtkgui_helpers') -gtk_icon_theme = Gtk.IconTheme.get_default() -gtk_icon_theme.append_search_path(configpaths.get('ICONS')) class Color: BLACK = Gdk.RGBA(red=0, green=0, blue=0, alpha=1) diff --git a/gajim/notify.py b/gajim/notify.py index 8ca8f7e97..78cf68be4 100644 --- a/gajim/notify.py +++ b/gajim/notify.py @@ -41,6 +41,7 @@ from gajim.common.i18n import _ from gajim.gtk.util import get_icon_name from gajim.gtk.util import get_monitor_scale_factor from gajim.gtk.util import get_total_screen_geometry +from gajim.gtk.util import load_icon log = logging.getLogger('gajim.notify') @@ -175,8 +176,7 @@ class Notification: return scale = get_monitor_scale_factor() - icon_pixbuf = gtkgui_helpers.gtk_icon_theme.load_icon_for_scale( - icon_name, 48, scale, 0) + icon_pixbuf = load_icon(icon_name, size=48, pixbuf=True, scale=scale) notification = Gio.Notification() if title is not None: