changeset 19b254b4f0b2 in /home/hg/repos/gajim-plugins
author: lovetox forenjunkie@chello.at branches: details:gajim-plugins?cmd=changeset;node=19b254b4f0b2 description: Made one Verify Button instead of Trust/Untrust Button
diffstat:
omemo/config_dialog.ui | 24 +------------ omemo/fpr_dialog.ui | 24 +------------ omemo/ui.py | 90 +++++++++++-------------------------------------- 3 files changed, 25 insertions(+), 113 deletions(-)
diffs (243 lines):
diff -r bcca3dc4f68d -r 19b254b4f0b2 omemo/config_dialog.ui --- a/omemo/config_dialog.ui Sat Jun 04 17:10:50 2016 +0200 +++ b/omemo/config_dialog.ui Sun Jun 05 12:09:17 2016 +0200 @@ -54,7 +54,7 @@ <object class="GtkLabel" id="fingerprint_label_desc"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes" comments="Descriptive label">Fingerprint:</property> + <property name="label" translatable="yes" comments="Descriptive label">Own Fingerprint:</property> </object> <packing> <property name="expand">False</property> @@ -83,12 +83,6 @@ <property name="position">0</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> </child> </object> @@ -223,7 +217,7 @@ <property name="homogeneous">True</property> <child> <object class="GtkButton" id="trust_button"> - <property name="label" translatable="yes" comments="button">Trust Fingerprint</property> + <property name="label" translatable="yes" comments="button">Verify Fingerprint</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -235,20 +229,6 @@ <property name="position">0</property> </packing> </child> - <child> - <object class="GtkButton" id="untrust_button"> - <property name="label" translatable="yes" comments="button">UnTrust Fingerprint</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="clicked" handler="untrust_button_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> diff -r bcca3dc4f68d -r 19b254b4f0b2 omemo/fpr_dialog.ui --- a/omemo/fpr_dialog.ui Sat Jun 04 17:10:50 2016 +0200 +++ b/omemo/fpr_dialog.ui Sun Jun 05 12:09:17 2016 +0200 @@ -55,7 +55,7 @@ <object class="GtkLabel" id="fingerprint_label_desc"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes" comments="Descriptive label">Fingerprint:</property> + <property name="label" translatable="yes" comments="Descriptive label">Own Fingerprint:</property> </object> <packing> <property name="expand">False</property> @@ -84,12 +84,6 @@ <property name="position">0</property> </packing> </child> - <child> - <placeholder/> - </child> - <child> - <placeholder/> - </child> </object> </child> </object> @@ -168,7 +162,7 @@ <property name="homogeneous">True</property> <child> <object class="GtkButton" id="trust_button"> - <property name="label" translatable="yes" comments="button">Trust Fingerprint</property> + <property name="label" translatable="yes" comments="button">Verify Fingerprint</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -180,20 +174,6 @@ <property name="position">0</property> </packing> </child> - <child> - <object class="GtkButton" id="untrust_button"> - <property name="label" translatable="yes" comments="button">UnTrust Fingerprint</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="clicked" handler="untrust_button_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> diff -r bcca3dc4f68d -r 19b254b4f0b2 omemo/ui.py --- a/omemo/ui.py Sat Jun 04 17:10:50 2016 +0200 +++ b/omemo/ui.py Sun Jun 05 12:09:17 2016 +0200 @@ -41,8 +41,10 @@
def on_click(self, widget): dlg = FingerprintWindow(self.plugin, self.contact) - dlg.run() - dlg.destroy() + if dlg.run() == gtk.RESPONSE_CLOSE: + dlg.destroy() + else: + dlg.destroy()
class Checkbox(gtk.CheckButton): @@ -194,46 +196,21 @@ (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO)) l = gtk.Label() - l.set_markup('Are you sure you want to trust the following ' + l.set_markup('Do you want to trust the following ' 'fingerprint for the contact <b>%s</b> on the account <b>%s</b>?' '\n\n<tt>%s</tt>' % (user, account, fpr)) l.set_line_wrap(True) dlg.vbox.pack_start(l) dlg.show_all()
- if dlg.run() == gtk.RESPONSE_YES: - state.store.identityKeyStore.setTrust(_id, TRUSTED) - if self.plugin.ui_list[account][user]: + response = dlg.run() + if response == gtk.RESPONSE_YES: + state.store.identityKeyStore.setTrust(_id, TRUSTED) + if self.plugin.ui_list[account][user]: self.plugin.ui_list[account][user].refreshAuthLockSymbol() - dlg.destroy() - - self.update_context_list() - - def untrust_button_clicked_cb(self, button, *args): - active = self.B.get_object('account_combobox').get_active() - account = self.account_store[active][0] - - state = self.plugin.get_omemo_state(account) - - mod, paths = self.fpr_view.get_selection().get_selected_rows() - - for path in paths: - it = mod.get_iter(path) - _id, user, fpr = mod.get(it, 0, 1, 3) - fpr = fpr[31:-12] - dlg = gtk.Dialog('Confirm trusting fingerprint', self, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - (gtk.STOCK_YES, gtk.RESPONSE_YES, - gtk.STOCK_NO, gtk.RESPONSE_NO)) - l = gtk.Label() - l.set_markup('Are you sure you want to NOT trust the following ' - 'fingerprint for the contact <b>%s</b> on the account <b>%s</b>?' - '\n\n<tt>%s</tt>' % (user, account, fpr)) - l.set_line_wrap(True) - dlg.vbox.pack_start(l) - dlg.show_all() - - if dlg.run() == gtk.RESPONSE_YES: + dlg.destroy() + else: + if response == gtk.RESPONSE_NO: state.store.identityKeyStore.setTrust(_id, UNTRUSTED) if self.plugin.ui_list[account][user]: self.plugin.ui_list[account][user].refreshAuthLockSymbol() @@ -321,7 +298,7 @@ title=('Fingerprints for %s') % contact.jid, parent=parent, flags=gtk.DIALOG_DESTROY_WITH_PARENT, - buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) + buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)) self.plugin = plugin self.GTK_BUILDER_FILE_PATH = \ self.plugin.local_file_path('fpr_dialog.ui') @@ -360,44 +337,19 @@ (gtk.STOCK_YES, gtk.RESPONSE_YES, gtk.STOCK_NO, gtk.RESPONSE_NO)) l = gtk.Label() - l.set_markup('Are you sure you want to trust the following ' + l.set_markup('Do you want to trust the following ' 'fingerprint for the contact <b>%s</b> on the account <b>%s</b>?' '\n\n<tt>%s</tt>' % (user, account, fpr)) l.set_line_wrap(True) dlg.vbox.pack_start(l) dlg.show_all() - - if dlg.run() == gtk.RESPONSE_YES: - state.store.identityKeyStore.setTrust(_id, TRUSTED) - self.plugin.ui_list[account][self.contact.jid].refreshAuthLockSymbol() - dlg.destroy() - - self.update_context_list() - - def untrust_button_clicked_cb(self, button, *args): - account = self.contact.account.name - - state = self.plugin.get_omemo_state(account) - - mod, paths = self.fpr_view.get_selection().get_selected_rows() - - for path in paths: - it = mod.get_iter(path) - _id, user, fpr = mod.get(it, 0, 1, 3) - fpr = fpr[31:-12] - dlg = gtk.Dialog('Confirm trusting fingerprint', self, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, - (gtk.STOCK_YES, gtk.RESPONSE_YES, - gtk.STOCK_NO, gtk.RESPONSE_NO)) - l = gtk.Label() - l.set_markup('Are you sure you want to NOT trust the following ' - 'fingerprint for the contact <b>%s</b> on the account <b>%s</b>?' - '\n\n<tt>%s</tt>' % (user, account, fpr)) - l.set_line_wrap(True) - dlg.vbox.pack_start(l) - dlg.show_all() - - if dlg.run() == gtk.RESPONSE_YES: + response = dlg.run() + if response == gtk.RESPONSE_YES: + state.store.identityKeyStore.setTrust(_id, TRUSTED) + self.plugin.ui_list[account][self.contact.jid].refreshAuthLockSymbol() + dlg.destroy() + else: + if response == gtk.RESPONSE_NO: state.store.identityKeyStore.setTrust(_id, UNTRUSTED) self.plugin.ui_list[account][self.contact.jid].refreshAuthLockSymbol() dlg.destroy()