Philipp Hörist pushed to branch master at gajim / gajim
Commits: 13c4e456 by Philipp Hörist at 2022-10-31T10:22:45+01:00 refactor: Archive: Remove unnecessary doc string
- - - - - 4982798c by Philipp Hörist at 2022-10-31T10:22:45+01:00 refactor: Contacts: Remove pixbuf option from get_avatar()
This is only needed once, for notifications.
- - - - -
3 changed files:
- gajim/common/modules/contacts.py - gajim/common/storage/archive.py - gajim/gtk/notification.py
Changes:
===================================== gajim/common/modules/contacts.py ===================================== @@ -456,7 +456,6 @@ def get_avatar(self, size: int, scale: int, add_show: bool = True, - pixbuf: bool = False, default: bool = False, style: str = 'circle'):
@@ -479,15 +478,6 @@ def get_avatar(self, if self.avatar_sha is not None: transport_icon = None
- if pixbuf: - return app.app.avatar_storage.get_pixbuf( - self, - size, - scale, - show, - default=default, - transport_icon=transport_icon, - style=style) return app.app.avatar_storage.get_surface( self, size,
===================================== gajim/common/storage/archive.py ===================================== @@ -22,6 +22,7 @@ # along with Gajim. If not, see http://www.gnu.org/licenses/.
from typing import Any +from typing import Literal from typing import Iterator from typing import KeysView from typing import NamedTuple @@ -1238,20 +1239,12 @@ def set_marker(self, account_jid: str, jid: str, message_id: str, - state: str + state: Literal['received', 'displayed'] ) -> None: ''' Update the marker state of the corresponding message - - :param account_jid: The jid of the account - - :param jid: The jid that belongs to the avatar - - :param message_id: The id of the message - - :param state: The state, 'received' or 'displayed' - ''' + if state not in ('received', 'displayed'): raise ValueError('Invalid marker state')
===================================== gajim/gtk/notification.py ===================================== @@ -413,7 +413,12 @@ def _get_avatar_for_notification(account: str, size = AvatarSize.NOTIFICATION client = app.get_client(account) contact = client.get_module('Contacts').get_contact(jid) - pixbuf = contact.get_avatar(size, scale, pixbuf=True) + surface = contact.get_avatar(size, scale) + pixbuf = Gdk.pixbuf_get_from_surface(surface, + 0, + 0, + size * scale, + size * scale) assert pixbuf is not None return pixbuf
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/cd159c4df8d9a67772e507fa93be5ebd...