Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
1647336e
by Daniel Brötzmann at 2020-03-11T16:32:43+01:00
-
07681f61
by Daniel Brötzmann at 2020-03-11T16:33:38+01:00
3 changed files:
Changes:
| 1 | 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-<!-- Generated with glade 3.22.1 -->
|
|
| 2 |
+<!-- Generated with glade 3.22.2 -->
|
|
| 3 | 3 |
<interface>
|
| 4 | 4 |
<requires lib="gtk+" version="3.20"/>
|
| 5 | 5 |
<object class="GtkNotebook" id="server_info_notebook">
|
| ... | ... | @@ -134,12 +134,6 @@ |
| 134 | 134 |
<property name="width">2</property>
|
| 135 | 135 |
</packing>
|
| 136 | 136 |
</child>
|
| 137 |
- <child>
|
|
| 138 |
- <placeholder/>
|
|
| 139 |
- </child>
|
|
| 140 |
- <child>
|
|
| 141 |
- <placeholder/>
|
|
| 142 |
- </child>
|
|
| 143 | 137 |
<style>
|
| 144 | 138 |
<class name="margin-18"/>
|
| 145 | 139 |
</style>
|
| ... | ... | @@ -161,21 +155,7 @@ |
| 161 | 155 |
<property name="can_focus">False</property>
|
| 162 | 156 |
<property name="row_spacing">6</property>
|
| 163 | 157 |
<property name="column_spacing">12</property>
|
| 164 |
- <child>
|
|
| 165 |
- <object class="GtkLabel">
|
|
| 166 |
- <property name="visible">True</property>
|
|
| 167 |
- <property name="can_focus">False</property>
|
|
| 168 |
- <property name="halign">end</property>
|
|
| 169 |
- <property name="label" translatable="yes">Type</property>
|
|
| 170 |
- <style>
|
|
| 171 |
- <class name="dim-label"/>
|
|
| 172 |
- </style>
|
|
| 173 |
- </object>
|
|
| 174 |
- <packing>
|
|
| 175 |
- <property name="left_attach">0</property>
|
|
| 176 |
- <property name="top_attach">0</property>
|
|
| 177 |
- </packing>
|
|
| 178 |
- </child>
|
|
| 158 |
+ <property name="column_homogeneous">True</property>
|
|
| 179 | 159 |
<child>
|
| 180 | 160 |
<object class="GtkLabel" id="connection_type">
|
| 181 | 161 |
<property name="visible">True</property>
|
| ... | ... | @@ -190,32 +170,20 @@ |
| 190 | 170 |
</packing>
|
| 191 | 171 |
</child>
|
| 192 | 172 |
<child>
|
| 193 |
- <object class="GtkLabel">
|
|
| 173 |
+ <object class="GtkButton" id="cert_button">
|
|
| 174 |
+ <property name="label" translatable="yes">View _Certificate</property>
|
|
| 194 | 175 |
<property name="visible">True</property>
|
| 195 |
- <property name="can_focus">False</property>
|
|
| 196 |
- <property name="halign">end</property>
|
|
| 197 |
- <property name="label" translatable="yes">Security</property>
|
|
| 198 |
- <style>
|
|
| 199 |
- <class name="dim-label"/>
|
|
| 200 |
- </style>
|
|
| 176 |
+ <property name="can_focus">True</property>
|
|
| 177 |
+ <property name="receives_default">True</property>
|
|
| 178 |
+ <property name="halign">center</property>
|
|
| 179 |
+ <property name="margin_top">12</property>
|
|
| 180 |
+ <property name="use_underline">True</property>
|
|
| 181 |
+ <signal name="clicked" handler="_on_cert_button_clicked" swapped="no"/>
|
|
| 201 | 182 |
</object>
|
| 202 | 183 |
<packing>
|
| 203 | 184 |
<property name="left_attach">0</property>
|
| 204 |
- <property name="top_attach">1</property>
|
|
| 205 |
- </packing>
|
|
| 206 |
- </child>
|
|
| 207 |
- <child>
|
|
| 208 |
- <object class="GtkLabel" id="connection_security">
|
|
| 209 |
- <property name="visible">True</property>
|
|
| 210 |
- <property name="can_focus">False</property>
|
|
| 211 |
- <property name="halign">start</property>
|
|
| 212 |
- <property name="label">-</property>
|
|
| 213 |
- <property name="single_line_mode">True</property>
|
|
| 214 |
- <property name="xalign">0</property>
|
|
| 215 |
- </object>
|
|
| 216 |
- <packing>
|
|
| 217 |
- <property name="left_attach">1</property>
|
|
| 218 |
- <property name="top_attach">1</property>
|
|
| 185 |
+ <property name="top_attach">3</property>
|
|
| 186 |
+ <property name="width">2</property>
|
|
| 219 | 187 |
</packing>
|
| 220 | 188 |
</child>
|
| 221 | 189 |
<child>
|
| ... | ... | @@ -223,7 +191,7 @@ |
| 223 | 191 |
<property name="visible">True</property>
|
| 224 | 192 |
<property name="can_focus">False</property>
|
| 225 | 193 |
<property name="halign">end</property>
|
| 226 |
- <property name="label" translatable="yes">Cipher</property>
|
|
| 194 |
+ <property name="label" translatable="yes">Proxy</property>
|
|
| 227 | 195 |
<style>
|
| 228 | 196 |
<class name="dim-label"/>
|
| 229 | 197 |
</style>
|
| ... | ... | @@ -234,12 +202,11 @@ |
| 234 | 202 |
</packing>
|
| 235 | 203 |
</child>
|
| 236 | 204 |
<child>
|
| 237 |
- <object class="GtkLabel" id="connection_cipher">
|
|
| 205 |
+ <object class="GtkLabel" id="connection_proxy">
|
|
| 238 | 206 |
<property name="visible">True</property>
|
| 239 | 207 |
<property name="can_focus">False</property>
|
| 240 | 208 |
<property name="halign">start</property>
|
| 241 |
- <property name="label">-</property>
|
|
| 242 |
- <property name="selectable">True</property>
|
|
| 209 |
+ <property name="label" translatable="yes">No proxy used</property>
|
|
| 243 | 210 |
<property name="xalign">0</property>
|
| 244 | 211 |
</object>
|
| 245 | 212 |
<packing>
|
| ... | ... | @@ -248,67 +215,46 @@ |
| 248 | 215 |
</packing>
|
| 249 | 216 |
</child>
|
| 250 | 217 |
<child>
|
| 251 |
- <object class="GtkLabel" id="connection_proxy_header">
|
|
| 218 |
+ <object class="GtkLabel">
|
|
| 252 | 219 |
<property name="visible">True</property>
|
| 253 | 220 |
<property name="can_focus">False</property>
|
| 254 | 221 |
<property name="halign">end</property>
|
| 255 |
- <property name="label" translatable="yes">Proxy</property>
|
|
| 222 |
+ <property name="label" translatable="yes">Type</property>
|
|
| 256 | 223 |
<style>
|
| 257 | 224 |
<class name="dim-label"/>
|
| 258 | 225 |
</style>
|
| 259 | 226 |
</object>
|
| 260 | 227 |
<packing>
|
| 261 | 228 |
<property name="left_attach">0</property>
|
| 262 |
- <property name="top_attach">3</property>
|
|
| 229 |
+ <property name="top_attach">1</property>
|
|
| 263 | 230 |
</packing>
|
| 264 | 231 |
</child>
|
| 265 | 232 |
<child>
|
| 266 |
- <object class="GtkLabel" id="connection_proxy">
|
|
| 233 |
+ <object class="GtkLabel">
|
|
| 267 | 234 |
<property name="visible">True</property>
|
| 268 | 235 |
<property name="can_focus">False</property>
|
| 269 |
- <property name="halign">start</property>
|
|
| 270 |
- <property name="label" translatable="yes">No proxy used</property>
|
|
| 271 |
- <property name="xalign">0</property>
|
|
| 272 |
- </object>
|
|
| 273 |
- <packing>
|
|
| 274 |
- <property name="left_attach">1</property>
|
|
| 275 |
- <property name="top_attach">3</property>
|
|
| 276 |
- </packing>
|
|
| 277 |
- </child>
|
|
| 278 |
- <child>
|
|
| 279 |
- <object class="GtkButton" id="cert_button">
|
|
| 280 |
- <property name="label" translatable="yes">View _Certificate</property>
|
|
| 281 |
- <property name="visible">True</property>
|
|
| 282 |
- <property name="can_focus">True</property>
|
|
| 283 |
- <property name="receives_default">True</property>
|
|
| 284 |
- <property name="halign">center</property>
|
|
| 285 |
- <property name="margin_top">12</property>
|
|
| 286 |
- <property name="use_underline">True</property>
|
|
| 287 |
- <signal name="clicked" handler="_on_cert_button_clicked" swapped="no"/>
|
|
| 236 |
+ <property name="halign">end</property>
|
|
| 237 |
+ <property name="label" translatable="yes">Protocol</property>
|
|
| 238 |
+ <style>
|
|
| 239 |
+ <class name="dim-label"/>
|
|
| 240 |
+ </style>
|
|
| 288 | 241 |
</object>
|
| 289 | 242 |
<packing>
|
| 290 | 243 |
<property name="left_attach">0</property>
|
| 291 |
- <property name="top_attach">4</property>
|
|
| 292 |
- <property name="width">2</property>
|
|
| 244 |
+ <property name="top_attach">0</property>
|
|
| 293 | 245 |
</packing>
|
| 294 | 246 |
</child>
|
| 295 | 247 |
<child>
|
| 296 |
- <object class="GtkBox" id="spacer2">
|
|
| 297 |
- <property name="width_request">160</property>
|
|
| 248 |
+ <object class="GtkLabel" id="connection_protocol">
|
|
| 298 | 249 |
<property name="visible">True</property>
|
| 299 | 250 |
<property name="can_focus">False</property>
|
| 300 |
- <child>
|
|
| 301 |
- <placeholder/>
|
|
| 302 |
- </child>
|
|
| 251 |
+ <property name="halign">start</property>
|
|
| 303 | 252 |
</object>
|
| 304 | 253 |
<packing>
|
| 305 |
- <property name="left_attach">0</property>
|
|
| 306 |
- <property name="top_attach">5</property>
|
|
| 254 |
+ <property name="left_attach">1</property>
|
|
| 255 |
+ <property name="top_attach">1</property>
|
|
| 307 | 256 |
</packing>
|
| 308 | 257 |
</child>
|
| 309 |
- <child>
|
|
| 310 |
- <placeholder/>
|
|
| 311 |
- </child>
|
|
| 312 | 258 |
<style>
|
| 313 | 259 |
<class name="margin-18"/>
|
| 314 | 260 |
</style>
|
| ... | ... | @@ -226,6 +226,8 @@ class CertificateDialog(Gtk.ApplicationWindow): |
| 226 | 226 |
self._ui = get_builder('certificate_dialog.ui')
|
| 227 | 227 |
self.add(self._ui.certificate_box)
|
| 228 | 228 |
|
| 229 |
+ self.connect('key-press-event', self._on_key_press)
|
|
| 230 |
+ |
|
| 229 | 231 |
self.account = account
|
| 230 | 232 |
self._clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
|
| 231 | 233 |
|
| ... | ... | @@ -269,6 +271,10 @@ class CertificateDialog(Gtk.ApplicationWindow): |
| 269 | 271 |
self._ui.connect_signals(self)
|
| 270 | 272 |
self.show_all()
|
| 271 | 273 |
|
| 274 |
+ def _on_key_press(self, _widget, event):
|
|
| 275 |
+ if event.keyval == Gdk.KEY_Escape:
|
|
| 276 |
+ self.destroy()
|
|
| 277 |
+ |
|
| 272 | 278 |
def _on_copy_cert_info_button_clicked(self, _widget):
|
| 273 | 279 |
clipboard_text = \
|
| 274 | 280 |
self._headline + '\n\n' + \
|
| ... | ... | @@ -17,6 +17,7 @@ from collections import namedtuple |
| 17 | 17 |
from datetime import timedelta
|
| 18 | 18 |
|
| 19 | 19 |
import nbxmpp
|
| 20 |
+from nbxmpp.const import ConnectionType
|
|
| 20 | 21 |
from nbxmpp.util import is_error_result
|
| 21 | 22 |
from gi.repository import Gtk
|
| 22 | 23 |
from gi.repository import Gdk
|
| ... | ... | @@ -99,35 +100,30 @@ class ServerInfo(Gtk.ApplicationWindow, EventHelper): |
| 99 | 100 |
row.set_header(label)
|
| 100 | 101 |
|
| 101 | 102 |
def _add_connection_info(self):
|
| 102 |
- ssl_con = app.connections[self.account].connection.get_ssl_connection()
|
|
| 103 |
- ssl_version = None
|
|
| 104 |
- cipher_name = None
|
|
| 105 |
- if ssl_con is not None:
|
|
| 106 |
- ssl_version = ssl_con.get_cipher_version()
|
|
| 107 |
- cipher_name = ssl_con.get_cipher_name()
|
|
| 108 |
- |
|
| 109 |
- host, proxy = app.connections[self.account].get_connection_info()
|
|
| 110 |
- con_type = host['type']
|
|
| 111 |
- |
|
| 112 | 103 |
# Connection type
|
| 113 |
- self._ui.connection_type.set_text(con_type.upper())
|
|
| 114 |
- if con_type == 'plain':
|
|
| 104 |
+ con_type = app.connections[self.account].connection.current_connection_type
|
|
| 105 |
+ con_type_short = ''
|
|
| 106 |
+ if ConnectionType.DIRECT_TLS:
|
|
| 107 |
+ con_type_short = 'DIRECT TLS'
|
|
| 108 |
+ elif ConnectionType.START_TLS:
|
|
| 109 |
+ con_type_short = 'START TLS'
|
|
| 110 |
+ else:
|
|
| 111 |
+ con_type_short = 'PLAIN'
|
|
| 112 |
+ self._ui.connection_type.set_text(con_type_short)
|
|
| 113 |
+ if con_type is ConnectionType.PLAIN:
|
|
| 115 | 114 |
self._ui.conection_type.get_style_context().add_class(
|
| 116 | 115 |
'error-color')
|
| 117 | 116 |
|
| 118 |
- # Connection security
|
|
| 119 |
- if ssl_version is not None:
|
|
| 120 |
- self._ui.connection_security.set_text(ssl_version)
|
|
| 121 |
- |
|
| 122 |
- # Connection cipher
|
|
| 123 |
- if cipher_name is not None:
|
|
| 124 |
- self._ui.connection_cipher.set_text(cipher_name)
|
|
| 117 |
+ is_websocket = app.connections[self.account].connection.is_websocket
|
|
| 118 |
+ protocol = 'WebSocket' if is_websocket else 'TCP'
|
|
| 119 |
+ self._ui.connection_protocol.set_text(protocol)
|
|
| 125 | 120 |
|
| 121 |
+ # host, proxy = app.connections[self.account].get_connection_info()
|
|
| 126 | 122 |
# Connection proxy
|
| 127 |
- if proxy:
|
|
| 128 |
- if proxy['type'] in ['http', 'socks5']:
|
|
| 129 |
- self._ui.connection_proxy.set_text(
|
|
| 130 |
- proxy['host'] + ':' + proxy['port'])
|
|
| 123 |
+ # if proxy:
|
|
| 124 |
+ # if proxy['type'] in ['http', 'socks5']:
|
|
| 125 |
+ # self._ui.connection_proxy.set_text(
|
|
| 126 |
+ # proxy['host'] + ':' + proxy['port'])
|
|
| 131 | 127 |
|
| 132 | 128 |
self._ui.cert_button.set_sensitive(self.cert)
|
| 133 | 129 |
|