Notification: Use load_icon()

This commit is contained in:
Philipp Hörist 2018-11-18 18:03:08 +01:00
parent 1179333fa0
commit 2ece342de2
3 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -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: