Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions qrexec/tools/qrexec_policy_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,23 @@ def __init__(self, domains_info=None):
self._domains_info = domains_info
self._icons = {}
self._icon_size = 16
self._find_icon = None
self._theme = Gtk.IconTheme.get_default()
self._create_entries()

def _get_find_icon(self):
if self._find_icon is None:
self._find_icon = self._theme.load_icon(
"edit-find", self._icon_size, 0
)
return self._find_icon

def _get_icon(self, name):
if name not in self._icons:
try:
icon = self._theme.load_icon(name, self._icon_size, 0)
except GLib.Error: # pylint: disable=catching-non-exception
icon = self._theme.load_icon("edit-find", self._icon_size, 0)
icon = self._get_find_icon()

self._icons[name] = icon

Expand Down Expand Up @@ -128,8 +136,8 @@ def _combo_change(self, selection_trigger, combo, entry_box, whitelist):
)
else:
if entry_box:
entry_box.set_icon_from_stock(
Gtk.EntryIconPosition.PRIMARY, "gtk-find"
entry_box.set_icon_from_pixbuf(
Gtk.EntryIconPosition.PRIMARY, self._get_find_icon()
)

if selection_trigger:
Expand Down