Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
085331f9 by wurstsalat at 2021-12-17T22:16:58+01:00
Control: Use GLib for format HTTP Upload file size

- - - - -
d345f92f by wurstsalat at 2021-12-17T22:17:19+01:00
Notification: Don't fail on missing JID

- - - - -


3 changed files:

- gajim/gtk/controls/base.py
- gajim/gtk/controls/groupchat.py
- gajim/gtk/notification.py


Changes:

=====================================
gajim/gtk/controls/base.py
=====================================
@@ -137,6 +137,11 @@ def __init__(self, widget_name: str, account: str, jid: 
JID) -> None:
         self.control_id: str = str(uuid.uuid4())
         self.session = None
 
+        if app.settings.get('use_kib_mib'):
+            self._units = GLib.FormatSizeFlags.IEC_UNITS
+        else:
+            self._units = GLib.FormatSizeFlags.DEFAULT
+
         self.xml = get_builder(f'{widget_name}.ui')
         self.xml.connect_signals(self)
         self.widget = self.xml.get_object(f'{widget_name}_hbox')


=====================================
gajim/gtk/controls/groupchat.py
=====================================
@@ -341,8 +341,8 @@ def update_actions(self, *args):
             tooltip_text = _('Send File…')
             max_file_size = self._client.get_module('HTTPUpload').max_file_size
             if max_file_size is not None:
-                max_file_size = max_file_size / (1024 * 1024)
-                tooltip_text = _('Send File (max. %s MiB)…') % max_file_size
+                max_file_size = GLib.format_size_full(max_file_size, 
self._units)
+                tooltip_text = _('Send File (max. %s)…') % max_file_size
         else:
             tooltip_text = _('No File Transfer available')
         self.xml.sendfile_button.set_tooltip_text(tooltip_text)


=====================================
gajim/gtk/notification.py
=====================================
@@ -117,6 +117,10 @@ def on_proxy_ready(_source: GObject.Object,
                                   on_proxy_ready)
 
     def _on_notification(self, event):
+        if hasattr(event, 'jid'):
+            jid = str(event.jid)
+        else:
+            jid = None
         if hasattr(event, 'command'):
             # Used by Triggers plugin
             try:
@@ -152,7 +156,7 @@ def _on_notification(self, event):
         self._issue_notification(
             event.notif_type,
             event.account,
-            str(event.jid),
+            jid,
             notif_detail=notif_detail,
             title=event.title,
             text=event.text,



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/699d7e6c8d2e19d10d828f573ea1bd5bd1deef16...d345f92fbdfa78afd6e0c000044962aea30e623a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/699d7e6c8d2e19d10d828f573ea1bd5bd1deef16...d345f92fbdfa78afd6e0c000044962aea30e623a
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

Reply via email to