[gnome-keysign: 2/11] send: split the import infobar up in to two infobars
- From: Tobias Mueller <tobiasmue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keysign: 2/11] send: split the import infobar up in to two infobars
- Date: Wed, 7 Oct 2020 18:17:03 +0000 (UTC)
commit 22466372eb7fcfaf6150859fbf11166b5d58de81
Author: Tobias Mueller <muelli cryptobitch de>
Date: Thu Sep 10 17:58:23 2020 +0200
send: split the import infobar up in to two infobars
Now we have an "okay" and an "error" case. The reason is to manage less
state with a future "return signature" button. Such a button would need
to disappear in the error case (and re-appear in the happy case).
Instead of juggling with the visibility state, we make two infobars that
can be made visible.
keysign/keylistwidget.py | 16 +++++--
keysign/send.py | 15 +++---
keysign/send.ui | 116 ++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 128 insertions(+), 19 deletions(-)
---
diff --git a/keysign/keylistwidget.py b/keysign/keylistwidget.py
index 186add1..1fa0603 100755
--- a/keysign/keylistwidget.py
+++ b/keysign/keylistwidget.py
@@ -140,10 +140,18 @@ class KeyListWidget(Gtk.HBox):
fix_infobar(self.ib_internet)
self.label_ib_internet = builder.get_object('label_internet')
- self.ib_import = builder.get_object('infobar_import')
- fix_infobar(self.ib_import)
- self.label_ib_import = builder.get_object('label_import')
- self.image_ib_import = builder.get_object('image_import')
+ self.ib_import_okay = builder.get_object('infobar_import_okay')
+ self.ib_import_error = builder.get_object('infobar_import_error')
+ assert self.ib_import_okay
+ assert self.ib_import_error
+ fix_infobar(self.ib_import_okay)
+ fix_infobar(self.ib_import_error)
+ self.label_ib_import_okay = builder.get_object('label_import_okay')
+ self.image_ib_import_okay = builder.get_object('image_import_okay')
+ self.label_ib_import_error = builder.get_object('label_import_error')
+ self.image_ib_import_error = builder.get_object('image_import_error')
+ self.button_ib_import_error = builder.get_object('import_error_details_button')
+ self.button_ib_import_okay = builder.get_object('return_signature')
if len(list(keys)) <= 0:
infobar = builder.get_object("infobar")
diff --git a/keysign/send.py b/keysign/send.py
index b6d6ed2..347ad4e 100644
--- a/keysign/send.py
+++ b/keysign/send.py
@@ -137,7 +137,7 @@ class SendApp:
self.signature_imported()
except errors.GPGMEError as e:
log.exception("Could not import signatures")
- self.signature_import_error()
+ self.signature_import_error(e)
@inlineCallbacks
def on_key_activated(self, widget, key):
@@ -215,16 +215,13 @@ class SendApp:
log.info("No Internet connection")
def signature_imported(self):
- self.klw.image_ib_import.set_from_icon_name(Gtk.STOCK_OK, Gtk.IconSize.BUTTON)
- self.klw.label_ib_import.set_label(_("The signature has been successfully imported!"))
- self.klw.ib_import.show()
+ self.klw.ib_import_okay.show()
log.info("Signature imported")
- def signature_import_error(self):
- self.klw.image_ib_import.set_from_icon_name(Gtk.STOCK_DIALOG_ERROR, Gtk.IconSize.BUTTON)
- self.klw.label_ib_import.set_label(_("An error occurred while trying to import the signature.\n"
- "Please double check the correctness of the chosen signature."))
- self.klw.ib_import.show()
+ def signature_import_error(self, e):
+ self.klw.ib_import_error.show()
+ # We hide the error details button, because we don't have that functionality just yet
+ self.klw.button_ib_import_error.hide()
log.info("Signature import error")
def create_keypresent(self, discovery_code, discovery_data):
diff --git a/keysign/send.ui b/keysign/send.ui
index e849b23..59c370b 100644
--- a/keysign/send.ui
+++ b/keysign/send.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.16"/>
<object class="GtkApplicationWindow" id="appwindow">
@@ -236,7 +236,7 @@ Please use, e.g. Seahorse to create one.</property>
</packing>
</child>
<child>
- <object class="GtkInfoBar" id="infobar_import">
+ <object class="GtkInfoBar" id="infobar_import_okay">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
@@ -261,7 +261,7 @@ Please use, e.g. Seahorse to create one.</property>
<property name="can_focus">False</property>
<property name="spacing">16</property>
<child>
- <object class="GtkLabel" id="label_import">
+ <object class="GtkLabel" id="label_import_okay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">The signature has been successfully
imported!</property>
@@ -273,7 +273,7 @@ Please use, e.g. Seahorse to create one.</property>
</packing>
</child>
<child>
- <object class="GtkImage" id="image_import">
+ <object class="GtkImage" id="image_import_okay">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-dialog-ok</property>
@@ -285,7 +285,20 @@ Please use, e.g. Seahorse to create one.</property>
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkButton" id="return_signature">
+ <property name="label">gtk-undo</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Returns the received certification
back to the sender, so that the sender can make use of your OpenPGP certificate</property>
+ <property name="use_stock">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
</child>
</object>
<packing>
@@ -304,6 +317,97 @@ Please use, e.g. Seahorse to create one.</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkInfoBar" id="infobar_import_error">
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="margin_bottom">5</property>
+ <property name="show_close_button">True</property>
+ <signal name="close" handler="on_ib_closed" swapped="no"/>
+ <signal name="response" handler="on_ib_closed" swapped="no"/>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="import_error_details_button">
+ <property name="label">gtk-info</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Display more details for the
error.</property>
+ <property name="use_stock">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="content_area">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <child>
+ <object class="GtkLabel" id="label_import_error">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">An error occurred while trying to import
the signature.</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="image_import_error">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-dialog-error</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@@ -396,7 +500,7 @@ Please use, e.g. Seahorse to create one.</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]