| ... |
... |
@@ -12,12 +12,15 @@ |
|
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 typing import Any
|
|
|
16
|
+from typing import Literal
|
|
15
|
17
|
from typing import Optional
|
|
16
|
18
|
from typing import Generator
|
|
17
|
19
|
|
|
18
|
20
|
import time
|
|
19
|
21
|
import logging
|
|
20
|
22
|
|
|
|
23
|
+from gi.repository import Gdk
|
|
21
|
24
|
from gi.repository import Gtk
|
|
22
|
25
|
from gi.repository import GLib
|
|
23
|
26
|
from gi.repository import Gio
|
| ... |
... |
@@ -123,23 +126,24 @@ def get_chat_stack(self) -> ChatStack: |
|
123
|
126
|
return self._chat_stack
|
|
124
|
127
|
|
|
125
|
128
|
@staticmethod
|
|
126
|
|
- def _on_start_chat_clicked(_button):
|
|
|
129
|
+ def _on_start_chat_clicked(_button: Gtk.Button) -> None:
|
|
127
|
130
|
app.app.activate_action('start-chat', GLib.Variant('s', ''))
|
|
128
|
131
|
|
|
129
|
132
|
@staticmethod
|
|
130
|
|
- def _on_button_release(paned, event):
|
|
|
133
|
+ def _on_button_release(paned: Gtk.Paned, event: Gdk.EventButton) -> None:
|
|
131
|
134
|
if event.window != paned.get_handle_window():
|
|
132
|
135
|
return
|
|
133
|
136
|
position = paned.get_position()
|
|
134
|
137
|
app.settings.set('chat_handle_position', position)
|
|
135
|
138
|
|
|
136
|
|
- def _on_filter_revealer_toggled(self, toggle_button):
|
|
|
139
|
+ def _on_filter_revealer_toggled(self,
|
|
|
140
|
+ toggle_button: Gtk.ToggleButton) -> None:
|
|
137
|
141
|
active = toggle_button.get_active()
|
|
138
|
142
|
self._ui.filter_bar_revealer.set_reveal_child(active)
|
|
139
|
143
|
self._chat_filter.reset()
|
|
140
|
144
|
|
|
141
|
145
|
@staticmethod
|
|
142
|
|
- def _on_edit_workspace_clicked(_button):
|
|
|
146
|
+ def _on_edit_workspace_clicked(_button: Gtk.Button) -> None:
|
|
143
|
147
|
app.window.activate_action('edit-workspace', GLib.Variant('s', ''))
|
|
144
|
148
|
|
|
145
|
149
|
def _reset_chat_idle_time(self, account: str, jid: JID) -> None:
|
| ... |
... |
@@ -188,11 +192,14 @@ def _on_chat_selected(self, |
|
188
|
192
|
control.set_control_active(True)
|
|
189
|
193
|
self._last_control = control
|
|
190
|
194
|
|
|
191
|
|
- def _on_chat_unselected(self, _chat_list_stack):
|
|
|
195
|
+ def _on_chat_unselected(self, _chat_list_stack: ChatListStack) -> None:
|
|
192
|
196
|
self._chat_stack.clear()
|
|
193
|
197
|
self._search_view.set_context(None, None)
|
|
194
|
198
|
|
|
195
|
|
- def _on_search_history(self, _action, _param):
|
|
|
199
|
+ def _on_search_history(self,
|
|
|
200
|
+ _action: Gio.SimpleAction,
|
|
|
201
|
+ _param: Literal[None]) -> None:
|
|
|
202
|
+
|
|
196
|
203
|
control = self.get_active_control()
|
|
197
|
204
|
if control is not None:
|
|
198
|
205
|
self._search_view.set_context(control.account, control.contact.jid)
|
| ... |
... |
@@ -200,10 +207,13 @@ def _on_search_history(self, _action, _param): |
|
200
|
207
|
self._search_revealer.set_reveal_child(True)
|
|
201
|
208
|
self._search_view.set_focus()
|
|
202
|
209
|
|
|
203
|
|
- def _on_search_hide(self, *args):
|
|
|
210
|
+ def _on_search_hide(self, *args: Any) -> None:
|
|
204
|
211
|
self._search_revealer.set_reveal_child(False)
|
|
205
|
212
|
|
|
206
|
|
- def _on_chat_list_changed(self, chat_list_stack, *args):
|
|
|
213
|
+ def _on_chat_list_changed(self,
|
|
|
214
|
+ chat_list_stack: ChatListStack,
|
|
|
215
|
+ *args: Any) -> None:
|
|
|
216
|
+
|
|
207
|
217
|
chat_list = chat_list_stack.get_current_chat_list()
|
|
208
|
218
|
name = app.settings.get_workspace_setting(chat_list.workspace_id,
|
|
209
|
219
|
'name')
|
| ... |
... |
@@ -235,8 +245,11 @@ def chat_exists(self, account: str, jid: JID) -> bool: |
|
235
|
245
|
def select_chat(self, account: str, jid: JID) -> None:
|
|
236
|
246
|
self._chat_list_stack.select_chat(account, jid)
|
|
237
|
247
|
|
|
238
|
|
- def chat_exists_for_workspace(self, workspace_id: str, account: str,
|
|
|
248
|
+ def chat_exists_for_workspace(self,
|
|
|
249
|
+ workspace_id: str,
|
|
|
250
|
+ account: str,
|
|
239
|
251
|
jid: JID) -> bool:
|
|
|
252
|
+
|
|
240
|
253
|
return self._chat_list_stack.contains_chat(
|
|
241
|
254
|
account, jid, workspace_id=workspace_id)
|
|
242
|
255
|
|
| ... |
... |
@@ -288,7 +301,10 @@ def load_workspace_chats(self, workspace_id: str) -> None: |
|
288
|
301
|
def is_chat_active(self, account: str, jid: JID) -> bool:
|
|
289
|
302
|
return self._chat_list_stack.is_chat_active(account, jid)
|
|
290
|
303
|
|
|
291
|
|
- def _remove_chat(self, _action, param):
|
|
|
304
|
+ def _remove_chat(self,
|
|
|
305
|
+ _action: Gio.SimpleAction,
|
|
|
306
|
+ param: GLib.Variant) -> None:
|
|
|
307
|
+
|
|
292
|
308
|
account, jid = param.unpack()
|
|
293
|
309
|
jid = JID.from_string(jid)
|
|
294
|
310
|
|