Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/gtk/account_side_bar.py
    ... ... @@ -12,6 +12,8 @@
    12 12
     # You should have received a copy of the GNU General Public License
    
    13 13
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14 14
     
    
    15
    +from __future__ import annotations
    
    16
    +
    
    15 17
     from typing import List
    
    16 18
     from typing import Optional
    
    17 19
     
    
    ... ... @@ -19,6 +21,7 @@
    19 21
     
    
    20 22
     from gajim.common.const import AvatarSize
    
    21 23
     from gajim.common import app
    
    24
    +from gajim.common import types
    
    22 25
     from gajim.common.i18n import _
    
    23 26
     
    
    24 27
     
    
    ... ... @@ -45,7 +48,7 @@ def remove_account(self, account: str) -> None:
    45 48
                     return
    
    46 49
     
    
    47 50
         @staticmethod
    
    48
    -    def _on_row_activated(_listbox, row):
    
    51
    +    def _on_row_activated(_listbox: AccountSideBar, row: Account) -> None:
    
    49 52
             app.window.show_account_page(row.account)
    
    50 53
     
    
    51 54
         def activate_account_page(self, account: str) -> None:
    
    ... ... @@ -112,10 +115,14 @@ def __init__(self, account: str) -> None:
    112 115
             self.connect('destroy', self._on_destroy)
    
    113 116
             self._update_image()
    
    114 117
     
    
    115
    -    def _on_presence_update(self, _contact, _signal_name):
    
    118
    +    def _on_presence_update(self,
    
    119
    +                            _contact: types.BareContact,
    
    120
    +                            _signal_name: str) -> None:
    
    116 121
             self._update_image()
    
    117 122
     
    
    118
    -    def _on_avatar_update(self, _contact, _signal_name):
    
    123
    +    def _on_avatar_update(self,
    
    124
    +                          _contact: types.BareContact,
    
    125
    +                          _signal_name: str) -> None:
    
    119 126
             self._update_image()
    
    120 127
     
    
    121 128
         def _update_image(self) -> None:
    
    ... ... @@ -124,6 +131,6 @@ def _update_image(self) -> None:
    124 131
                                                style='circle')
    
    125 132
             self.set_from_surface(surface)
    
    126 133
     
    
    127
    -    def _on_destroy(self, *args):
    
    134
    +    def _on_destroy(self, _widget: Gtk.Image) -> None:
    
    128 135
             self._contact.disconnect_all_from_obj(self)
    
    129 136
             app.check_finalize(self)

  • gajim/gtk/notification.py
    ... ... @@ -27,6 +27,7 @@
    27 27
     from __future__ import annotations
    
    28 28
     
    
    29 29
     from typing import Optional
    
    30
    +from typing import Union
    
    30 31
     
    
    31 32
     import sys
    
    32 33
     import logging
    
    ... ... @@ -36,6 +37,7 @@
    36 37
     from gi.repository import Gdk
    
    37 38
     from gi.repository import GdkPixbuf
    
    38 39
     from gi.repository import Gtk
    
    40
    +from nbxmpp.protocol import JID
    
    39 41
     
    
    40 42
     from gajim.common import app
    
    41 43
     from gajim.common import ged
    
    ... ... @@ -112,9 +114,6 @@ def on_proxy_ready(_source: Gio.DBusProxy,
    112 114
                                       on_proxy_ready)
    
    113 115
     
    
    114 116
         def _on_notification(self, event: events.Notification) -> None:
    
    115
    -        if event.jid is not None:
    
    116
    -            jid = str(event.jid)
    
    117
    -
    
    118 117
             if event.sound is not None:
    
    119 118
                 play_sound(event.sound, event.account)
    
    120 119
     
    
    ... ... @@ -131,7 +130,7 @@ def _on_notification(self, event: events.Notification) -> None:
    131 130
             self._issue_notification(
    
    132 131
                 event.notif_type,
    
    133 132
                 event.account,
    
    134
    -            jid,
    
    133
    +            event.jid,
    
    135 134
                 notif_detail=notif_detail,
    
    136 135
                 title=event.title,
    
    137 136
                 text=event.text,
    
    ... ... @@ -144,7 +143,7 @@ def _on_our_show(self, event: events.ShowChanged) -> None:
    144 143
         def _issue_notification(self,
    
    145 144
                                 notif_type: str,
    
    146 145
                                 account: str,
    
    147
    -                            jid: Optional[str],
    
    146
    +                            jid: Optional[Union[str, JID]],
    
    148 147
                                 notif_detail: str = '',
    
    149 148
                                 title: str = '',
    
    150 149
                                 text: str = '',
    
    ... ... @@ -155,6 +154,8 @@ def _issue_notification(self,
    155 154
             Notify a user of an event using GNotification and GApplication under
    
    156 155
             Linux, Use PopupNotificationWindow under Windows
    
    157 156
             """
    
    157
    +        if jid is not None:
    
    158
    +            jid = str(jid)
    
    158 159
     
    
    159 160
             if icon_name is None:
    
    160 161
                 icon_name = 'mail-message-new'