[seahorse/wip/nielsdg/cleanup-keyproperties-email: 3/4] pgp: KeyProperties: make the email a link



commit 25a2efe15152add2ff83246b710e477271db76e2
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Jan 12 09:32:05 2019 +0100

    pgp: KeyProperties: make the email a link

 pgp/seahorse-pgp-key-properties.c          | 17 +++++--
 pgp/seahorse-pgp-private-key-properties.ui | 72 ++++++++++++----------------
 pgp/seahorse-pgp-public-key-properties.ui  | 77 +++++++++++++-----------------
 3 files changed, 76 insertions(+), 90 deletions(-)
---
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 770d6923..cc57949c 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -861,7 +861,6 @@ do_owner (SeahorseWidget *swidget)
 {
        SeahorseObject *object;
        SeahorsePgpKey *pkey;
-       SeahorsePgpUid *uid;
        GtkWidget *widget;
        GtkCellRenderer *renderer;
        GtkListStore *store;
@@ -912,17 +911,25 @@ do_owner (SeahorseWidget *swidget)
        uids = seahorse_pgp_key_get_uids (pkey);
        show_gtkbuilder_widget (swidget, "uids-area", uids != NULL);
        if (uids != NULL) {
+        g_autofree gchar *email_escaped = NULL;
+        g_autofree gchar *email_label = NULL;
+        SeahorsePgpUid *uid;
+
                uid = SEAHORSE_PGP_UID (uids->data);
-    
+
                label = seahorse_pgp_uid_get_name (uid);
                widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "owner-name-label"));
                gtk_label_set_text (GTK_LABEL (widget), label); 
                widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
                gtk_window_set_title (GTK_WINDOW (widget), label);
 
-               label = seahorse_pgp_uid_get_email (uid);
-               widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "owner-email-label"));
-               gtk_label_set_text (GTK_LABEL (widget), label); 
+        label = seahorse_pgp_uid_get_email (uid);
+        if (label && *label) {
+            email_escaped = g_markup_escape_text (label, -1);
+            email_label = g_strdup_printf ("<a href=\"mailto:%s\";>%s</a>", label, email_escaped);
+            widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "owner-email-label"));
+            gtk_label_set_markup (GTK_LABEL (widget), email_label);
+        }
 
                label = seahorse_pgp_uid_get_comment (uid);
                widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "owner-comment-label"));
diff --git a/pgp/seahorse-pgp-private-key-properties.ui b/pgp/seahorse-pgp-private-key-properties.ui
index af4e53b0..a5a96adc 100644
--- a/pgp/seahorse-pgp-private-key-properties.ui
+++ b/pgp/seahorse-pgp-private-key-properties.ui
@@ -43,7 +43,6 @@
               <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="orientation">vertical</property>
-                <property name="border_width">12</property>
                 <property name="spacing">12</property>
                 <child>
                   <object class="GtkBox" id="revoked-area">
@@ -281,47 +280,38 @@
                             <property name="column_spacing">12</property>
                             <property name="row_spacing">6</property>
                             <child>
-                              <object class="GtkLabel" id="owner-name-label">
+                              <object class="GtkBox">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="xalign">0</property>
-                                <property name="selectable">True</property>
-                                <attributes>
-                                  <attribute name="scale" value="1.75"/>
-                                </attributes>
+                                <property name="orientation">vertical</property>
+                                <property name="spacing">3</property>
+                                <property name="margin-bottom">12</property>
+                                <child>
+                                  <object class="GtkLabel" id="owner-name-label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="selectable">True</property>
+                                    <attributes>
+                                      <attribute name="scale" value="1.75"/>
+                                    </attributes>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="owner-email-label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="xalign">0</property>
+                                    <property name="selectable">True</property>
+                                    <property name="use-markup">True</property>
+                                  </object>
+                                </child>
                               </object>
                               <packing>
-                                <property name="top_attach">1</property>
+                                <property name="top_attach">0</property>
                                 <property name="left_attach">0</property>
                                 <property name="width">2</property>
                               </packing>
                             </child>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="visible">True</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Email</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">2</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="owner-email-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="xalign">0</property>
-                                <property name="selectable">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">2</property>
-                                <property name="left_attach">1</property>
-                              </packing>
-                            </child>
                             <child>
                               <object class="GtkLabel">
                                 <property name="visible">True</property>
@@ -332,7 +322,7 @@
                                 </style>
                               </object>
                               <packing>
-                                <property name="top_attach">3</property>
+                                <property name="top_attach">1</property>
                                 <property name="left_attach">0</property>
                               </packing>
                             </child>
@@ -344,7 +334,7 @@
                                 <property name="selectable">True</property>
                               </object>
                               <packing>
-                                <property name="top_attach">3</property>
+                                <property name="top_attach">1</property>
                                 <property name="left_attach">1</property>
                               </packing>
                             </child>
@@ -359,7 +349,7 @@
                                 </style>
                               </object>
                               <packing>
-                                <property name="top_attach">4</property>
+                                <property name="top_attach">2</property>
                                 <property name="left_attach">0</property>
                               </packing>
                             </child>
@@ -370,7 +360,7 @@
                                 <property name="label" translatable="yes">Private PGP Key</property>
                               </object>
                               <packing>
-                                <property name="top_attach">4</property>
+                                <property name="top_attach">2</property>
                                 <property name="left_attach">1</property>
                               </packing>
                             </child>
@@ -385,7 +375,7 @@
                                 </style>
                               </object>
                               <packing>
-                                <property name="top_attach">5</property>
+                                <property name="top_attach">3</property>
                                 <property name="left_attach">0</property>
                               </packing>
                             </child>
@@ -397,7 +387,7 @@
                                 <property name="selectable">True</property>
                               </object>
                               <packing>
-                                <property name="top_attach">5</property>
+                                <property name="top_attach">3</property>
                                 <property name="left_attach">1</property>
                               </packing>
                             </child>
diff --git a/pgp/seahorse-pgp-public-key-properties.ui b/pgp/seahorse-pgp-public-key-properties.ui
index 99128e75..eec3e3eb 100644
--- a/pgp/seahorse-pgp-public-key-properties.ui
+++ b/pgp/seahorse-pgp-public-key-properties.ui
@@ -44,7 +44,6 @@
                 <property name="visible">True</property>
                 <property name="orientation">vertical</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">12</property>
                 <property name="spacing">12</property>
                 <child>
                   <object class="GtkBox" id="revoked-area">
@@ -136,7 +135,8 @@
                   <object class="GtkBox">
                     <property name="visible">True</property>
                     <property name="orientation">horizontal</property>
-                    <property name="spacing">6</property>
+                    <property name="spacing">12</property>
+                    <property name="margin">18</property>
                     <child>
                       <object class="GtkBox">
                         <property name="visible">True</property>
@@ -215,18 +215,34 @@
                           <object class="GtkGrid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="border_width">3</property>
+                            <property name="margin">3</property>
                             <property name="column_spacing">12</property>
                             <property name="row_spacing">6</property>
                             <child>
-                              <object class="GtkLabel" id="owner-name-label">
+                              <object class="GtkBox">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="xalign">0</property>
-                                <property name="selectable">True</property>
-                                <attributes>
-                                  <attribute name="scale" value="1.75"/>
-                                </attributes>
+                                <property name="orientation">vertical</property>
+                                <property name="spacing">3</property>
+                                <property name="margin-bottom">12</property>
+                                <child>
+                                  <object class="GtkLabel" id="owner-name-label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="halign">start</property>
+                                    <property name="selectable">True</property>
+                                    <attributes>
+                                      <attribute name="scale" value="1.75"/>
+                                    </attributes>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel" id="owner-email-label">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="halign">start</property>
+                                    <property name="selectable">True</property>
+                                  </object>
+                                </child>
                               </object>
                               <packing>
                                 <property name="top_attach">0</property>
@@ -239,7 +255,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Email</property>
+                                <property name="label" translatable="yes">Comment</property>
                                 <style>
                                   <class name="dim-label"/>
                                 </style>
@@ -250,7 +266,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="owner-email-label">
+                              <object class="GtkLabel" id="owner-comment-label">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="xalign">0</property>
@@ -266,7 +282,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Comment:</property>
+                                <property name="label" translatable="yes">Type</property>
                                 <style>
                                   <class name="dim-label"/>
                                 </style>
@@ -276,33 +292,6 @@
                                 <property name="left_attach">0</property>
                               </packing>
                             </child>
-                            <child>
-                              <object class="GtkLabel" id="owner-comment-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="xalign">0</property>
-                                <property name="selectable">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">2</property>
-                                <property name="left_attach">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="label" translatable="yes">Type:</property>
-                                <style>
-                                  <class name="dim-label"/>
-                                </style>
-                              </object>
-                              <packing>
-                                <property name="top_attach">3</property>
-                                <property name="left_attach">0</property>
-                              </packing>
-                            </child>
                             <child>
                               <object class="GtkLabel">
                                 <property name="visible">True</property>
@@ -311,7 +300,7 @@
                                 <property name="label" translatable="yes">Public PGP Key</property>
                               </object>
                               <packing>
-                                <property name="top_attach">3</property>
+                                <property name="top_attach">2</property>
                                 <property name="left_attach">1</property>
                               </packing>
                             </child>
@@ -321,13 +310,13 @@
                                 <property name="can_focus">False</property>
                                 <property name="xalign">1</property>
                                 <property name="yalign">0</property>
-                                <property name="label" translatable="yes">Key ID:</property>
+                                <property name="label" translatable="yes">Key ID</property>
                                 <style>
                                   <class name="dim-label"/>
                                 </style>
                               </object>
                               <packing>
-                                <property name="top_attach">4</property>
+                                <property name="top_attach">3</property>
                                 <property name="left_attach">0</property>
                               </packing>
                             </child>
@@ -339,7 +328,7 @@
                                 <property name="selectable">True</property>
                               </object>
                               <packing>
-                                <property name="top_attach">4</property>
+                                <property name="top_attach">3</property>
                                 <property name="left_attach">1</property>
                               </packing>
                             </child>


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