[Gpa-commits] r980 - in trunk: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 2 20:06:14 CEST 2009


Author: werner
Date: 2009-04-02 20:06:11 +0200 (Thu, 02 Apr 2009)
New Revision: 980

Added:
   trunk/src/certchain.c
   trunk/src/certchain.h
   trunk/src/format-dn.c
   trunk/src/format-dn.h
Modified:
   trunk/TODO
   trunk/src/ChangeLog
   trunk/src/Makefile.am
   trunk/src/gpa-key-details.c
   trunk/src/gpgmetools.c
   trunk/src/keylist.c
   trunk/src/options.c
   trunk/src/recipientdlg.c
   trunk/src/settingsdlg.c
Log:
Better X.509 support in the details view.


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/TODO	2009-04-02 18:06:11 UTC (rev 980)
@@ -150,3 +150,8 @@
    grow in case there's unused space to the right of the expander widget.
 * Building
 ** po/remove-potcdate.sed is deleted during make distcheck, thus make distcheck fails.
+
+* Bugs
+** Error messages while switching simplified mode.
+  This happens with the gpa-details-view and might be related to
+  siglist.c

Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/ChangeLog	2009-04-02 18:06:11 UTC (rev 980)
@@ -1,3 +1,28 @@
+2009-04-02  Werner Koch  <wk at g10code.com>
+
+	* keylist.c (gpa_keylist_next): Format user name the X.509 way.
+
+	* gpa-key-details.c (construct_subkeys_page)
+	(subkeys_page_fill_key, remove_subkeys_page, subkeys_page_empty):
+	Merge and rename to build_subkeys_page.
+	(ui_mode_changed): Adjust.
+	(construct_signatures_page, signatures_page_fill_key)
+	(signatures_page_empty): Merge and rename to
+	build_signatures_page.  Support X.509.
+	(gpa_key_details_update): Create the signature pages only in
+	advanced mode.
+	(struct _GpaKeyDetails): Remove field signatures_count.  Add field
+	signatures_page.
+	(signatures_uid_changed): Check that there is a signatures page.
+	(construct_main_widget): Remove signature and subkey creation.
+	(gpa_key_details_find): Support X.509.
+	* certchain.c, certchain.h: New.
+	* format-dn.c, format-dn.h: New.
+
+	* options.c (gpa_options_set_simplified_ui): Send signal only for
+	a real change.
+	(gpa_options_set_show_advanced_options): Ditto.
+
 2009-03-30  Moritz  <moritz at gnu.org>
 
 	* gpa-key-details.c (signatures_page_fill_key): Call

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/Makefile.am	2009-04-02 18:06:11 UTC (rev 980)
@@ -91,6 +91,7 @@
 	      keylist.c keylist.h \
 	      siglist.c siglist.h \
 	      gpasubkeylist.c gpasubkeylist.h \
+              certchain.c certchain.h \
 	      gpl-text.c gpl-text.h \
 	      keyserver.c keyserver.h \
 	      hidewnd.c hidewnd.h \
@@ -143,6 +144,7 @@
 	      gpa-marshal.c gpa-marshal.h \
 	      strlist.h strlist.c \
 	      gpg-stuff.h gpg-stuff.c \
+              format-dn.c format-dn.h \
 	      convert.c convert.h \
               membuf.c membuf.h \
 	      utils.c $(gpa_w32_sources) $(gpa_cardman_sources)

Added: trunk/src/certchain.c
===================================================================
--- trunk/src/certchain.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/certchain.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -0,0 +1,178 @@
+/* certchain.c  - Functions to show a certification chain.
+ * Copyright (C) 2009 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/>.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+#include <gtk/gtk.h>
+
+#include "gpa.h"
+#include "gtktools.h"
+#include "format-dn.h"
+#include "certchain.h"
+
+enum
+  {
+    CERTCHAIN_COLUMN_KEYID,
+    CERTCHAIN_COLUMN_SERIALNO,
+    CERTCHAIN_COLUMN_ISSUER,
+    CERTCHAIN_N_COLUMNS
+  };
+
+
+static void
+certchain_construct (GtkTreeView *tview)
+{
+  GtkTreeViewColumn *column;
+  GtkCellRenderer *renderer;
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes 
+    (NULL, renderer, "text", CERTCHAIN_COLUMN_KEYID, NULL);
+  /* FIXME  Use a function to get the title and tooltip.  */
+  gpa_set_column_title 
+    (column, _("Key ID"),
+     _("The key ID is a short number to identify a certificate."));
+  gtk_tree_view_append_column (tview, column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes
+    (_("Serialno."), renderer, "text", CERTCHAIN_COLUMN_SERIALNO, NULL);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (tview), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes
+    (_("Issuer"), renderer, "text", CERTCHAIN_COLUMN_ISSUER, NULL);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (tview), column);
+
+}
+
+
+static void
+append_row (GtkListStore *store, GtkTreeIter *iter,
+            gpgme_key_t key, const char *errormsg)
+{
+  char *serialno;
+  char *issuer;
+
+  gtk_list_store_append (store, iter);
+  if (errormsg || !key)
+    {
+      gtk_list_store_set (store, iter, CERTCHAIN_COLUMN_ISSUER, errormsg, -1);
+      return;
+    }
+
+  if (key->issuer_serial && strlen (key->issuer_serial) <= 8)
+    {
+      unsigned long value = g_ascii_strtoull (key->issuer_serial, NULL, 16);
+      serialno = g_strdup_printf ("%lu", value);
+    }
+  else if (key->issuer_serial)
+    serialno = g_strdup_printf ("0x%s", key->issuer_serial);
+  else
+    serialno = NULL;
+
+  issuer = gpa_format_dn (key->issuer_name); 
+
+  gtk_list_store_set 
+    (store, iter,
+     CERTCHAIN_COLUMN_KEYID, gpa_gpgme_key_get_short_keyid (key),
+     CERTCHAIN_COLUMN_SERIALNO, serialno,
+     CERTCHAIN_COLUMN_ISSUER, issuer,
+     -1);
+  g_free (issuer);
+  g_free (serialno);
+}
+
+
+static void
+certchain_update (GtkWidget *tview, gpgme_key_t key)
+{
+  gpgme_error_t err;
+  gpgme_ctx_t listctx;
+  GtkListStore *store;
+  GtkTreeIter iter;
+  int maxdepth = 20;
+
+  err = gpgme_new (&listctx);
+  if (err)
+    gpa_gpgme_error (err);
+  gpgme_set_protocol (listctx, key->protocol);
+
+  store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (tview)));
+  gtk_list_store_clear (store);
+  
+  append_row (store, &iter, key, NULL);
+
+  gpgme_key_ref (key);
+  while (key && key->chain_id
+         && key->subkeys && strcmp (key->chain_id, key->subkeys->fpr))
+    {
+      if (!--maxdepth)
+        {
+          append_row (store, &iter, NULL, _("[chain too long]"));
+          break;
+        }
+      err = gpgme_op_keylist_start (listctx, key->chain_id, 0);
+      gpgme_key_unref (key);
+      key = NULL;
+      if (!err)
+	err = gpgme_op_keylist_next (listctx, &key);
+      gpgme_op_keylist_end (listctx);
+      if (err)
+        append_row (store, &iter, NULL, _("[issuer not found]"));
+      else
+        append_row (store, &iter, key, NULL);
+    }
+  gpgme_key_unref (key);
+  gpgme_release (listctx);
+}
+
+
+/* Create the widget to show a certificate chain.  */
+GtkWidget *
+gpa_certchain_new (void)
+{
+  GtkListStore *store;
+  GtkWidget *tview;
+  
+  store = gtk_list_store_new (CERTCHAIN_N_COLUMNS,
+                              G_TYPE_STRING,
+                              G_TYPE_STRING,
+			      G_TYPE_STRING);
+  tview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+  certchain_construct (GTK_TREE_VIEW (tview));
+
+  return tview;
+}
+
+
+/* Update the certificate chain list.  */
+void
+gpa_certchain_update (GtkWidget *list, gpgme_key_t key)
+{
+  GtkListStore *store;
+
+  store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list)));
+  if (key && key->protocol == GPGME_PROTOCOL_CMS)
+    certchain_update (list, key);
+  else
+    gtk_list_store_clear (store);
+}

Added: trunk/src/certchain.h
===================================================================
--- trunk/src/certchain.h	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/certchain.h	2009-04-02 18:06:11 UTC (rev 980)
@@ -0,0 +1,28 @@
+/* certchain.h  - Definitions of functions to show a certification chain.
+ * Copyright (C) 2009 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 CERTCHAIN_H
+#define CERTCHAIN_H
+
+GtkWidget *gpa_certchain_new (void);
+void gpa_certchain_update (GtkWidget *list, gpgme_key_t key);
+
+
+
+#endif /*CERTCHAIN_H*/

Added: trunk/src/format-dn.c
===================================================================
--- trunk/src/format-dn.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/format-dn.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -0,0 +1,399 @@
+/* format-dn.c  - Functions to format an ASN.1 Distinuguished Name.
+ * Copyright (C) 2001, 2004, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2009 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/>.
+ */
+
+/* 
+   This code is based on code taken from GnuPG (sm/certdump.c).  It
+   has been converted to use only Glib stuff.
+ */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "gpa.h"
+#include "format-dn.h"
+
+
+struct dn_array_s 
+{
+  char *key;
+  char *value;
+  int   multivalued;
+  int   done;
+};
+
+
+/* Remove trailing white spaces from STRING.  */
+static void
+trim_trailing_spaces (char *string)
+{
+  char *p, *mark;
+  
+  for (mark=NULL, p=string; *p; p++)
+    {
+      if (g_ascii_isspace (*p))
+        {
+          if (!mark)
+            mark = p;
+	}
+      else
+        mark = NULL;
+    }
+  if (mark)
+    *mark = '\0' ;
+}
+
+
+
+/* Helper for the rfc2253 string parser.  */
+static const char *
+parse_dn_part (struct dn_array_s *array, const char *string)
+{
+  static struct {
+    const char *label;
+    const char *oid;
+  } label_map[] = 
+    {
+      /* Note: Take care we expect the LABEL not more than 9 bytes
+         longer than the OID.  */
+      {"EMail",        "1.2.840.113549.1.9.1" },
+      {"T",            "2.5.4.12" },
+      {"GN",           "2.5.4.42" },
+      {"SN",           "2.5.4.4" },
+      {"NameDistinguisher", "0.2.262.1.10.7.20"}, 
+      {"ADDR",         "2.5.4.16" },
+      {"BC",           "2.5.4.15" },
+      {"D",            "2.5.4.13" },
+      {"PostalCode",   "2.5.4.17" },
+      {"Pseudo",       "2.5.4.65" },
+      {"SerialNumber", "2.5.4.5" },
+      {NULL, NULL}
+    };
+  const char *s, *s1;
+  size_t n;
+  char *p;
+  int i;
+
+  /* Parse attributeType */
+  for (s = string+1; *s && *s != '='; s++)
+    ;
+  if (!*s)
+    return NULL; /* error */
+  n = s - string;
+  if (!n)
+    return NULL; /* empty key */
+
+  /* We need to allocate a few bytes more due to the possible mapping
+     from the shorter OID to the longer label.  */
+  array->key = p = g_try_malloc (n+10);
+  if (!array->key)
+    return NULL;
+  memcpy (p, string, n); 
+  p[n] = 0;
+  trim_trailing_spaces (p);
+
+  if (g_ascii_isdigit (*p))
+    {
+      for (i=0; label_map[i].label; i++ )
+        if ( !strcmp (p, label_map[i].oid) )
+          {
+            strcpy (p, label_map[i].label);
+            break;
+          }
+    }
+  string = s + 1;
+
+  if (*string == '#')
+    { 
+      /* Hexstring. */
+      string++;
+      for (s=string; g_ascii_isxdigit (*s); s++)
+        s++;
+      n = s - string;
+      if (!n || (n & 1))
+        return NULL; /* Empty or odd number of digits.  */
+      n /= 2;
+      array->value = p = g_try_malloc (n+1);
+      if (!p)
+        return NULL;
+      for (s1=string; n; s1 += 2, n--, p++)
+        {
+          *(unsigned char *)p = xtoi_2 (s1);
+          if (!*p)
+            *p = 0x01; /* Better print a wrong value than truncating
+                          the string. */
+        }
+      *p = 0;
+   }
+  else
+    { 
+      /* Regular v3 quoted string.  */
+      for (n=0, s=string; *s; s++)
+        {
+          if (*s == '\\')
+            { 
+              /* Pair. */
+              s++;
+              if (*s == ',' || *s == '=' || *s == '+'
+                  || *s == '<' || *s == '>' || *s == '#' || *s == ';' 
+                  || *s == '\\' || *s == '\"' || *s == ' ')
+                n++;
+              else if (g_ascii_isxdigit (*s) && g_ascii_isxdigit(s[1]))
+                {
+                  s++;
+                  n++;
+                }
+              else
+                return NULL; /* Invalid escape sequence.  */
+            }
+          else if (*s == '\"')
+            return NULL; /* Invalid encoding.  */
+          else if (*s == ',' || *s == '=' || *s == '+'
+                   || *s == '<' || *s == '>' || *s == ';' )
+            break; 
+          else
+            n++;
+        }
+      
+      array->value = p = g_try_malloc (n+1);
+      if (!p)
+        return NULL;
+      for (s=string; n; s++, n--)
+        {
+          if (*s == '\\')
+            { 
+              s++;
+              if (g_ascii_isxdigit (*s))
+                {
+                  *(unsigned char *)p++ = xtoi_2 (s);
+                  s++;
+                }
+              else
+                *p++ = *s;
+            }
+          else
+            *p++ = *s;
+        }
+      *p = 0;
+    }
+  return s;
+}
+
+
+/* Parse a DN and return an array-ized one.  This is not a validating
+   parser and it does not support any old-stylish syntax; KSBA is
+   expected to return only rfc2253 compatible strings. */
+static struct dn_array_s *
+parse_dn (const char *string)
+{
+  struct dn_array_s *array;
+  size_t arrayidx, arraysize;
+  int i;
+
+  arraysize = 7; /* C,ST,L,O,OU,CN,email */
+  arrayidx = 0;
+  array = g_try_malloc ((arraysize+1) * sizeof *array);
+  if (!array)
+    return NULL;
+
+  while (*string)
+    {
+      while (*string == ' ')
+        string++;
+      if (!*string)
+        break; /* Ready.  */
+      if (arrayidx >= arraysize)
+        { 
+          struct dn_array_s *a2;
+
+          arraysize += 5;
+          a2 = g_try_realloc (array, (arraysize+1) * sizeof *array);
+          if (!a2)
+            goto failure;
+          array = a2;
+        }
+      array[arrayidx].key = NULL;
+      array[arrayidx].value = NULL;
+      string = parse_dn_part (array+arrayidx, string);
+      if (!string)
+        goto failure;
+      while (*string == ' ')
+        string++;
+      array[arrayidx].multivalued = (*string == '+');
+      array[arrayidx].done = 0;
+      arrayidx++;
+      if (*string && *string != ',' && *string != ';' && *string != '+')
+        goto failure; /* Invalid delimiter. */
+      if (*string)
+        string++;
+    }
+  array[arrayidx].key = NULL;
+  array[arrayidx].value = NULL;
+  return array;
+
+ failure:
+  for (i=0; i < arrayidx; i++)
+    {
+      g_free (array[i].key);
+      g_free (array[i].value);
+    }
+  g_free (array);
+  return NULL;
+}
+
+
+/* Append BUFFER to OUTOPUT while replacing all control characters and
+   the characters in DELIMITERS by standard C escape sequences.  */
+static void 
+append_sanitized (GString *output, const void *buffer, size_t length,
+                  const char *delimiters)
+{
+  const unsigned char *p = buffer;
+  size_t count = 0;
+  
+  for (; length; length--, p++, count++)
+    {
+      if (*p < 0x20 
+          || *p == 0x7f
+          || (delimiters 
+              && (strchr (delimiters, *p) || *p == '\\')))
+        {
+          g_string_append_c (output, '\\');
+          if (*p == '\n')
+            g_string_append_c (output, 'n');
+          else if (*p == '\r')
+            g_string_append_c (output, 'r');
+          else if (*p == '\f')
+            g_string_append_c (output, 'f');
+          else if (*p == '\v')
+            g_string_append_c (output, 'v');
+          else if (*p == '\b')
+            g_string_append_c (output, 'b');
+          else if (!*p)
+            g_string_append_c (output, '0');
+          else
+            g_string_append_printf (output, "x%02x", *p);
+	}
+      else
+        g_string_append_c (output, *p);
+    }
+}
+
+
+/* Print a DN part to STREAM or if STREAM is NULL to FP. */
+static void
+print_dn_part (GString *output, struct dn_array_s *dn, const char *key)
+{
+  struct dn_array_s *first_dn = dn;
+
+  for (; dn->key; dn++)
+    {
+      if (!dn->done && !strcmp (dn->key, key))
+        {
+          /* Forward to the last multi-valued RDN, so that we can
+             print them all in reverse in the correct order.  Note
+             that this overrides the the standard sequence but that
+             seems to a reasonable thing to do with multi-valued
+             RDNs. */
+          while (dn->multivalued && dn[1].key)
+            dn++;
+        next:
+          if (!dn->done && dn->value && *dn->value)
+            {
+              g_string_append_printf (output, "/%s=", dn->key);
+              append_sanitized (output, dn->value, strlen (dn->value), "/");
+            }
+          dn->done = 1;
+          if (dn > first_dn && dn[-1].multivalued)
+            {
+              dn--;
+              goto next;
+            }
+        }
+    }
+}
+
+
+/* Print all parts of a DN in a "standard" sequence.  We first print
+   all the known parts, followed by the uncommon ones.  */
+static void
+print_dn_parts (GString *output, struct dn_array_s *dn)
+{
+  const char *stdpart[] = {
+    "CN", "OU", "O", "STREET", "L", "ST", "C", "EMail", NULL 
+  };
+  int i;
+  
+  for (i=0; stdpart[i]; i++)
+    print_dn_part (output, dn, stdpart[i]);
+
+  /* Now print the rest without any specific ordering */
+  for (; dn->key; dn++)
+    print_dn_part (output, dn, dn->key);
+}
+
+
+/* Format an RFC2253 encoded DN or GeneralName.  Caller needs to
+   release the return ed string.  This function will never return
+   NULL.  */
+char *
+gpa_format_dn (const char *name) 
+{
+  char *retval = NULL;
+  
+  if (!name)
+    retval = g_strdup (_("[Error - No name]"));
+  else if (*name == '<')
+    {
+      const char *s = strchr (name+1, '>');
+      if (s)
+        retval = g_strndup (name+1, s - (name+1));
+    }
+  else if (*name == '(')
+    retval = g_strdup (_("[Error - Encoding not supported]"));
+  else if (g_ascii_isalnum (*name))
+    {
+      struct dn_array_s *dn;
+      int i;
+
+      dn = parse_dn (name);
+      if (dn)
+        {
+          GString *output = g_string_sized_new (strlen (name));
+          print_dn_parts (output, dn);          
+          retval = g_string_free (output, FALSE);
+          for (i=0; dn[i].key; i++)
+            {
+              g_free (dn[i].key);
+              g_free (dn[i].value);
+            }
+          g_free (dn);
+        }
+    }
+ 
+  if (!retval)
+    retval = g_strdup (_("[Error - Invalid encoding]"));
+
+  return retval;
+}
+
+
+

Added: trunk/src/format-dn.h
===================================================================
--- trunk/src/format-dn.h	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/format-dn.h	2009-04-02 18:06:11 UTC (rev 980)
@@ -0,0 +1,25 @@
+/* format-dn.h  -  Functions to format an ASN.1 Distinguished Name.
+ * Copyright (C) 2009 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 FORMAT_DN_H
+#define FORMAT_DN_H
+
+char *gpa_format_dn (const char *name);
+
+#endif /*FORMAT_DN_H*/

Modified: trunk/src/gpa-key-details.c
===================================================================
--- trunk/src/gpa-key-details.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/gpa-key-details.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -35,6 +35,7 @@
 #include "convert.h"
 #include "keytable.h"
 #include "siglist.h"
+#include "certchain.h"
 #include "gpasubkeylist.h"
 #include "gpa-key-details.h"
 
@@ -67,10 +68,10 @@
   GtkWidget *detail_creation;
 
   /* The widgets in the signatures page.  */
+  GtkWidget *signatures_page;
   GtkWidget *signatures_list;
   GtkWidget *signatures_uids;
-  gint signatures_count;
-  GtkWidget *signatures_hbox;
+  GtkWidget *certchain_list;
 
   /* The widgets in the subkeys list.  */
   GtkWidget *subkeys_page;
@@ -96,7 +97,6 @@
  *******************   Implementation   *********************
  ************************************************************/
 
-
 /* Callback for the "changed" signal to update the popdown menu on the
    signatures page of the notebook.  */
 static void
@@ -104,11 +104,14 @@
 {
   GpaKeyDetails *kdt = user_data;
 
-  /* Note that we need to subtract one, as the first entry (with index
-     0 means) "all user names".  */
-  gpa_siglist_set_signatures 
-    (kdt->signatures_list, kdt->current_key,
-     gtk_combo_box_get_active (GTK_COMBO_BOX (combo)) - 1);
+  if (kdt->signatures_list)
+    {
+      /* Note that we need to subtract one, as the first entry (with
+         index 0 means) "all user names".  */
+      gpa_siglist_set_signatures 
+        (kdt->signatures_list, kdt->current_key,
+         gtk_combo_box_get_active (GTK_COMBO_BOX (combo)) - 1);
+    }
 }
 
 
@@ -219,92 +222,6 @@
 
 
 
-/* Fill the signatures page with the signatures of the public key.  */
-static void
-signatures_page_fill_key (GpaKeyDetails *kdt, gpgme_key_t key)
-{
-  GtkComboBox *combo;
-  int i;
-
-  combo = GTK_COMBO_BOX (kdt->signatures_uids);
-  for (i = kdt->signatures_count - 1; i >= 0; i--)
-    gtk_combo_box_remove_text (combo, i);
-  kdt->signatures_count = 0;
-
-  /* Populate the popdown UID list if there is more than one UID.  */
-  if (key->uids && key->uids->next)
-    {
-      gpgme_user_id_t uid;
-
-      /* Make the combo widget's width shrink as much as
-	 possible. This (hopefully) fixes the previous behaviour
-	 correctly: displaying a key with slightly longer signed UIDs
-	 caused the top-level window to pseudo-randomly increase it's
-	 size (which couldn't even be undone by the user anymore).  */
-      gtk_widget_set_size_request (GTK_WIDGET (combo), 0, -1);
-
-      gtk_combo_box_append_text (combo, _("All signatures"));
-      gtk_combo_box_set_active (combo, 0);
-      for (i=1, uid = key->uids; uid; i++, uid = uid->next)
-	{
-	  gchar *uid_string = gpa_gpgme_key_get_userid (uid);
-	  gtk_combo_box_append_text (combo, uid_string);
-	  g_free (uid_string);
-	}
-      kdt->signatures_count = i;
-
-      gtk_widget_show (kdt->signatures_hbox);
-      gtk_widget_set_no_show_all (kdt->signatures_hbox, FALSE);
-      gtk_widget_set_sensitive (kdt->signatures_uids, TRUE);
-      /* Add the signatures.  */
-      gpa_siglist_set_signatures (kdt->signatures_list, key, -1);
-    }
-  else
-    {
-      /* If there is just one uid, display its signatures explicitly,
-         and do not show the list of uids.  */
-      gtk_widget_hide (kdt->signatures_hbox);
-      gtk_widget_set_no_show_all (kdt->signatures_hbox, TRUE);
-      gpa_siglist_set_signatures (kdt->signatures_list, key, 0);
-    }
-}
-
-
-/* Empty the list of signatures in the details notebook.  */
-static void
-signatures_page_empty (GpaKeyDetails *kdt)
-{
-  GtkComboBox *combo;
-  gint i;
-
-  gpa_siglist_set_signatures (kdt->signatures_list, NULL, 0);
-
-  combo = GTK_COMBO_BOX (kdt->signatures_uids);
-  gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
-  for (i = kdt->signatures_count - 1; i >= 0; i--)
-    gtk_combo_box_remove_text (combo, i);
-  kdt->signatures_count = 0;
-}
-
-
-/* Fill the subkeys page.  */
-static void
-subkeys_page_fill_key (GpaKeyDetails *kdt, gpgme_key_t key)
-{
-  if (kdt->subkeys_page)
-    gpa_subkey_list_set_key (kdt->subkeys_list, key);
-}
-
-
-/* Empty the subkeys page.  */
-static void
-subkeys_page_empty (GpaKeyDetails *kdt)
-{
-  if (kdt->subkeys_page)
-    gpa_subkey_list_set_key (kdt->subkeys_list, NULL);
-}
-
-
 
 /* Add a single row to the details table.  */
 static GtkWidget *
@@ -392,58 +309,149 @@
 
 /* Add the signatures page to the notebook.  */
 static void
-construct_signatures_page (GpaKeyDetails *kdt)
+build_signatures_page (GpaKeyDetails *kdt, gpgme_key_t key)
 {
   GtkWidget *label;
   GtkWidget *vbox, *hbox;
-  GtkWidget *combo;
   GtkWidget *scrolled;
-  GtkWidget *siglist;
+  int pnum;
 
+  if (kdt->signatures_page)
+    {
+      if (kdt->signatures_uids)
+        g_signal_handlers_disconnect_by_func
+          (G_OBJECT (kdt->signatures_uids), 
+           G_CALLBACK (signatures_uid_changed), kdt);
+      
+      pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->signatures_page);
+      if (pnum >= 0)
+        gtk_notebook_remove_page (GTK_NOTEBOOK (kdt), pnum);
+      kdt->signatures_page = NULL;
+      kdt->signatures_uids = NULL;
+    }
+  if (kdt->signatures_list)
+    {
+      g_object_unref (kdt->signatures_list);
+      kdt->signatures_list = NULL;
+    }
+  if (kdt->certchain_list)
+    {
+      g_object_unref (kdt->certchain_list);
+      kdt->certchain_list = NULL;
+    }
+  if (!key)
+    return;
+
   vbox = gtk_vbox_new (FALSE, 5);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
 
-  /* UID select button and label.  */
-  hbox = gtk_hbox_new (FALSE, 5);
-  label = gtk_label_new (_("Show signatures on user name:"));
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-  combo = gtk_combo_box_new_text ();
-  gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
-  gtk_widget_set_sensitive (combo, FALSE);
-  kdt->signatures_uids = combo;
-  kdt->signatures_count = 0;
-  kdt->signatures_hbox = hbox;
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+  /* If there is more than one OpenPGP UID, we need a select button.  */
+  if (key->uids && key->uids->next && key->protocol == GPGME_PROTOCOL_OpenPGP)
+    {
+      hbox = gtk_hbox_new (FALSE, 5);
+      label = gtk_label_new (_("Show signatures on user name:"));
+      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+      kdt->signatures_uids = gtk_combo_box_new_text ();
+      gtk_box_pack_start (GTK_BOX (hbox), kdt->signatures_uids, TRUE, TRUE, 0);
+      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+      
+      /* Connect the signal to update the list of user IDs in the
+         signatures page of the notebook.  */
+      g_signal_connect (G_OBJECT (kdt->signatures_uids), "changed",
+                        G_CALLBACK (signatures_uid_changed), kdt);
+    }
 
   /* Signature list.  */
   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);
-  siglist = gpa_siglist_new ();
-  kdt->signatures_list = siglist;
-  gtk_container_add (GTK_CONTAINER (scrolled), siglist);
+  if (key->protocol == GPGME_PROTOCOL_OpenPGP)
+    {
+      kdt->signatures_list = gpa_siglist_new ();
+      g_object_ref (kdt->signatures_list);
+      gtk_container_add (GTK_CONTAINER (scrolled), kdt->signatures_list);
+    }
+  else
+    {
+      kdt->certchain_list = gpa_certchain_new ();
+      g_object_ref (kdt->certchain_list);
+      gtk_container_add (GTK_CONTAINER (scrolled), kdt->certchain_list);
+    }
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
 
+  kdt->signatures_page = vbox;
   gtk_notebook_append_page (GTK_NOTEBOOK (kdt), vbox,
-                            gtk_label_new (_("Signatures")));
+                            gtk_label_new 
+                            (kdt->certchain_list? _("Chain"):_("Signatures")));
 
+
+  /* Fill this page.  */
+  if (kdt->certchain_list)
+    {
+      gpa_certchain_update (kdt->certchain_list, key);
+    }
+  else if (kdt->signatures_uids)
+    {
+      gpgme_user_id_t uid;
+      GtkComboBox *combo;
+      int i;
+      
+      /* Make the combo widget's width shrink as much as
+	 possible. This (hopefully) fixes the previous behaviour
+	 correctly: displaying a key with slightly longer signed UIDs
+	 caused the top-level window to pseudo-randomly increase it's
+	 size (which couldn't even be undone by the user anymore).  */
+      combo = GTK_COMBO_BOX (kdt->signatures_uids);
+      gtk_widget_set_size_request (GTK_WIDGET (combo), 0, -1);
+
+      gtk_combo_box_append_text (combo, _("All signatures"));
+      gtk_combo_box_set_active (combo, 0);
+      for (i=1, uid = key->uids; uid; i++, uid = uid->next)
+	{
+	  gchar *uid_string = gpa_gpgme_key_get_userid (uid);
+	  gtk_combo_box_append_text (combo, uid_string);
+	  g_free (uid_string);
+	}
+      
+      gpa_siglist_set_signatures (kdt->signatures_list, key, -1);
+    }
+  else
+    {
+      gpa_siglist_set_signatures (kdt->signatures_list, key, 0);
+    }
 }
 
 
-/* Add the subkeys page to the notebook.  */
+/* Create and append new page with all subkeys for KEY.  If KEY is
+   NULL remove an existing subkeys page. */
 static void
-construct_subkeys_page (GpaKeyDetails *kdt)
+build_subkeys_page (GpaKeyDetails *kdt, gpgme_key_t key)
 {
   GtkWidget *vbox;
   GtkWidget *scrolled;
   GtkWidget *subkeylist;
-  
+  int pnum;
+
+  /* First remove an existing page.  */
   if (kdt->subkeys_page)
-    return;  /* The page has already been constructed.  */
+    {
+      pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->subkeys_page);
+      if (pnum >= 0)
+        gtk_notebook_remove_page (GTK_NOTEBOOK (kdt), pnum);
+      kdt->subkeys_page = NULL;
+      if (kdt->subkeys_list)
+        {
+          g_object_unref (kdt->subkeys_list);
+          kdt->subkeys_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);
@@ -456,22 +464,17 @@
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);
   kdt->subkeys_list = subkeylist;
+  g_object_ref (kdt->subkeys_list);
   kdt->subkeys_page = vbox;
   gtk_notebook_append_page (GTK_NOTEBOOK (kdt), kdt->subkeys_page,
-                            gtk_label_new (_("Subkeys")));
-}
+                            gtk_label_new 
+                            (key->protocol == GPGME_PROTOCOL_OpenPGP
+                             ? _("Subkeys") : _("Key")));
+  
+  /* Fill this page.  */
+  gpa_subkey_list_set_key (kdt->subkeys_list, key);
 
 
-/* Remove the subkeys page from the notebook.  */
-static void
-remove_subkeys_page (GpaKeyDetails *kdt)
-{
-  if (!kdt->subkeys_page)
-    return;  /* Page has not been constructed.  */
-    
-  gtk_notebook_remove_page (GTK_NOTEBOOK (kdt), 2);
-  kdt->subkeys_list = NULL;
-  kdt->subkeys_page = NULL;
 }
 
 
@@ -481,10 +484,19 @@
 {
   GpaKeyDetails *kdt = param;
 
-  if (!gpa_options_get_simplified_ui (gpa_options_get_instance ()))
-    construct_subkeys_page (kdt);
-  else
-    remove_subkeys_page (kdt);
+  if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
+    {
+      build_signatures_page (kdt, NULL);
+      build_subkeys_page (kdt, NULL);
+    }
+  else 
+    {
+      build_signatures_page (kdt, kdt->current_key);
+      build_subkeys_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));
 }
 
 
@@ -493,24 +505,9 @@
 static void
 construct_main_widget (GpaKeyDetails *kdt)
 {
-/*   kdt->notebook = gtk_notebook_new (); */
-/*   gtk_container_add (GTK_CONTAINER (kdt), kdt->notebook); */
-
   /* Details Page */
   construct_details_page (kdt);
 
-  /* Signatures Page.  */
-  construct_signatures_page (kdt);
-
-  /* The Subkeys page is only added if the simplified UI is not used.  */
-  if (!gpa_options_get_simplified_ui (gpa_options_get_instance ()))
-    construct_subkeys_page (kdt);
-
-  /* Connect the signal to update the list of user IDs in the
-     signatures page of the notebook.  */
-  g_signal_connect (G_OBJECT (kdt->signatures_uids), "changed",
-                    G_CALLBACK (signatures_uid_changed), kdt);
-
   /* Connect the signal to act on the simplified UI change signal.  */
   g_signal_connect (G_OBJECT (gpa_options_get_instance ()),
 		    "changed_ui_mode",
@@ -553,6 +550,21 @@
       gpgme_key_unref (kdt->current_key);
       kdt->current_key = NULL;
     }
+  if (kdt->signatures_list)
+    {
+      g_object_unref (kdt->signatures_list);
+      kdt->signatures_list = NULL;
+    }
+  if (kdt->certchain_list)
+    {
+      g_object_unref (kdt->certchain_list);
+      kdt->certchain_list = NULL;
+    }
+  if (kdt->subkeys_list)
+    {
+      g_object_unref (kdt->subkeys_list);
+      kdt->subkeys_list = NULL;
+    }
 
   parent_class->finalize (object);
 }
@@ -606,30 +618,71 @@
 gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount)
 {
   GpaKeyDetails *kdt;
+  GtkWidget *widget;
+  int pnum;
 
   g_return_if_fail (GPA_IS_KEY_DETAILS (keydetails));
   kdt = GPA_KEY_DETAILS (keydetails);
 
+  /* Save the currently selected page.  */
+  pnum = gtk_notebook_get_current_page (GTK_NOTEBOOK (kdt));
+  if (pnum >= 0
+      && (widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (kdt), pnum)))
+    {
+      if (widget == kdt->signatures_page)
+        pnum = 1;
+      else if (widget == kdt->subkeys_page)
+        pnum = 2;
+      else
+        pnum = 0;
+    }
+  else
+    pnum = 0;
+  
+  
   if (kdt->current_key)
     {
       gpgme_key_unref (kdt->current_key);
       kdt->current_key = NULL;
     }
+
   if (key && keycount == 1)
     {
       gpgme_key_ref (key);
       kdt->current_key = key;
       details_page_fill_key (kdt, key);
-      signatures_page_fill_key (kdt, key);
-      subkeys_page_fill_key (kdt, key);
+
+      /* Depend the generation of pages on the mode of the UI.  */
+      if (gpa_options_get_simplified_ui (gpa_options_get_instance ()))
+        {
+          build_signatures_page (kdt, NULL);
+          build_subkeys_page (kdt, NULL);
+        }
+      else
+        {
+          build_signatures_page (kdt, key);
+          build_subkeys_page (kdt, key);
+        }
     }
   else
     {
       details_page_fill_num_keys (kdt, keycount);
-      signatures_page_empty (kdt);
-      subkeys_page_empty (kdt);
+      build_signatures_page (kdt, NULL);
+      build_subkeys_page (kdt, NULL);
     }
+  gtk_notebook_set_show_tabs 
+    (GTK_NOTEBOOK (kdt), gtk_notebook_get_n_pages (GTK_NOTEBOOK (kdt)) > 1);
+
   gtk_widget_show_all (keydetails);
+
+  /* Try to select the last selected page.  */
+  if (pnum == 1 && kdt->signatures_page)
+    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);
+  else
+    pnum = 0;
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (kdt), pnum);
 }
 
 
@@ -664,6 +717,24 @@
         }
     }
   gpgme_op_keylist_end (ctx);
+
+  if (!any)
+    {
+      gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
+
+      if (!gpgme_op_keylist_start (ctx, pattern, 0))
+        {
+          while (!gpgme_op_keylist_next (ctx, &key))
+            {
+              gpa_key_details_update (keydetails, key, 1);
+              gpgme_key_unref (key);
+              any = 1;
+              break;
+            }
+        }
+      gpgme_op_keylist_end (ctx);
+    }
+
   gpgme_release (ctx);
   if (!any)
     gpa_key_details_update (keydetails, NULL, 0);

Modified: trunk/src/gpgmetools.c
===================================================================
--- trunk/src/gpgmetools.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/gpgmetools.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -821,7 +821,9 @@
      et al. in their name will see their names garbled.  Although this
      is not an issue for me (;-)), I have a couple of friends with
      Umlauts in their name, so let's try to make their life easier by
-     detecting invalid encodings and convert that to Latin-1. */
+     detecting invalid encodings and convert that to Latin-1.  We use
+     this even for X.509 because it may make things even better given
+     all the invalid encodings often found in X.509 certificates.  */
   for (s = string; *s && !(*s & 0x80); s++)
     ;
   if (*s && ((s[1] & 0xc0) == 0x80) && ( ((*s & 0xe0) == 0xc0)
@@ -1298,7 +1300,7 @@
               /* Call user callback.  */ 
               if (parm->cb && !parm->cb (parm->cb_arg, line))
                 {
-                  g_debug ("User requested EOF");
+                  /* User requested EOF.  */
                   goto cleanup;
                 }
             }
@@ -1306,13 +1308,11 @@
       if (status != G_IO_STATUS_NORMAL && status != G_IO_STATUS_AGAIN )
         {
           /* Error or EOF.  */
-          g_debug ("Received %s", status==G_IO_STATUS_EOF? "EOF":"ERROR");
           goto cleanup;
         }
     }
   if ((condition & G_IO_HUP))
     {
-      g_debug ("Received HUP");
       goto cleanup;
     }
 

Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/keylist.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -29,6 +29,7 @@
 #include "gtktools.h"
 #include "keytable.h"
 #include "icons.h"
+#include "format-dn.h"
 
 
 /* Properties */
@@ -448,7 +449,10 @@
   expiry = gpa_expiry_date_string (key->subkeys->expires);
   ownertrust = gpa_key_ownertrust_string (key);
   validity = gpa_key_validity_string (key);
-  userid = gpa_gpgme_key_get_userid (key->uids);
+  if (key->protocol == GPGME_PROTOCOL_CMS)
+    userid = gpa_format_dn (key->uids? key->uids->uid : NULL);
+  else
+    userid = gpa_gpgme_key_get_userid (key->uids);
   if (list->public_only)
     has_secret = 0;
   else

Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/options.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -216,8 +216,10 @@
 void
 gpa_options_set_simplified_ui (GpaOptions *options, gboolean value)
 {
+  int change = (!options->simplified_ui != !value);
   options->simplified_ui = value;
-  g_signal_emit (options, signals[CHANGED_UI_MODE], 0);
+  if (change)
+    g_signal_emit (options, signals[CHANGED_UI_MODE], 0);
 }
 
 gboolean
@@ -230,8 +232,10 @@
 void
 gpa_options_set_show_advanced_options (GpaOptions *options, gboolean value)
 {
+  int change = (!options->show_advanced_options != !value);
   options->show_advanced_options = value;
-  g_signal_emit (options, signals[CHANGED_SHOW_ADVANCED_OPTIONS], 0);
+  if (change)
+    g_signal_emit (options, signals[CHANGED_SHOW_ADVANCED_OPTIONS], 0);
 }
 
 gboolean

Modified: trunk/src/recipientdlg.c
===================================================================
--- trunk/src/recipientdlg.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/recipientdlg.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -90,7 +90,7 @@
   /* An array with associated key(s) or NULL if none found/selected.  */
   gpgme_key_t *keys;
   
-  /* The allocated size of the KEYS array.  This included the
+  /* The allocated size of the KEYS array.  This includes the
      terminating NULL entry.  */
   unsigned int dimof_keys;
   
@@ -197,6 +197,7 @@
   return list;
 }
 
+
 /* Get an interator for the selected row.  Store it in ITER and
    returns the mdeol.  if nothing is selected NULL is return and ITER
    is not valid.  */ 
@@ -216,7 +217,6 @@
 }
 
 
-
 /* Compute and display a new help text for the statushint.  */
 static void
 update_statushint (RecipientDlg *dialog)
@@ -236,7 +236,6 @@
   if (dialog->freeze_update_statushint)
     return;
 
-  g_debug ("update_statushint called");
   model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->clist_keys));
 
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->radio_pgp)))
@@ -377,6 +376,7 @@
   return nkeys;
 }
 
+
 /* Clear the content of a keyinfo object.  */
 static void
 clear_keyinfo (struct keyinfo_s *keyinfo)
@@ -491,7 +491,7 @@
           else if (append_key_to_keyinfo (&info->pgp, key)
                    >= TRUNCATE_KEYSEARCH_AT)
             {
-              /* Note that the truncation flag is not 100 correct.  In
+              /* Note that the truncation flag is not 100% correct.  In
                  case the next iteration would not yield a new key we
                  have not actually truncated the search.  */ 
               info->pgp.truncated = 1;
@@ -553,7 +553,7 @@
                             -1);
         
         /* Do something with the data */
-        g_print ("parsing mailbox `%s'\n", info? info->mailbox:"(null)");
+        /*g_print ("parsing mailbox `%s'\n", info? info->mailbox:"(null)");*/
         parse_one_recipient (ctx, store, &iter,info);
       }
     while (gtk_tree_model_iter_next (model, &iter));
@@ -574,7 +574,6 @@
   GtkTreeModel *model;
   char *mailbox;
 
-  g_print ("tree view row-activated received\n");
   model = gtk_tree_view_get_model (tree_view);
   if (!gtk_tree_model_get_iter (model, &iter, path))
     return; 
@@ -582,7 +581,6 @@
   gtk_tree_model_get (model, &iter, 
                       RECPLIST_MAILBOX, &mailbox,
                       -1);
-  g_print ("  mailbox is `%s'\n", mailbox);
   g_free (mailbox);
 }
 
@@ -593,7 +591,6 @@
 {
   RecipientDlg *dialog = user_data;
 
-  g_print ("row changed signal received\n");
   g_return_if_fail (dialog);
   update_statushint (dialog);
 }
@@ -656,7 +653,6 @@
       struct userdata_s *info = NULL;
       char *uidstr = gpa_gpgme_key_get_userid (key->uids);
 
-      g_print ("selected key is `%s'\n", uidstr);
       g_free (uidstr);
       if ((model = get_selected_row (dialog, &iter)))
         {
@@ -723,18 +719,21 @@
     dialog->freeze_key_selection--;
 }
 
+
 static void
 recplist_popup_pgp (GtkAction *action, RecipientDlg *dialog)
 {
   do_select_key (dialog, GPGME_PROTOCOL_OpenPGP);
 }
 
+
 static void
 recplist_popup_x509 (GtkAction *action, RecipientDlg *dialog)
 {
   do_select_key (dialog, GPGME_PROTOCOL_CMS);
 }
 
+
 static void
 recplist_popup_ignore (GtkAction *action, RecipientDlg *dialog)
 {
@@ -761,6 +760,7 @@
   dialog->freeze_key_selection--;
 }
 
+
 static gint
 recplist_display_popup_menu (RecipientDlg *dialog, GdkEvent *event, 
                              GtkListStore *list)
@@ -1097,7 +1097,7 @@
 }
 
 
-/* Put RECIPIENTS into the list.  PROTOCOL select the defualt protocol. */
+/* Put RECIPIENTS into the list.  PROTOCOL select the default protocol. */
 void 
 recipient_dlg_set_recipients (RecipientDlg *dialog, GSList *recipients,
                               gpgme_protocol_t protocol)
@@ -1211,7 +1211,6 @@
                 key = NULL;
               if (key)
                 {
-                  g_print ("returning key for recipient '%s'\n", mailbox);
                   gpgme_key_ref (key);
                   keyarray[idx++] = key;
                 }

Modified: trunk/src/settingsdlg.c
===================================================================
--- trunk/src/settingsdlg.c	2009-03-30 00:22:47 UTC (rev 979)
+++ trunk/src/settingsdlg.c	2009-04-02 18:06:11 UTC (rev 980)
@@ -19,7 +19,7 @@
 
 
 /* Violation of GNOME standards: Cancel does not revert a previous
-   apply.  Excvept for the UI mode, we do not auto-apply or syntax
+   apply.  Except for the UI mode, we do not auto-apply or syntax
    check after focus change.  The rationale for this is that:
 
      * gpgconf operations are expensive.



More information about the Gpa-commits mailing list