Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: 264735fb by wurstsalat at 2022-01-26T19:01:13+01:00 ServerInfo: Add Certificate tab
- - - - -
3 changed files:
- gajim/data/gui/server_info.ui - gajim/gtk/builder.pyi - gajim/gtk/server_info.py
Changes:
===================================== gajim/data/gui/server_info.ui ===================================== @@ -6,7 +6,7 @@ <property name="visible">True</property> <property name="can-focus">True</property> <child> - <!-- n-columns=3 n-rows=5 --> + <!-- n-columns=2 n-rows=5 --> <object class="GtkGrid" id="server"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -135,21 +135,6 @@ <property name="width">2</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> <style> <class name="margin-18"/> </style> @@ -161,12 +146,9 @@ <property name="can-focus">False</property> <property name="label" translatable="yes">Server</property> </object> - <packing> - <property name="tab-fill">False</property> - </packing> </child> <child> - <!-- n-columns=3 n-rows=9 --> + <!-- n-columns=2 n-rows=7 --> <object class="GtkGrid"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -214,23 +196,6 @@ <property name="top-attach">5</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">8</property> - <property name="width">2</property> - </packing> - </child> <child> <object class="GtkLabel"> <property name="visible">True</property> @@ -382,39 +347,6 @@ <property name="top-attach">3</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> <style> <class name="margin-18"/> </style> @@ -431,7 +363,42 @@ </object> <packing> <property name="position">1</property> - <property name="tab-fill">False</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <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="cert_scrolled"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</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">Certificate</property> + </object> + <packing> + <property name="position">2</property> </packing> </child> <child> @@ -492,7 +459,7 @@ </child> </object> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> <child type="tab"> @@ -502,8 +469,7 @@ <property name="label" translatable="yes">Features</property> </object> <packing> - <property name="position">2</property> - <property name="tab-fill">False</property> + <property name="position">3</property> </packing> </child> </object>
===================================== gajim/gtk/builder.pyi ===================================== @@ -818,6 +818,7 @@ class ServerInfoBuilder(Builder): dns: Gtk.Label ip_port: Gtk.Label websocket: Gtk.Label + cert_scrolled: Gtk.ScrolledWindow features: Gtk.Box features_listbox: Gtk.ListBox clipboard_button: Gtk.Button
===================================== gajim/gtk/server_info.py ===================================== @@ -40,8 +40,8 @@ from gajim.common.i18n import _
from .builder import get_builder +from .certificate_dialog import CertificateBox from .util import EventHelper -from .util import open_window
log = logging.getLogger('gajim.gui.server_info')
@@ -99,6 +99,9 @@ def __init__(self, account: str) -> None: self._cert = self._client.certificate self._add_connection_info()
+ cert_box = CertificateBox(account, self._cert) + self._ui.cert_scrolled.add(cert_box) + for feature in self._get_features(): self._add_feature(feature) self._clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) @@ -128,8 +131,6 @@ def _add_connection_info(self) -> None: self._ui.proxy_type.set_text(proxy.type) self._ui.proxy_host.set_text(proxy.host)
- self._ui.cert_button.set_sensitive(self._cert) - self._ui.domain.set_text(address.domain)
visible = address.service is not None @@ -147,12 +148,6 @@ def _add_connection_info(self) -> None: self._ui.websocket.set_visible(visible) self._ui.websocket.set_text(address.uri or '')
- def _on_cert_button_clicked(self, _button: Gtk.Button) -> None: - open_window('CertificateDialog', - account=self.account, - transient_for=self, - cert=self._cert) - def _add_contact_addresses(self, dataforms: list[SimpleDataForm]) -> None: fields = { 'admin-addresses': _('Admin'), @@ -342,6 +337,7 @@ def __init__(self, feature: Feature) -> None:
self._icon = Gtk.Image() self._feature_label = Gtk.Label() + self._feature_label.set_halign(Gtk.Align.START) self._additional_label = Gtk.Label() self._additional_label.set_halign(Gtk.Align.START) self._additional_label.set_no_show_all(True)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/264735fbbff25ae499f517b67e7bc34a5...