more cleanup on prompt info
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 7 Oct 2010 02:59:15 +0000 (22:59 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Thu, 7 Oct 2010 02:59:15 +0000 (22:59 -0400)
Crypt/Monkeysphere/MSVA/MarginalUI.pm
monkeysphere-icon.png [new file with mode: 0644]

index 843ff274d3e9233031d7a1c7d1e719ba2dd08463..12a7bb35ae20fa65f3f0057749a203c5fe9cb348 100755 (executable)
           # We now know the list of fully/ultimately-valid
           # certifiers, and a separate list of marginally-valid
           # certifiers.
-          if ($#valid_certifiers == -1) {
+          if ($#valid_certifiers < -1) {
             msvalog('info', "No valid certifiers, so no marginal UI\n");
           } else {
             my $certifier_list = join("\n", map { sprintf("[%s] %s", $_->{key_id}, $_->{user_id}) } @valid_certifiers);
-            my $msg = sprintf("The matching key for [%s] is not %svalid.\n----------\nhost: %s\nkey fingerprint: 0x%.40s\nvalidity: %s\n----------\nThe certificate is certified by the following people:\n\n%s\n\nWould you like to temporarily accept this certification?",
+            my $msg = sprintf("The matching key for [%s] is not %svalid.
+----------
+The certificate is certified by:
+
+%s
+
+Would you like to temporarily accept this certification?",
                               $uid,
                               ('m' == $keyfpr->{val} ? 'fully ' : ''),
-                             $uid,
-                              $keyfpr->{fpr}->as_hex_string,
-                             $keyfpr->{val},
                               $certifier_list,
                              );
+            my $tip = sprintf("Peer: %s
+Key fingerprint: 0x%.40s
+GnuPG calculated validity: %s",
+                             $uid,
+                              $keyfpr->{fpr}->as_hex_string,
+                             $keyfpr->{val});
             # FIXME: what about revoked certifications?
             # FIXME: what about expired certifications?
             # FIXME: what about certifications ostensibly made in the future?
             msvalog('info', "%s\n", $msg);
-            my $resp = prompt($msg);
+            msvalog('verbose', "%s\n", $tip);
+            my $resp = prompt($uid, $msg, $tip);
             if ($resp) {
               return $resp;
             }
   }
 
   sub prompt {
+    my $peer = shift;
     my $labeltxt = shift;
+    my $tip = shift;
 
     Gtk2->init();
     # create a new dialog with some buttons - one stock, one not.
-    my $dialog = Gtk2::Dialog->new('Monkeysphere validation agent',
+    my $dialog = Gtk2::Dialog->new(sprintf('Monkeysphere validation agent [%s]', $peer),
                                    undef,
                                    [],
                                    'gtk-no' => 'cancel',
     # make the text in the dialog box selectable
     $label->set('selectable', 1);
     $label->show();
+    my $tooltips = Gtk2::Tooltips->new();
+    $tooltips->set_tip($label, $tip);
     $dialog->get_content_area()->add($label);
     my $resp = 0;
 
-    $dialog->set_default_response ('cancel');
+    my $icon_file = '/usr/share/pixmaps/monkeysphere-icon.png';
+
+    $dialog->set_default_icon_from_file($icon_file)
+      if (-r $icon_file);
+    $dialog->set_default_response('cancel');
 
     my $response = $dialog->run();
     if ($response eq 'ok') {
diff --git a/monkeysphere-icon.png b/monkeysphere-icon.png
new file mode 100644 (file)
index 0000000..13b5efc
Binary files /dev/null and b/monkeysphere-icon.png differ