Commit 8936a07e authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

ServerInfo: Rework Dialog

- Split information into different notebook tabs
- Show connection information (Fixes #6096)
parent 0c84072e
......@@ -27,7 +27,7 @@
from gajim.gtk.dialogs import ShortcutsWindow
from gajim.gtk.history_sync import HistorySyncAssistant
from gajim.gtk.server_info import ServerInfoDialog
from gajim.gtk.server_info import ServerInfo
from gajim.gtk.mam_preferences import MamPreferences
from gajim.gtk.preferences import Preferences
from gajim.gtk.groupchat_creation import CreateGroupchatWindow
......@@ -241,11 +241,11 @@ def on_privacy_lists(action, param):
def on_server_info(action, param):
account = param.get_string()
if 'server_info' in interface.instances[account]:
interface.instances[account]['server_info'].present()
window = app.get_app_window(ServerInfo, account)
if window is None:
ServerInfo(account)
else:
interface.instances[account]['server_info'] = \
ServerInfoDialog(account)
window.present()
def on_xml_console(action, param):
......
......@@ -1018,6 +1018,9 @@ def log_hosttype_info(self, port):
msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port'])
log.info(msg)
def get_connection_info(self):
return self._current_host, self._proxy
def _connect_failure(self, con_type=None):
if not con_type:
# we are not retrying, and not conecting
......
......@@ -59,10 +59,10 @@
</object>
</child>
<child>
<object class="GtkMenuItem" id="view_certificate_menuitem">
<object class="GtkMenuItem" id="view_server_info_menuitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_View Certificate</property>
<property name="label" translatable="yes">_View Server Info</property>
<property name="use_underline">True</property>
</object>
</child>
......
......@@ -79,6 +79,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -106,6 +107,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -133,6 +135,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -163,7 +166,8 @@
<property name="wrap">True</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
<property name="max_width_chars">21</property>
<property name="max_width_chars">30</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -191,6 +195,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -218,6 +223,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -245,6 +251,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -272,6 +279,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -299,6 +307,7 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;&gt;</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -347,6 +356,7 @@
<property name="wrap">True</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
<property name="max_width_chars">52</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -363,7 +373,7 @@
<property name="wrap">True</property>
<property name="wrap_mode">char</property>
<property name="selectable">True</property>
<property name="max_width_chars">42</property>
<property name="max_width_chars">52</property>
</object>
<packing>
<property name="left_attach">0</property>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkNotebook" id="server_info_notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="server">
<property name="visible">True</property>
<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">Hostname</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="server_hostname">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="selectable">True</property>
<property name="ellipsize">end</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">0</property>
</packing>
</child>
<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">Server Software</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="server_software">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="selectable">True</property>
<property name="ellipsize">end</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>
</packing>
</child>
<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">Server Uptime</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="server_uptime">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="selectable">True</property>
<property name="ellipsize">end</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="spacer1">
<property name="width_request">160</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="margin-18"/>
</style>
</object>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Server</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<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>
<child>
<object class="GtkLabel" id="connection_type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</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">0</property>
</packing>
</child>
<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">Security</property>
<style>
<class name="dim-label"/>
</style>
</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>
</packing>
</child>
<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">Cipher</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="connection_cipher">
<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="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="connection_proxy_header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Proxy</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<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" 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"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="spacer2">
<property name="width_request">160</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="margin-18"/>
</style>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Connection</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="features">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">18</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="features_scrolled">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="max_content_height">500</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="clipboard_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Copy info to clipboard</property>
<property name="halign">end</property>
<signal name="clicked" handler="_on_clipboard_button_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-copy-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Features</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
</interface>
......@@ -66,11 +66,11 @@ #HistorySyncAssistant list > row.activatable:selected > label { color: @theme_se
#FinishedLabel { font-size: 14px; font-weight: bold }
/* Server Info */
#ServerInfoGrid > list { border: 1px solid; border-color: @borders; }
#ServerInfoGrid > list > row:first-child { border-top: 1px solid; border-color: @borders; }
#ServerInfoGrid > list > row { padding: 10px 20px 10px 10px; }
#ServerInfoGrid > list > label { padding:10px; color: @insensitive_fg_color; font-weight: bold; }
#ServerInfoGrid > list > row.activatable:active { box-shadow: none; }
#ServerInfo { border: 1px solid; border-color: @borders; }
#ServerInfo > row:first-child { border-top: 1px solid; border-color: @borders; }
#ServerInfo > row { padding: 10px 20px 10px 10px; }
#ServerInfo > label { padding:10px; color: @insensitive_fg_color; font-weight: bold; }
#ServerInfo > row.activatable:active { box-shadow: none; }
/* Features Info */
#FeaturesInfoGrid > list { border: 1px solid; border-color: @borders; }
......@@ -225,6 +225,7 @@ .margin-top12 { margin-top: 12px; }
.margin-12 { margin: 12px; }
.margin-18 { margin: 18px; }
.padding-18 { margin: 18px; }
.padding-left30 { padding-left: 30px; }
/* Treeview */
treeview.space { padding: 6px; }
......
......@@ -468,6 +468,7 @@ def __init__(self, transient_for, account, cert):
self._ui = get_builder('certificate_dialog.ui')
self.add(self._ui.certificate_box)
self.account = account
self._clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
# Get data for labels and copy button
......@@ -483,10 +484,10 @@ def __init__(self, transient_for, account, cert):
self._ib_organization = issuer.organizationName or ''
self._ib_org_unit = issuer.organizationalUnitName or ''
issued = datetime.strptime(cert.get_notBefore().decode('ascii'),
'%Y%m%d%H%M%SZ')
'%Y%m%d%H%M%SZ')
self._issued = issued.strftime('%B %d, %Y, %H:%M:%S %z')
expires = datetime.strptime(cert.get_notAfter().decode('ascii'),
'%Y%m%d%H%M%SZ')
'%Y%m%d%H%M%SZ')
self._expires = expires.strftime('%B %d, %Y, %H:%M:%S %z')
self._sha1 = cert.digest('sha1').decode('utf-8')
self._sha256 = cert.digest('sha256').decode('utf-8')
......
......@@ -20,85 +20,68 @@
from nbxmpp.util import is_error_result
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import _
from gajim.gtk.dialogs import CertificateDialog
from gajim.gtk.util import ensure_not_destroyed
from gajim.gtk.util import get_builder
log = logging.getLogger('gajim.gtk.serverinfo')
log = logging.getLogger('gajim.gtk.server_info')
class ServerInfoDialog(Gtk.Dialog):
class ServerInfo(Gtk.ApplicationWindow):
def __init__(self, account):
super().__init__(title=_('Server Info'),
transient_for=None,
destroy_with_parent=True)
Gtk.ApplicationWindow.__init__(self)
self.set_name('ServerInfo')
self.set_application(app.app)
self.set_position(Gtk.WindowPosition.CENTER)
self.set_default_size(400, 600)
self.set_show_menubar(False)
self.set_title(_('Server Info'))
self.account = account
self._destroyed = False
self.set_transient_for(app.interface.roster.window)
self.set_resizable(True)
self.set_size_request(300, 500)
grid = Gtk.Grid()
grid.set_name('ServerInfoGrid')
grid.set_row_spacing(10)
grid.set_hexpand(True)
self._ui = get_builder('server_info.ui')
self.add(self._ui.server_info_notebook)
self.info_listbox = Gtk.ListBox()
self.info_listbox.set_selection_mode(Gtk.SelectionMode.NONE)
self.info_listbox.set_header_func(self.header_func, 'Information')
grid.attach(self.info_listbox, 0, 0, 1, 1)
self.feature_listbox = Gtk.ListBox()
self.feature_listbox.set_selection_mode(Gtk.SelectionMode.NONE)
self.feature_listbox.set_header_func(self.header_func, 'Features')
grid.attach(self.feature_listbox, 0, 1, 1, 1)
self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)