From 0d99f3a2d5ee9f171a96a841e129751fe10d3868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Br=C3=B6tzmann?= Date: Mon, 15 Apr 2019 11:00:31 +0200 Subject: [PATCH] [pgp] Update dialog GUI --- pgp/gtk/choose_key.ui | 6 ++++-- pgp/gtk/config.py | 7 ++++++- pgp/gtk/config.ui | 6 ++++-- pgp/gtk/key.py | 14 ++++++++++---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/pgp/gtk/choose_key.ui b/pgp/gtk/choose_key.ui index 37decf8..8e91fce 100644 --- a/pgp/gtk/choose_key.ui +++ b/pgp/gtk/choose_key.ui @@ -11,9 +11,11 @@ + 500 + 300 True False - 6 + 18 vertical 6 @@ -62,7 +64,7 @@ True True - 1 + 0 diff --git a/pgp/gtk/config.py b/pgp/gtk/config.py index cd0ef74..d806b03 100644 --- a/pgp/gtk/config.py +++ b/pgp/gtk/config.py @@ -18,6 +18,7 @@ from pathlib import Path from gi.repository import Gtk from gi.repository import Gdk +from gi.repository import GLib from gajim.common import app @@ -64,6 +65,9 @@ class Page(Gtk.Box): self._plugin = plugin self._label = Gtk.Label() self._button = Gtk.Button(label=_('Assign Key')) + self._button.get_style_context().add_class('suggested-action') + self._button.set_halign(Gtk.Align.CENTER) + self._button.set_margin_top(18) self._button.connect('clicked', self._on_assign) self._load_key() @@ -101,4 +105,5 @@ class Page(Gtk.Box): self._label.set_text(_('No key assigned')) else: key_id, key_user = key_data - self._label.set_text('%s %s' % (key_id, key_user)) + self._label.set_markup('%s %s' % \ + (key_id, GLib.markup_escape_text(key_user))) diff --git a/pgp/gtk/config.ui b/pgp/gtk/config.ui index c09c849..bdafb29 100644 --- a/pgp/gtk/config.ui +++ b/pgp/gtk/config.ui @@ -3,8 +3,6 @@ - 500 - 400 True False 12 @@ -22,8 +20,12 @@ + 400 + 350 True False + True + 18 crossfade diff --git a/pgp/gtk/key.py b/pgp/gtk/key.py index 10e360c..64827fb 100644 --- a/pgp/gtk/key.py +++ b/pgp/gtk/key.py @@ -17,6 +17,7 @@ from pathlib import Path from gi.repository import Gtk +from gi.repository import GLib from gajim.common import app from gajim.plugins.plugins_i18n import _ @@ -30,7 +31,7 @@ class KeyDialog(Gtk.Dialog): self.set_transient_for(transient) self.set_resizable(True) - self.set_default_size(500, 300) + self.set_default_size(450, -1) self._plugin = plugin self._jid = jid @@ -38,10 +39,14 @@ class KeyDialog(Gtk.Dialog): self._label = Gtk.Label() - self._assign_button = Gtk.Button(label='assign') + self._assign_button = Gtk.Button(label=_('Assign Key')) + self._assign_button.get_style_context().add_class('suggested-action') + self._assign_button.set_halign(Gtk.Align.CENTER) + self._assign_button.set_margin_top(18) self._assign_button.connect('clicked', self._choose_key) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + box.set_border_width(18) box.add(self._label) box.add(self._assign_button) @@ -82,7 +87,8 @@ class KeyDialog(Gtk.Dialog): self._label.set_text(_('No key assigned')) else: key_id, key_user = key_data - self._label.set_text('%s %s' % (key_id, key_user)) + self._label.set_markup('%s %s' % \ + (key_id, GLib.markup_escape_text(key_user))) class ChooseGPGKeyDialog(Gtk.Dialog): @@ -97,8 +103,8 @@ class ChooseGPGKeyDialog(Gtk.Dialog): self.set_resizable(True) self.set_default_size(500, 300) - self.add_button(_('OK'), Gtk.ResponseType.OK) self.add_button(_('Cancel'), Gtk.ResponseType.CANCEL) + self.add_button(_('OK'), Gtk.ResponseType.OK) self._selected_key = None