[seahorse/akallabeth/seahorse-ssh_pubkey_display: 1/2] ssh: KeyProperties: Add public key to dialog



commit fc117b68054e5c9909c79d94c96e021b8013509d
Author: Armin Novak <armin novak thincast com>
Date:   Wed Nov 6 11:14:15 2019 +0100

    ssh: KeyProperties: Add public key to dialog
    
    Fixes https://gitlab.gnome.org/GNOME/seahorse/issues/154

 ssh/key-properties.vala            |  3 +++
 ssh/key.vala                       |  7 +++++++
 ssh/seahorse-ssh-key-properties.ui | 33 +++++++++++++++++++++++++++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/ssh/key-properties.vala b/ssh/key-properties.vala
index 61f0d773..2b13b7ac 100644
--- a/ssh/key-properties.vala
+++ b/ssh/key-properties.vala
@@ -42,6 +42,8 @@ public class Seahorse.Ssh.KeyProperties : Gtk.Dialog {
     [GtkChild]
     private Gtk.Label location_label;
     [GtkChild]
+    private Gtk.Label pubkey_label;
+    [GtkChild]
     private Gtk.Label key_length_label;
 
     public KeyProperties(Key key, Gtk.Window parent) {
@@ -75,6 +77,7 @@ public class Seahorse.Ssh.KeyProperties : Gtk.Dialog {
         this.algo_label.label = this.key.get_algo().to_string() ?? _("Unknown type");
         this.location_label.label = this.key.get_location();
         this.key_length_label.label = "%u".printf(this.key.get_strength());
+        this.pubkey_label.label = this.key.pubkey;
 
         this.updating_ui = false;
     }
diff --git a/ssh/key.vala b/ssh/key.vala
index 1b1bf8ee..da3ba01b 100644
--- a/ssh/key.vala
+++ b/ssh/key.vala
@@ -38,6 +38,13 @@ public class Seahorse.Ssh.Key : Seahorse.Object, Seahorse.Exportable, Seahorse.D
         get { return (this.key_data != null) ? this.key_data.fingerprint : null; }
     }
 
+    /**
+     * Public data for this key
+     */
+    public string? pubkey {
+        get { return (this.key_data != null) ? this.key_data.rawdata : null; }
+    }
+
     /**
      * Description
      */
diff --git a/ssh/seahorse-ssh-key-properties.ui b/ssh/seahorse-ssh-key-properties.ui
index 4eb8fd6d..c0d8d538 100644
--- a/ssh/seahorse-ssh-key-properties.ui
+++ b/ssh/seahorse-ssh-key-properties.ui
@@ -203,6 +203,35 @@
                 <property name="position">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkExpander">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <object class="GtkLabel" id="pubkey_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="wrap">True</property>
+                    <property name="wrap_mode">char</property>
+                    <property name="selectable">True</property>
+                    <property name="max_width_chars">80</property>
+                    <property name="track_visited_links">False</property>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Public Key</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
@@ -266,7 +295,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -328,7 +357,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]