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

Commits:

5 changed files:

Changes:

  • .ci/appveyor.yml
    ... ... @@ -33,7 +33,7 @@ build_script:
    33 33
     
    
    34 34
       - ps: |
    
    35 35
             $filename = "Gajim-$($env:GAJIM_VERSION)-$($env:ARCH)"
    
    36
    -        $filename_portable = "Gajim-$($env:GAJIM_VERSION)-Portable-$($env:ARCH)"
    
    36
    +        $filename_portable = "Gajim-Portable-$($env:GAJIM_VERSION)-$($env:ARCH)"
    
    37 37
     
    
    38 38
             if ($env:GAJIM_VERSION -eq "Nightly") {
    
    39 39
                 $time_string=(get-date -UFormat "%Y-%m-%d").ToString()
    

  • gajim/gtk/chat_page.py
    ... ... @@ -17,7 +17,6 @@
    17 17
     from typing import Optional
    
    18 18
     from typing import Generator
    
    19 19
     
    
    20
    -import time
    
    21 20
     import logging
    
    22 21
     
    
    23 22
     from gi.repository import Gdk
    
    ... ... @@ -38,7 +37,6 @@
    38 37
     from .chat_stack import ChatStack
    
    39 38
     from .search_view import SearchView
    
    40 39
     from .types import ControlT
    
    41
    -from .const import UNLOAD_CHAT_TIME
    
    42 40
     
    
    43 41
     
    
    44 42
     log = logging.getLogger('gajim.gui.chat_page')
    
    ... ... @@ -55,8 +53,6 @@ class ChatPage(Gtk.Box):
    55 53
         def __init__(self):
    
    56 54
             Gtk.Box.__init__(self)
    
    57 55
     
    
    58
    -        self._chat_idle_time: dict[tuple[str, JID], Optional[float]] = {}
    
    59
    -
    
    60 56
             self._ui = get_builder('chat_paned.ui')
    
    61 57
             self.add(self._ui.paned)
    
    62 58
             self._ui.connect_signals(self)
    
    ... ... @@ -146,31 +142,6 @@ def _on_filter_revealer_toggled(self,
    146 142
         def _on_edit_workspace_clicked(_button: Gtk.Button) -> None:
    
    147 143
             app.window.activate_action('edit-workspace', GLib.Variant('s', ''))
    
    148 144
     
    
    149
    -    def _reset_chat_idle_time(self, account: str, jid: JID) -> None:
    
    150
    -        # Set the idle time of the current chat to None
    
    151
    -        # and start the timer for the last one
    
    152
    -        for chat, idle_time in self._chat_idle_time.items():
    
    153
    -            if idle_time is None:
    
    154
    -                self._chat_idle_time[chat] = time.time()
    
    155
    -
    
    156
    -        self._chat_idle_time[(account, jid)] = None
    
    157
    -
    
    158
    -    def unload_idle_chats(self) -> bool:
    
    159
    -        log.debug('Unload idle chats')
    
    160
    -        for chat, idle_time in list(self._chat_idle_time.items()):
    
    161
    -            if idle_time is None:
    
    162
    -                continue
    
    163
    -
    
    164
    -            if time.time() - UNLOAD_CHAT_TIME > idle_time:
    
    165
    -                account, jid = chat
    
    166
    -                self._chat_stack.unload_chat(account, jid)
    
    167
    -                self._chat_idle_time.pop(chat)
    
    168
    -                log.debug('Chat %s:%s unloaded', account, jid)
    
    169
    -
    
    170
    -        # Return true because we call this method with
    
    171
    -        # GLib.timeout_add_seconds()
    
    172
    -        return True
    
    173
    -
    
    174 145
         def _on_chat_selected(self,
    
    175 146
                               _chat_list_stack: ChatListStack,
    
    176 147
                               workspace_id: str,
    
    ... ... @@ -180,7 +151,6 @@ def _on_chat_selected(self,
    180 151
             self._chat_stack.show_chat(account, jid)
    
    181 152
             self._search_view.set_context(account, jid)
    
    182 153
             self.emit('chat-selected', workspace_id, account, jid)
    
    183
    -        self._reset_chat_idle_time(account, jid)
    
    184 154
     
    
    185 155
         def _on_chat_unselected(self, _chat_list_stack: ChatListStack) -> None:
    
    186 156
             self._chat_stack.clear()
    

  • gajim/gtk/chat_stack.py
    ... ... @@ -118,6 +118,8 @@ def show_chat(self, account: str, jid: JID) -> None:
    118 118
     
    
    119 119
             if self._current_control is not None:
    
    120 120
                 self._current_control.set_control_active(False)
    
    121
    +            self._current_control.reset_view()
    
    122
    +
    
    121 123
             control.set_control_active(True)
    
    122 124
             self._current_control = control
    
    123 125
     
    
    ... ... @@ -130,12 +132,6 @@ def is_chat_loaded(self, account: str, jid: JID) -> bool:
    130 132
                 return False
    
    131 133
             return control.is_chat_loaded
    
    132 134
     
    
    133
    -    def unload_chat(self, account: str, jid: JID) -> None:
    
    134
    -        control = self.get_control(account, jid)
    
    135
    -        if control is None:
    
    136
    -            return
    
    137
    -        control.reset_view()
    
    138
    -
    
    139 135
         def clear(self) -> None:
    
    140 136
             self.set_visible_child_name('empty')
    
    141 137
             self._current_control = None
    

  • gajim/gtk/const.py
    ... ... @@ -55,8 +55,6 @@ class Setting(NamedTuple):
    55 55
     # Drag and drop target type URI list (for dropped files)
    
    56 56
     TARGET_TYPE_URI_LIST = 80
    
    57 57
     
    
    58
    -UNLOAD_CHAT_TIME = 300  # seconds
    
    59
    -
    
    60 58
     
    
    61 59
     @unique
    
    62 60
     class Theme(IntEnum):
    

  • gajim/gtk/main.py
    ... ... @@ -57,7 +57,6 @@
    57 57
     from .util import save_main_window_position
    
    58 58
     from .util import open_window
    
    59 59
     from .util import set_urgency_hint
    
    60
    -from .const import UNLOAD_CHAT_TIME
    
    61 60
     from .structs import AccountJidParam
    
    62 61
     from .structs import AddChatActionParams
    
    63 62
     from .structs import actionmethod
    
    ... ... @@ -145,7 +144,6 @@ def __init__(self) -> None:
    145 144
             self._add_actions2()
    
    146 145
     
    
    147 146
             self._prepare_window()
    
    148
    -        self._start_timers()
    
    149 147
     
    
    150 148
             chat_list_stack = self._chat_page.get_chat_list_stack()
    
    151 149
             app.app.systray.connect_unread_widget(chat_list_stack,
    
    ... ... @@ -155,10 +153,6 @@ def __init__(self) -> None:
    155 153
                 client.connect_signal('state-changed',
    
    156 154
                                       self._on_client_state_changed)
    
    157 155
     
    
    158
    -    def _start_timers(self) -> None:
    
    159
    -        GLib.timeout_add_seconds(UNLOAD_CHAT_TIME,
    
    160
    -                                 self._chat_page.unload_idle_chats)
    
    161
    -
    
    162 156
         def _prepare_window(self) -> None:
    
    163 157
             if app.settings.get('main_window_skip_taskbar'):
    
    164 158
                 self.set_property('skip-taskbar-hint', True)