Rename and extend get_iconset_name_for()
This commit is contained in:
parent
a4077502d5
commit
e86c619379
|
@ -183,8 +183,8 @@ class HistoryWindow:
|
|||
completion_dict.update(
|
||||
helpers.get_contact_dict_for_account(account))
|
||||
|
||||
muc_active_icon = util.get_iconset_name_for('muc-active')
|
||||
online_icon = util.get_iconset_name_for('online')
|
||||
muc_active_icon = util.get_icon_name('muc-active')
|
||||
online_icon = util.get_icon_name('online')
|
||||
|
||||
keys = list(completion_dict.keys())
|
||||
# Move the actual jid at first so we load history faster
|
||||
|
|
|
@ -29,7 +29,7 @@ from gajim.conversation_textview import ConversationTextview
|
|||
from gajim.gtk.dialogs import ErrorDialog
|
||||
from gajim.gtk.dialogs import AspellDictError
|
||||
from gajim.gtk.util import get_builder
|
||||
from gajim.gtk.util import get_iconset_name_for
|
||||
from gajim.gtk.util import get_icon_name
|
||||
from gajim.gtk.util import get_completion_liststore
|
||||
from gajim.gtk.util import move_window
|
||||
from gajim.gtk.util import resize_window
|
||||
|
@ -134,7 +134,7 @@ class SingleMessageWindow:
|
|||
keys = sorted(self.completion_dict.keys())
|
||||
for jid in keys:
|
||||
contact = self.completion_dict[jid]
|
||||
status_icon = get_iconset_name_for(contact.show)
|
||||
status_icon = get_icon_name(contact.show)
|
||||
liststore.append((status_icon, jid))
|
||||
else:
|
||||
self.completion_dict = {}
|
||||
|
|
|
@ -24,7 +24,7 @@ from gajim.common import helpers
|
|||
from gajim.common.i18n import _
|
||||
from gajim.common.const import AvatarSize
|
||||
|
||||
from gajim.gtk.util import get_iconset_name_for
|
||||
from gajim.gtk.util import get_icon_name
|
||||
from gajim.gtk.util import get_builder
|
||||
|
||||
|
||||
|
@ -276,7 +276,7 @@ class ContactRow(Gtk.Grid):
|
|||
self.new = jid == ''
|
||||
|
||||
if self.groupchat:
|
||||
muc_icon = get_iconset_name_for(
|
||||
muc_icon = get_icon_name(
|
||||
'muc-inactive' if self.new else 'muc-active')
|
||||
image = Gtk.Image.new_from_icon_name(muc_icon, Gtk.IconSize.DND)
|
||||
else:
|
||||
|
|
|
@ -41,7 +41,7 @@ from gajim.common.i18n import Q_
|
|||
from gajim.common.i18n import _
|
||||
|
||||
from gajim.gtk.util import get_builder
|
||||
from gajim.gtk.util import get_iconset_name_for
|
||||
from gajim.gtk.util import get_icon_name
|
||||
|
||||
log = logging.getLogger('gajim.gtk.tooltips')
|
||||
|
||||
|
@ -99,7 +99,7 @@ class StatusTable:
|
|||
"""
|
||||
self.table.insert_row(self.current_row)
|
||||
image = Gtk.Image()
|
||||
icon_name = get_iconset_name_for(show, transport=transport)
|
||||
icon_name = get_icon_name(show, transport=transport)
|
||||
image.set_from_icon_name(icon_name, Gtk.IconSize.MENU)
|
||||
spacer = Gtk.Label(label=self.spacer_label)
|
||||
image.set_halign(Gtk.Align.START)
|
||||
|
|
|
@ -107,12 +107,19 @@ def load_icon(icon_name, widget, size=16, pixbuf=False,
|
|||
log.error('Unable to load icon %s: %s', icon_name, str(error))
|
||||
|
||||
|
||||
def get_iconset_name_for(name: str, transport: Optional[str] = None) -> str:
|
||||
def get_icon_name(name: str,
|
||||
iconset: Optional[str] = None,
|
||||
transport: Optional[str] = None) -> str:
|
||||
if name == 'not in roster':
|
||||
name = 'notinroster'
|
||||
iconset = app.config.get('iconset')
|
||||
|
||||
if iconset is not None:
|
||||
return '%s-%s' % (iconset, name)
|
||||
|
||||
if transport is not None:
|
||||
return '%s-%s' % (transport, name)
|
||||
|
||||
iconset = app.config.get('iconset')
|
||||
if not iconset:
|
||||
iconset = app.config.DEFAULT_ICONSET
|
||||
return '%s-%s' % (iconset, name)
|
||||
|
|
Loading…
Reference in New Issue