[git] GPA - branch, master, updated. gpa-0.9.9-8-g059956d

by Werner Koch cvs at cvs.gnupg.org
Sat Nov 5 21:39:55 CET 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Assistant".

The branch, master has been updated
       via  059956d3efce81a3bb22967335dadc72c027d883 (commit)
      from  d8fd5f4a75668ce25d42af87959cee4b70d80603 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 059956d3efce81a3bb22967335dadc72c027d883
Author: Werner Koch <wk at gnupg.org>
Date:   Sat Nov 5 21:28:59 2016 +0100

    Add new tab to the key details with TOFU information.
    
    * src/gpa-tofu-list.c: New.
    * src/gpa-tofu-list.h: New.
    * src/Makefile.am (gpa_SOURCES): Add new files.
    * src/gpa.h (ENABLE_TOFU_INFO): Define depending on GPGME version.
    * src/keymanager.c (key_manager_selection_changed): List with tofu
    info.
    * src/convert.c (gpa_expiry_date_string): Factor code out to ...
    (gpa_date_string): new.
    * src/gpa-key-details.c: Include gpa-tofu-list.h.
    (struct _GpaKeyDetails): Add fields tofu_list and tofu_page.
    (gpa_key_details_finalize): Release tofu objects.
    (build_tofu_page): New.
    (ui_mode_changed): Call that.
    (gpa_key_details_update): Add TOFU notebook page.
    
    * src/gpa-key-details.c (details_page_fill_key): Move KeyID after the
    fingerprint.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/Makefile.am b/src/Makefile.am
index 6a2ab71..67c8190 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -119,6 +119,7 @@ gpa_SOURCES = \
               selectkeydlg.c selectkeydlg.h \
 	      keymanager.c keymanager.h \
 	      gpa-key-details.c gpa-key-details.h \
+	      gpa-tofu-list.c glag-tofu-list.h \
 	      ownertrustdlg.c ownertrustdlg.h \
 	      keysigndlg.c keysigndlg.h \
 	      keygendlg.c keygendlg.h \
diff --git a/src/convert.c b/src/convert.c
index 9a37ffa..280c5b8 100644
--- a/src/convert.c
+++ b/src/convert.c
@@ -72,32 +72,45 @@ gpa_time_unit_from_string (const char *string)
 
 
 char *
-gpa_expiry_date_string (unsigned long expiry_time)
+gpa_date_string (unsigned long t)
 {
   gchar *result;
-  GDate expiry_date;
+  GDate date;
 
-  if (sizeof (time_t) <= 4 && expiry_time == (time_t)2145914603)
+  if (sizeof (time_t) <= 4 && t == (time_t)2145914603)
     {
       /* 2145914603 (2037-12-31 23:23:23) is used by GPGME to indicate
          a time we can't represent. */
       result = g_strdup (">= 2038");
     }
-  else if ( expiry_time > 0 )
+  else if ( t > 0 )
     {
-      g_date_set_time_t (&expiry_date, (time_t) expiry_time);
+      g_date_set_time_t (&date, (time_t)t );
       result = g_strdup_printf ("%04d-%02d-%02d",
-                                g_date_get_year (&expiry_date),
-                                g_date_get_month (&expiry_date),
-                                g_date_get_day (&expiry_date));
+                                g_date_get_year (&date),
+                                g_date_get_month (&date),
+                                g_date_get_day (&date));
     }
   else
-    result = g_strdup (_("never expires"));
+    result = g_strdup ("");
   return result;
 }
 
 
 char *
+gpa_expiry_date_string (unsigned long expiry_time)
+{
+  char *p = gpa_date_string (expiry_time);
+  if (!*p)
+    {
+      g_free (p);
+      p = g_strdup (_("never expires"));
+    }
+  return p;
+}
+
+
+char *
 gpa_creation_date_string (unsigned long creation_time)
 {
   gchar *result;
diff --git a/src/convert.h b/src/convert.h
index da304e0..6373417 100644
--- a/src/convert.h
+++ b/src/convert.h
@@ -14,7 +14,7 @@
  * License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.  
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef CONVERT_H
@@ -22,6 +22,7 @@
 
 const char *gpa_unit_expiry_time_string (int idx);
 char gpa_time_unit_from_string (const char *string);
+char *gpa_date_string (unsigned long t);
 char *gpa_expiry_date_string (unsigned long expiry_time);
 char *gpa_creation_date_string (unsigned long creation_time);
 const char *gpa_sex_char_to_string (char sex);
diff --git a/src/gpa-key-details.c b/src/gpa-key-details.c
index abb3b1a..d48e2b0 100644
--- a/src/gpa-key-details.c
+++ b/src/gpa-key-details.c
@@ -37,6 +37,7 @@
 #include "siglist.h"
 #include "certchain.h"
 #include "gpasubkeylist.h"
+#include "gpa-tofu-list.h"
 #include "gpa-key-details.h"
 #include "gtktools.h"
 
@@ -73,10 +74,14 @@ struct _GpaKeyDetails
   GtkWidget *signatures_uids;
   GtkWidget *certchain_list;
 
-  /* The widgets in the subkeys list.  */
+  /* The widgets in the subkeys page.  */
   GtkWidget *subkeys_page;
   GtkWidget *subkeys_list;
 
+  /* The widgets in the TOFU page.  */
+  GtkWidget *tofu_page;
+  GtkWidget *tofu_list;
+
   /* The key currently shown or NULL.  */
   gpgme_key_t current_key;
 
@@ -159,13 +164,13 @@ details_page_fill_key (GpaKeyDetails *kdt, gpgme_key_t key)
   gtk_label_set_text (GTK_LABEL (kdt->detail_name), text);
   g_free (text);
 
-  text = (gchar*) gpa_gpgme_key_get_short_keyid (key);
-  gtk_label_set_text (GTK_LABEL (kdt->detail_key_id), text);
-
   text = gpa_gpgme_key_format_fingerprint (key->subkeys->fpr);
   gtk_label_set_text (GTK_LABEL (kdt->detail_fingerprint), text);
   g_free (text);
 
+  text = (gchar*) gpa_gpgme_key_get_short_keyid (key);
+  gtk_label_set_text (GTK_LABEL (kdt->detail_key_id), text);
+
   text = gpa_expiry_date_string (key->subkeys->expires);
   gtk_label_set_text (GTK_LABEL (kdt->detail_expiry), text);
   g_free (text);
@@ -305,10 +310,10 @@ construct_details_page (GpaKeyDetails *kdt)
     (table, table_row++, "", TRUE);
   kdt->detail_name = add_details_row
     (table, table_row++, _("User name:"), TRUE);
-  kdt->detail_key_id = add_details_row
-    (table, table_row++, _("Key ID:"), TRUE);
   kdt->detail_fingerprint = add_details_row
     (table, table_row++, _("Fingerprint:"), TRUE);
+  kdt->detail_key_id = add_details_row
+    (table, table_row++, _("Key ID:"), TRUE);
   kdt->detail_expiry = add_details_row
     (table, table_row++, _("Expires at:"), FALSE);
   kdt->detail_owner_trust = add_details_row
@@ -496,6 +501,57 @@ build_subkeys_page (GpaKeyDetails *kdt, gpgme_key_t key)
 }
 
 
+/* Create and append new page with TOFU info for KEY.  If KEY is NULL
+   remove an existing TOFU page. */
+static void
+build_tofu_page (GpaKeyDetails *kdt, gpgme_key_t key)
+{
+#ifdef ENABLE_TOFU_INFO
+  GtkWidget *vbox;
+  GtkWidget *scrolled;
+  GtkWidget *tofulist;
+  int pnum;
+
+  /* First remove an existing page.  */
+  if (kdt->tofu_page)
+    {
+      pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->tofu_page);
+      if (pnum >= 0)
+        gtk_notebook_remove_page (GTK_NOTEBOOK (kdt), pnum);
+      kdt->tofu_page = NULL;
+      if (kdt->tofu_list)
+        {
+          g_object_unref (kdt->tofu_list);
+          kdt->tofu_list = NULL;
+        }
+    }
+  if (!key)
+    return;
+
+  /* Create a new page.  */
+  vbox = gtk_vbox_new (FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+  scrolled = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
+                                       GTK_SHADOW_IN);
+  gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0);
+  tofulist = gpa_tofu_list_new ();
+  gtk_container_add (GTK_CONTAINER (scrolled), tofulist);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
+  kdt->tofu_list = tofulist;
+  g_object_ref (kdt->tofu_list);
+  kdt->tofu_page = vbox;
+  gtk_notebook_append_page (GTK_NOTEBOOK (kdt), kdt->tofu_page,
+                            gtk_label_new (_("Tofu")));
+
+  /* Fill this page.  */
+  gpa_tofu_list_set_key (kdt->tofu_list, key);
+#endif /*ENABLE_TOFU_INFO*/
+}
+
+
 /* Signal handler for the "changed_ui_mode" signal.  */
 static void
 ui_mode_changed (GpaOptions *options, gpointer param)
@@ -512,6 +568,7 @@ ui_mode_changed (GpaOptions *options, gpointer param)
       build_signatures_page (kdt, kdt->current_key);
       build_subkeys_page (kdt, kdt->current_key);
     }
+  build_tofu_page (kdt, kdt->current_key);
   gtk_notebook_set_show_tabs
     (GTK_NOTEBOOK (kdt), gtk_notebook_get_n_pages (GTK_NOTEBOOK (kdt)) > 1);
   gtk_widget_show_all (GTK_WIDGET (kdt));
@@ -583,6 +640,11 @@ gpa_key_details_finalize (GObject *object)
       g_object_unref (kdt->subkeys_list);
       kdt->subkeys_list = NULL;
     }
+  if (kdt->tofu_list)
+    {
+      g_object_unref (kdt->tofu_list);
+      kdt->tofu_list = NULL;
+    }
 
   parent_class->finalize (object);
 }
@@ -651,6 +713,10 @@ gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount)
         pnum = 1;
       else if (widget == kdt->subkeys_page)
         pnum = 2;
+#ifdef ENABLE_TOFU_INFO
+      else if (widget == kdt->tofu_page)
+        pnum = 3;
+#endif /*ENABLE_TOFU_INFO*/
       else
         pnum = 0;
     }
@@ -686,8 +752,9 @@ gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount)
     {
       details_page_fill_num_keys (kdt, keycount);
       build_signatures_page (kdt, NULL);
-      build_subkeys_page (kdt, NULL);
     }
+  build_tofu_page (kdt, key);
+
   gtk_notebook_set_show_tabs
     (GTK_NOTEBOOK (kdt), gtk_notebook_get_n_pages (GTK_NOTEBOOK (kdt)) > 1);
 
@@ -698,6 +765,10 @@ gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount)
     pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->signatures_page);
   else if (pnum == 2 && kdt->subkeys_page)
     pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->subkeys_page);
+#ifdef ENABLE_TOFU_INFO
+  else if (pnum == 3 && kdt->tofu_page)
+    pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->tofu_page);
+#endif /*ENABLE_TOFU_INFO*/
   else
     pnum = 0;
   gtk_notebook_set_current_page (GTK_NOTEBOOK (kdt), pnum);
diff --git a/src/gpa-tofu-list.c b/src/gpa-tofu-list.c
new file mode 100644
index 0000000..0ac153d
--- /dev/null
+++ b/src/gpa-tofu-list.c
@@ -0,0 +1,266 @@
+/* gpa-tofu-list.c - A list to show TOFU information.
+ * Copyright (C) 2016 g10 Code GmbH
+ *
+ * This file is part of GPA
+ *
+ * GPA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GPA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "gpa.h"
+#include "convert.h"
+#include "gtktools.h"
+#include "keytable.h"
+#include "gpa-tofu-list.h"
+
+#ifdef ENABLE_TOFU_INFO
+
+static gboolean tofu_list_query_tooltip_cb (GtkWidget *wdiget, int x, int y,
+                                            gboolean keyboard_mode,
+                                            GtkTooltip *tooltip,
+                                            gpointer user_data);
+
+
+
+typedef enum
+{
+  TOFU_ADDRESS,
+  TOFU_VALIDITY,
+  TOFU_POLICY,
+  TOFU_COUNT,
+  TOFU_FIRSTSIGN,
+  TOFU_LASTSIGN,
+  TOFU_FIRSTENCR,
+  TOFU_LASTENCR,
+  TOFU_N_COLUMNS
+} SubkeyListColumn;
+
+
+/* Create a new subkey list.  */
+GtkWidget *
+gpa_tofu_list_new (void)
+{
+  GtkListStore *store;
+  GtkWidget *list;
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *renderer;
+
+  /* Init the model */
+  store = gtk_list_store_new (TOFU_N_COLUMNS,
+			      G_TYPE_STRING,  /* address */
+			      G_TYPE_STRING,  /* validity */
+			      G_TYPE_STRING,  /* policy */
+			      G_TYPE_STRING,  /* count */
+			      G_TYPE_STRING,  /* firstsign */
+			      G_TYPE_STRING,  /* lastsign */
+			      G_TYPE_STRING,  /* firstencr */
+			      G_TYPE_STRING   /* lastencr */
+                              );
+
+  /* The view */
+  list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+  gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list), TRUE);
+
+  /* Add the columns */
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_ADDRESS,
+						     NULL);
+  gpa_set_column_title (column, _("Address"),
+                        _("The mail address."));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_VALIDITY,
+						     NULL);
+  gpa_set_column_title (column, _("Validity"),
+                        _("The TOFU validity of the mail address:\n"
+                          " Minimal = Only little history available\n"));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_POLICY,
+						     NULL);
+  gpa_set_column_title (column, _("Policy"),
+                        _("The TOFU policy set for this mail address."));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_COUNT,
+						     NULL);
+  gpa_set_column_title (column, _("Count"),
+                        _("The number of signatures seen for this address\n"
+                          "and the number of encryption done to this address.")
+                        );
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_FIRSTSIGN,
+						     NULL);
+  gpa_set_column_title (column, _("First Sig"),
+                        _("The date the first signature was verified."));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_LASTSIGN,
+						     NULL);
+  gpa_set_column_title (column, _("Last Sig"),
+                        _("The most recent date a signature was verified."));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_FIRSTENCR,
+						     NULL);
+  gpa_set_column_title (column, _("First Enc"),
+                        _("The date the first encrypted mail was sent."));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes (NULL, renderer,
+						     "text", TOFU_LASTENCR,
+						     NULL);
+  gpa_set_column_title (column, _("Last Enc"),
+                        _("The most recent date an encrypted mail was sent."));
+  gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+
+  g_object_set (list, "has-tooltip", TRUE, NULL);
+  g_signal_connect (list, "query-tooltip",
+                    G_CALLBACK (tofu_list_query_tooltip_cb), list);
+
+  return list;
+}
+
+
+static const gchar *
+tofu_validity_str (gpgme_tofu_info_t tofu)
+{
+  switch (tofu->validity)
+    {
+    case 0: return _("Conflict");
+    case 1: return _("Unknown");
+    case 2: return _("Minimal");
+    case 3: return _("Basic");
+    case 4: return _("Full");
+    default: return "?";
+    }
+}
+
+
+static const gchar *
+tofu_policy_str (gpgme_tofu_info_t tofu)
+{
+  switch (tofu->policy)
+    {
+    case GPGME_TOFU_POLICY_NONE:    return _("None");
+    case GPGME_TOFU_POLICY_AUTO:    return _("Auto");
+    case GPGME_TOFU_POLICY_GOOD:    return _("Good");
+    case GPGME_TOFU_POLICY_UNKNOWN: return _("Unknown");
+    case GPGME_TOFU_POLICY_BAD:     return _("Bad");
+    case GPGME_TOFU_POLICY_ASK:     return _("Ask");
+    }
+  return "?";
+}
+
+
+/* Set the key whose subkeys should be displayed. */
+void
+gpa_tofu_list_set_key (GtkWidget *list, gpgme_key_t key)
+{
+  GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model
+                                        (GTK_TREE_VIEW (list)));
+  GtkTreeIter iter;
+  gpgme_user_id_t uid;
+  gpgme_tofu_info_t tofu;
+  char *countstr, *firstsign, *lastsign, *firstencr, *lastencr;
+
+  /* Empty the list */
+  gtk_list_store_clear (store);
+
+  if (!key || !key->uids)
+    return;
+
+  for (uid = key->uids; uid; uid = uid->next)
+    {
+      if (!uid->address || !uid->tofu)
+        continue;  /* No address or tofu info.  */
+      tofu = uid->tofu;
+
+      /* Note that we do not need to filter ADDRESS like we do with
+       * user ids because GPGME checked that it is a valid mail
+       * address.  */
+      countstr = g_strdup_printf ("%hu/%hu", tofu->signcount, tofu->encrcount);
+      firstsign = gpa_date_string (tofu->signfirst);
+      lastsign  = gpa_date_string (tofu->signlast);
+      firstencr = gpa_date_string (tofu->encrfirst);
+      lastencr  = gpa_date_string (tofu->encrlast);
+
+      gtk_list_store_append (store, &iter);
+      gtk_list_store_set
+        (store, &iter,
+         TOFU_ADDRESS,  uid->address,
+         TOFU_VALIDITY, tofu_validity_str (tofu),
+         TOFU_POLICY,   tofu_policy_str (tofu),
+         TOFU_COUNT,    countstr,
+         TOFU_FIRSTSIGN,firstsign,
+         TOFU_LASTSIGN, lastsign,
+         TOFU_FIRSTENCR,firstencr,
+         TOFU_LASTENCR, lastencr,
+         -1);
+
+      g_free (countstr);
+      g_free (firstsign);
+      g_free (lastsign);
+      g_free (firstencr);
+      g_free (lastencr);
+    }
+
+}
+
+
+/* Tooltip display callback.  */
+static gboolean
+tofu_list_query_tooltip_cb (GtkWidget *widget, int x, int y,
+                            gboolean keyboard_tip,
+                            GtkTooltip *tooltip, gpointer user_data)
+{
+  GtkTreeView *tv = GTK_TREE_VIEW (widget);
+  GtkTreeViewColumn *column;
+  char *text;
+
+  (void)user_data;
+
+  if (!gtk_tree_view_get_tooltip_context (tv, &x, &y, keyboard_tip,
+                                          NULL, NULL, NULL))
+    return FALSE; /* Not at a row - do not show a tooltip.  */
+  if (!gtk_tree_view_get_path_at_pos (tv, x, y, NULL, &column, NULL, NULL))
+    return FALSE;
+
+  widget = gtk_tree_view_column_get_widget (column);
+  text = widget? gtk_widget_get_tooltip_text (widget) : NULL;
+  if (!text)
+    return FALSE; /* No tooltip desired.  */
+
+  gtk_tooltip_set_text (tooltip, text);
+  g_free (text);
+
+  return TRUE; /* Show tooltip.  */
+}
+#endif /*ENABLE_TOFU_INFO*/
diff --git a/src/gpa-tofu-list.h b/src/gpa-tofu-list.h
new file mode 100644
index 0000000..f568eb7
--- /dev/null
+++ b/src/gpa-tofu-list.h
@@ -0,0 +1,31 @@
+/* gpa-tofu-list.h - A list to show TOFU information
+ * Copyright (C) 2016 g10 Code GmbH
+ *
+ * This file is part of GPA
+ *
+ * GPA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GPA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GPA_TOFU_LIST_H
+#define GPA_TOFU_LIST_H
+
+#include <gtk/gtk.h>
+
+/* Create a new TOFU list.  */
+GtkWidget * gpa_tofu_list_new (void);
+
+/* Set the key for which TOFU information shall be shown.  */
+void gpa_tofu_list_set_key (GtkWidget *list, gpgme_key_t key);
+
+#endif /* GPA_TOFU_LIST_H */
diff --git a/src/gpa.h b/src/gpa.h
index deebed1..57bddb8 100644
--- a/src/gpa.h
+++ b/src/gpa.h
@@ -46,6 +46,10 @@
 #include "options.h" /* ditto */
 
 
+#if GPGME_VERSION_NUMBER >= 0x010700
+# define ENABLE_TOFU_INFO 1
+#endif
+
 /* Global constants.  */
 #define GPA_MAX_UID_WIDTH 50  /* # of chars after wich a user id is
                                  truncated in dialog boxes.  */
diff --git a/src/gpafileencryptop.c b/src/gpafileencryptop.c
index 4e22446..a76c4e0 100644
--- a/src/gpafileencryptop.c
+++ b/src/gpafileencryptop.c
@@ -581,6 +581,7 @@ expired_key (gpgme_key_t key, GtkWidget *parent)
   gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
   gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox);
 
+  /* Fixme: We leak the date string.  */
   message = g_strdup_printf (_("The following key expired on %s:"),
                              gpa_expiry_date_string
                              (key->subkeys->expires));
diff --git a/src/keymanager.c b/src/keymanager.c
index 2cef4ab..d90fcc7 100644
--- a/src/keymanager.c
+++ b/src/keymanager.c
@@ -723,6 +723,9 @@ key_manager_selection_changed (GtkTreeSelection *treeselection,
          is okay. */
       gpgme_set_keylist_mode (self->ctx->ctx,
 			      (old_mode
+#ifdef GPGME_KEYLIST_MODE_WITH_TOFU
+                               | GPGME_KEYLIST_MODE_WITH_TOFU
+#endif
                                | GPGME_KEYLIST_MODE_SIGS
                                | GPGME_KEYLIST_MODE_VALIDATE));
       gpgme_set_protocol (self->ctx->ctx, key->protocol);

-----------------------------------------------------------------------

Summary of changes:
 src/Makefile.am                          |   1 +
 src/convert.c                            |  31 ++--
 src/convert.h                            |   3 +-
 src/gpa-key-details.c                    |  85 +++++++++-
 src/gpa-tofu-list.c                      | 266 +++++++++++++++++++++++++++++++
 src/{ownertrustdlg.h => gpa-tofu-list.h} |  23 +--
 src/gpa.h                                |   4 +
 src/gpafileencryptop.c                   |   1 +
 src/keymanager.c                         |   3 +
 9 files changed, 389 insertions(+), 28 deletions(-)
 create mode 100644 src/gpa-tofu-list.c
 copy src/{ownertrustdlg.h => gpa-tofu-list.h} (52%)


hooks/post-receive
-- 
The GNU Privacy Assistant
http://git.gnupg.org




More information about the Gnupg-commits mailing list