Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
77c8d623 by wurstsalat at 2022-05-14T00:44:30+02:00
fix: Access jingle transport values fallback correctly
- - - - -
ae9cbc67 by wurstsalat at 2022-05-14T00:44:30+02:00
fix: Jingle: Use SendFileDialog for DND and paste events
- - - - -
3 changed files:
- gajim/common/jingle_transport.py
- gajim/gtk/controls/base.py
- gajim/gtk/file_transfer_send.py
Changes:
=====================================
gajim/common/jingle_transport.py
=====================================
@@ -158,9 +158,9 @@ def parse_transport_stanza(self, transport):
'state': 0,
'target': self.ourjid,
'host': candidate['host'],
- 'port': int(candidate.get('port', 1080)),
+ 'port': int(candidate['port'] or 1080),
'candidate_id': candidate['cid'],
- 'type': candidate.get('type', 'direct'),
+ 'type': candidate['type'] or 'direct',
'priority': candidate['priority']
}
candidates.append(cand)
=====================================
gajim/gtk/controls/base.py
=====================================
@@ -35,6 +35,7 @@
import time
import uuid
import tempfile
+from functools import partial
from gi.repository import Gtk
from gi.repository import Gdk
@@ -69,6 +70,7 @@
from gajim.gui.dialogs import DialogButton
from gajim.gui.dialogs import ErrorDialog
from gajim.gui.dialogs import PastePreviewDialog
+from gajim.gui.file_transfer_send import SendFileDialog
from gajim.gui.message_input import MessageInputTextView
from gajim.gui.security_label_selector import SecurityLabelSelector
from gajim.gui.util import get_hardware_key_codes
@@ -807,10 +809,12 @@ def _start_filetransfer(self, path: str) -> None:
if method == 'httpupload':
app.interface.send_httpupload(self, path)
-
else:
- app.interface.instances['file_transfers'].send_file(
- self.account, self.contact, path)
+ send_callback = partial(
+ app.interface.instances['file_transfers'].send_file,
+ self.account,
+ self.contact)
+ SendFileDialog(self.contact, send_callback, app.window, [path])
def _on_send_file(self,
action: Gio.SimpleAction,
=====================================
gajim/gtk/file_transfer_send.py
=====================================
@@ -21,6 +21,7 @@
from typing import Callable
from typing import cast
+from typing import Optional
from pathlib import Path
@@ -44,7 +45,8 @@ class SendFileDialog(Gtk.ApplicationWindow):
def __init__(self,
contact: BareContact,
send_callback: Callable[..., bool],
- transient_for: Gtk.Window
+ transient_for: Gtk.Window,
+ files: Optional[list[str]] = None
) -> None:
Gtk.ApplicationWindow.__init__(self)
self.set_application(app.app)
@@ -75,6 +77,9 @@ def __init__(self,
self._ui.resource_box.pack_start(
self._resource_selector, True, False, 0)
+ if files is not None:
+ self.set_files(files)
+
self.connect('key-press-event', self._on_key_press)
self._ui.connect_signals(self)
self.show_all()
@@ -110,7 +115,7 @@ def _send_files(self, resource_jid: JID) -> None:
self.destroy()
def _select_files(self, _button: Gtk.Button) -> None:
- FileChooserDialog(self._set_files,
+ FileChooserDialog(self.set_files,
select_multiple=True,
transient_for=self,
path=app.settings.get('last_send_dir'))
@@ -120,7 +125,7 @@ def _remove_files(self, _button: Gtk.Button) -> None:
for item in selected:
self._ui.listbox.remove(item)
- def _set_files(self, file_names: str) -> None:
+ def set_files(self, file_names: list[str]) -> None:
last_dir = ''
for file in file_names:
row = FileRow(file)
@@ -130,6 +135,7 @@ def _set_files(self, file_names: str) -> None:
self._ui.listbox.add(row)
self._ui.listbox.show_all()
app.settings.set('last_send_dir', str(last_dir))
+ self._ui.files_send.set_sensitive(True)
def _get_description(self) -> str:
buffer_ = self._ui.description.get_buffer()
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/516119cf63119f142df125f80a81c5829f212132...ae9cbc6732cc1a56bf18059b63e2bc5c78df8da3
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/compare/516119cf63119f142df125f80a81c5829f212132...ae9cbc6732cc1a56bf18059b63e2bc5c78df8da3
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits