Philipp Hörist pushed to branch master at gajim / gajim
Commits: 1647336e by Daniel Brötzmann at 2020-03-11T16:32:43+01:00 ServerInfo: Adapt to connection changes
- - - - - 07681f61 by Daniel Brötzmann at 2020-03-11T16:33:38+01:00 CertificateDialog: Add Esc hotkey to close dialog
- - - - -
3 changed files:
- gajim/data/gui/server_info.ui - gajim/gtk/dialogs.py - gajim/gtk/server_info.py
Changes:
===================================== gajim/data/gui/server_info.ui ===================================== @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.22.2 --> <interface> <requires lib="gtk+" version="3.20"/> <object class="GtkNotebook" id="server_info_notebook"> @@ -134,12 +134,6 @@ <property name="width">2</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> <style> <class name="margin-18"/> </style> @@ -161,21 +155,7 @@ <property name="can_focus">False</property> <property name="row_spacing">6</property> <property name="column_spacing">12</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="label" translatable="yes">Type</property> - <style> - <class name="dim-label"/> - </style> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> + <property name="column_homogeneous">True</property> <child> <object class="GtkLabel" id="connection_type"> <property name="visible">True</property> @@ -190,32 +170,20 @@ </packing> </child> <child> - <object class="GtkLabel"> + <object class="GtkButton" id="cert_button"> + <property name="label" translatable="yes">View _Certificate</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="label" translatable="yes">Security</property> - <style> - <class name="dim-label"/> - </style> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="halign">center</property> + <property name="margin_top">12</property> + <property name="use_underline">True</property> + <signal name="clicked" handler="_on_cert_button_clicked" swapped="no"/> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="connection_security"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label">-</property> - <property name="single_line_mode">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="top_attach">3</property> + <property name="width">2</property> </packing> </child> <child> @@ -223,7 +191,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">end</property> - <property name="label" translatable="yes">Cipher</property> + <property name="label" translatable="yes">Proxy</property> <style> <class name="dim-label"/> </style> @@ -234,12 +202,11 @@ </packing> </child> <child> - <object class="GtkLabel" id="connection_cipher"> + <object class="GtkLabel" id="connection_proxy"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="label">-</property> - <property name="selectable">True</property> + <property name="label" translatable="yes">No proxy used</property> <property name="xalign">0</property> </object> <packing> @@ -248,67 +215,46 @@ </packing> </child> <child> - <object class="GtkLabel" id="connection_proxy_header"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">end</property> - <property name="label" translatable="yes">Proxy</property> + <property name="label" translatable="yes">Type</property> <style> <class name="dim-label"/> </style> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">3</property> + <property name="top_attach">1</property> </packing> </child> <child> - <object class="GtkLabel" id="connection_proxy"> + <object class="GtkLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">No proxy used</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> - </child> - <child> - <object class="GtkButton" id="cert_button"> - <property name="label" translatable="yes">View _Certificate</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="halign">center</property> - <property name="margin_top">12</property> - <property name="use_underline">True</property> - <signal name="clicked" handler="_on_cert_button_clicked" swapped="no"/> + <property name="halign">end</property> + <property name="label" translatable="yes">Protocol</property> + <style> + <class name="dim-label"/> + </style> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">4</property> - <property name="width">2</property> + <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkBox" id="spacer2"> - <property name="width_request">160</property> + <object class="GtkLabel" id="connection_protocol"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <placeholder/> - </child> + <property name="halign">start</property> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> + <property name="left_attach">1</property> + <property name="top_attach">1</property> </packing> </child> - <child> - <placeholder/> - </child> <style> <class name="margin-18"/> </style>
===================================== gajim/gtk/dialogs.py ===================================== @@ -226,6 +226,8 @@ class CertificateDialog(Gtk.ApplicationWindow): self._ui = get_builder('certificate_dialog.ui') self.add(self._ui.certificate_box)
+ self.connect('key-press-event', self._on_key_press) + self.account = account self._clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
@@ -269,6 +271,10 @@ class CertificateDialog(Gtk.ApplicationWindow): self._ui.connect_signals(self) self.show_all()
+ def _on_key_press(self, _widget, event): + if event.keyval == Gdk.KEY_Escape: + self.destroy() + def _on_copy_cert_info_button_clicked(self, _widget): clipboard_text = \ self._headline + '\n\n' + \
===================================== gajim/gtk/server_info.py ===================================== @@ -17,6 +17,7 @@ from collections import namedtuple from datetime import timedelta
import nbxmpp +from nbxmpp.const import ConnectionType from nbxmpp.util import is_error_result from gi.repository import Gtk from gi.repository import Gdk @@ -99,35 +100,30 @@ class ServerInfo(Gtk.ApplicationWindow, EventHelper): row.set_header(label)
def _add_connection_info(self): - ssl_con = app.connections[self.account].connection.get_ssl_connection() - ssl_version = None - cipher_name = None - if ssl_con is not None: - ssl_version = ssl_con.get_cipher_version() - cipher_name = ssl_con.get_cipher_name() - - host, proxy = app.connections[self.account].get_connection_info() - con_type = host['type'] - # Connection type - self._ui.connection_type.set_text(con_type.upper()) - if con_type == 'plain': + con_type = app.connections[self.account].connection.current_connection_type + con_type_short = '' + if ConnectionType.DIRECT_TLS: + con_type_short = 'DIRECT TLS' + elif ConnectionType.START_TLS: + con_type_short = 'START TLS' + else: + con_type_short = 'PLAIN' + self._ui.connection_type.set_text(con_type_short) + if con_type is ConnectionType.PLAIN: self._ui.conection_type.get_style_context().add_class( 'error-color')
- # Connection security - if ssl_version is not None: - self._ui.connection_security.set_text(ssl_version) - - # Connection cipher - if cipher_name is not None: - self._ui.connection_cipher.set_text(cipher_name) + is_websocket = app.connections[self.account].connection.is_websocket + protocol = 'WebSocket' if is_websocket else 'TCP' + self._ui.connection_protocol.set_text(protocol)
+ # host, proxy = app.connections[self.account].get_connection_info() # Connection proxy - if proxy: - if proxy['type'] in ['http', 'socks5']: - self._ui.connection_proxy.set_text( - proxy['host'] + ':' + proxy['port']) + # if proxy: + # if proxy['type'] in ['http', 'socks5']: + # self._ui.connection_proxy.set_text( + # proxy['host'] + ':' + proxy['port'])
self._ui.cert_button.set_sensitive(self.cert)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/b38772216f7da25e5a1d5726f5620396...