[Gpa-commits] r714 - trunk/src

marcus at wald.intevation.org marcus at wald.intevation.org
Fri Oct 28 17:15:56 CEST 2005


Author: marcus
Date: 2005-10-28 17:15:56 +0200 (Fri, 28 Oct 2005)
New Revision: 714

Modified:
   trunk/src/ChangeLog
   trunk/src/gpakeyselector.c
   trunk/src/gpawidgets.c
   trunk/src/gpgmetools.c
   trunk/src/gpgmetools.h
   trunk/src/keylist.c
   trunk/src/keyring.c
   trunk/src/keysigndlg.c
   trunk/src/verifydlg.c
Log:
2005-10-28  Marcus Brinkmann  <marcus at g10code.de>

	* gpgmetools.c (gpa_gpgme_key_get_userid): Work directly on
	gpgme_user_id_t objects.
	* gpgmetools.h (gpa_gpgme_key_get_userid): Work directly on
	gpgme_user_id_t objects.
	* gpawidgets.c (gpa_key_info_new): Rework using above changes..
	* verifydlg.c [!HAVE_CONFIG_H]: Don't include config.h.
	(add_signature_to_model): Invoke gpa_gpgme_key_get_userid with
	right argument.
	* keyring.c [!HAVE_CONFIG_H]: Do not include config.h.
	(keyring_details_page_fill_key, keyring_signatures_page_fill_key) 
	(keyring_update_status_bar): Fix callers of gpa_gpgme_key_get_userid.
	* keysigndlg.c [!HAVE_CONFIG_H]: Do not include config.h.
	(gpa_key_sign_run_dialog): Fix caller of gpa_gpgme_key_get_userid.
	* keylist.c [HAVE_CONFIG_H]: Include config.h.
	(gpa_keylist_next): Fix caller of gpa_gpgme_key_get_userid.
	* gpakeyselector.c [HAVE_CONFIG_H]: Include config.h.
	(gpa_key_selector_next_key): Fix caller of
	gpa_gpgme_key_get_userid.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/ChangeLog	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,5 +1,24 @@
 2005-10-28  Marcus Brinkmann  <marcus at g10code.de>
 
+	* gpgmetools.c (gpa_gpgme_key_get_userid): Work directly on
+	gpgme_user_id_t objects.
+	* gpgmetools.h (gpa_gpgme_key_get_userid): Work directly on
+	gpgme_user_id_t objects.
+	* gpawidgets.c (gpa_key_info_new): Rework using above changes..
+	* verifydlg.c [!HAVE_CONFIG_H]: Don't include config.h.
+	(add_signature_to_model): Invoke gpa_gpgme_key_get_userid with
+	right argument.
+	* keyring.c [!HAVE_CONFIG_H]: Do not include config.h.
+	(keyring_details_page_fill_key, keyring_signatures_page_fill_key) 
+	(keyring_update_status_bar): Fix callers of gpa_gpgme_key_get_userid.
+	* keysigndlg.c [!HAVE_CONFIG_H]: Do not include config.h.
+	(gpa_key_sign_run_dialog): Fix caller of gpa_gpgme_key_get_userid.
+	* keylist.c [HAVE_CONFIG_H]: Include config.h.
+	(gpa_keylist_next): Fix caller of gpa_gpgme_key_get_userid.
+	* gpakeyselector.c [HAVE_CONFIG_H]: Include config.h.
+	(gpa_key_selector_next_key): Fix caller of
+	gpa_gpgme_key_get_userid.
+
 	* gpa.c [!HAVE_CONFIG_H]: Don't include config.h.
 	(main) [!USE_SIMPLE_GETTEXT && ENABLE_NLS]: Invoke
 	gpgme_set_locale.	
@@ -9,6 +28,7 @@
 	* keytable.c (gpa_keytable_lookup_key): Likewise.
 	* gpawidgets.c (gpa_expiry_frame_get_expiration): Make day, month
 	and year of type guint.
+
 	* expirydlg.c (expiry_ok): Likewise.
 	* qdchkpwd.c (qdchkpwd): Cast char pointer to unsigned char
 	pointer for compress.

Modified: trunk/src/gpakeyselector.c
===================================================================
--- trunk/src/gpakeyselector.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/gpakeyselector.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,23 +1,27 @@
-/* gpakeyselector.c  -  The GNU Privacy Assistant
- *      Copyright (C) 2003 Miguel Coca.
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* gpakeyselector.c - The GNU Privacy Assistant key selector.
+   Copyright (C) 2003 Miguel Coca.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "gpa.h"
 #include "gpakeyselector.h"
 #include "keytable.h"
@@ -214,7 +218,7 @@
   /* The Key ID */
   keyid = gpa_gpgme_key_get_short_keyid (key, 0);
   /* The user ID */
-  userid = gpa_gpgme_key_get_userid (key, 0);
+  userid = gpa_gpgme_key_get_userid (key->uids);
   /* Append it to the list */
   gtk_list_store_append (store, &iter);
   gtk_list_store_set (store, &iter,

Modified: trunk/src/gpawidgets.c
===================================================================
--- trunk/src/gpawidgets.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/gpawidgets.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -43,25 +43,27 @@
 {
   GtkWidget * table;
   GtkWidget * label;
-  gchar *string, *uid;
-  int i;
+  gchar *string;
+  gpgme_user_id_t uid;
 
   table = gtk_table_new (2, 2, FALSE);
   gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
   gtk_table_set_row_spacing (GTK_TABLE (table), 0, 0);
 
-  /* One user ID on each line */
-  string = gpa_gpgme_key_get_userid (key, 0);
-  for (i = 1; (uid = gpa_gpgme_key_get_userid (key, i)) != NULL; i++)
+  /* One user ID on each line.  */
+  string = gpa_gpgme_key_get_userid (key->uids);
+  uid = key->uids->next;
+  while (uid)
     {
-      /* Don't display revoked UID's */
-      if (!gpgme_key_get_ulong_attr (key, GPGME_ATTR_UID_REVOKED, NULL, i))
-        {
+      if (!uid->revoked)
+	{
+	  gchar *uid_string = gpa_gpgme_key_get_userid (uid);
           gchar *tmp = string;
-          string = g_strconcat (string, "\n", uid, NULL);
+          string = g_strconcat (string, "\n", uid_string, NULL);
           g_free (tmp);
-	  g_free (uid);
+	  g_free (uid_string);
         }
+      uid = uid->next;
     }
   label = gtk_label_new (string);
   g_free (string);
@@ -70,7 +72,8 @@
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
 
   /* User Name */
-  label = gtk_label_new (i == 1 ? _("User Name:") : _("User Names:") );
+  label = gtk_label_new (key->uids->next == NULL
+			 ? _("User Name:") : _("User Names:") );
   gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 
                     0, 0);
   gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);

Modified: trunk/src/gpgmetools.c
===================================================================
--- trunk/src/gpgmetools.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/gpgmetools.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,23 +1,24 @@
-/* gpgmetools.c - The GNU Privacy Assistant
- *      Copyright (C) 2002, Miguel Coca.
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* gpgmetools.h - additional gpgme support functions for GPA.
+   Copyright (C) 2002, Miguel Coca.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+
 /* A set of auxiliary functions for common tasks related to GPGME */
 
 #ifdef HAVE_CONFIG_H
@@ -720,15 +721,14 @@
     }
 }
 
-gchar *gpa_gpgme_key_get_userid (gpgme_key_t key, int idx)
+gchar *gpa_gpgme_key_get_userid (gpgme_user_id_t uid)
 {
-  const char * uid;
   gchar *uid_utf8;
 
-  uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, idx);
-  uid_utf8 = string_to_utf8 (uid);
+  uid_utf8 = string_to_utf8 (uid->uid);
+
   /* Tag revoked UID's*/
-  if (gpgme_key_get_ulong_attr (key, GPGME_ATTR_UID_REVOKED, NULL, idx))
+  if (uid->revoked)
     {
       gchar *tmp = g_strdup_printf ("[%s] %s", _("Revoked"), uid_utf8);
       g_free (uid_utf8);

Modified: trunk/src/gpgmetools.h
===================================================================
--- trunk/src/gpgmetools.h	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/gpgmetools.h	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,23 +1,24 @@
-/* gpgmetools.h - The GNU Privacy Assistant
- *      Copyright (C) 2002, Miguel Coca.
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* gpgmetools.h - additional gpgme support functions for GPA.
+   Copyright (C) 2002, Miguel Coca.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+
 /* A set of auxiliary functions for common tasks related to GPGME */
 
 #ifndef GPGMETOOLS_H
@@ -136,13 +137,14 @@
 			       const char *passphrase_info, 
 			       int prev_was_bad, int fd);
 
-/* Convenience functions to access key attributes, which need to be filtered
- * before being displayed to the user. */
+
+/* Convenience functions to access key attributes, which need to be
+   filtered before being displayed to the user. */
 
-/* Return the user ID, making sure it is properly UTF-8 encoded.
- * Allocates a new string, which must be freed with g_free().
- */
-gchar *gpa_gpgme_key_get_userid (gpgme_key_t key, int idx);
+/* Return the user ID string, making sure it is properly UTF-8
+  encoded.  Allocates a new string, which must be freed with
+  g_free().  */
+gchar *gpa_gpgme_key_get_userid (gpgme_user_id_t key);
 
 /* Return the key fingerprint, properly formatted according to the key version.
  * Allocates a new string, which must be freed with g_free().

Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/keylist.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,23 +1,27 @@
-/* gpakeyselector.c  -  The GNU Privacy Assistant
- *      Copyright (C) 2003 Miguel Coca.
- *
- * 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* keylist.c - The GNU Privacy Assistant keylist.
+   Copyright (C) 2003 Miguel Coca.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "gpa.h"
 #include "keylist.h"
 #include "gpapastrings.h"
@@ -545,7 +549,7 @@
   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, 0);
+  userid = gpa_gpgme_key_get_userid (key->uids);
   has_secret = (gpa_keytable_lookup_key (gpa_keytable_get_secret_instance(), 
 					 key->subkeys->fpr) != NULL);
   /* Check for ElGamal signing keys and warn the user.

Modified: trunk/src/keyring.c
===================================================================
--- trunk/src/keyring.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/keyring.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,25 +1,28 @@
-/* keyring.c  -  The GNU Privacy Assistant
- *      Copyright (C) 2000, 2001 G-N-U 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* keyring.c - The GNU Privacy Assistant keyring.
+   Copyright (C) 2000, 2001 G-N-U GmbH.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "gpa.h"
-#include <config.h>
 #include <gpgme.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
@@ -1211,14 +1214,13 @@
   return notebook;
 }
 
-/* Fill the details page of the details notebook with the properties of
- * the publix key key */
+/* Fill the details page of the details notebook with the properties
+   of the publix key key */
 static void
 keyring_details_page_fill_key (GPAKeyringEditor * editor, gpgme_key_t key)
 {
-  gchar * text;
-  gchar * uid;
-  gint i;
+  gpgme_user_id_t uid;
+  gchar *text;
 
   if (gpa_keytable_lookup_key (gpa_keytable_get_secret_instance(), 
 			       key->subkeys->fpr) != NULL)
@@ -1234,13 +1236,18 @@
   gtk_label_set_text (GTK_LABEL (editor->detail_capabilities),
 		      gpa_get_key_capabilities_text (key));
 
-  /* One user ID on each line */
-  text = gpa_gpgme_key_get_userid (key, 0);
-  for (i = 1; (uid = gpa_gpgme_key_get_userid (key, i)) != NULL; i++)
+  /* One user ID on each line.  */
+  text = gpa_gpgme_key_get_userid (key->uids);
+  uid = key->uids->next;
+  while (uid)
     {
+      gchar *uid_string = gpa_gpgme_key_get_userid (uid);
       gchar *tmp = text;
-      text = g_strconcat (text, "\n", uid, NULL);
+      text = g_strconcat (text, "\n", uid_string, NULL);
       g_free (tmp);
+      g_free (uid_string);
+
+      uid = uid->next;
     }
   gtk_label_set_text (GTK_LABEL (editor->detail_name), text);
   g_free (text);
@@ -1309,22 +1316,28 @@
 {
   GtkWidget *menu;
   GtkWidget *label;
-  gchar *uid;
-  int i;
 
-  /* Create the menu for the popdown UID list, if there is more than une UID
-   */
+  /* Create the menu for the popdown UID list, if there is more than
+     one UID.  */
   if (key->uids && key->uids->next)
     {
+      gpgme_user_id_t uid;
+
       menu = gtk_menu_new ();
       label = gtk_menu_item_new_with_label (_("All signatures"));
       gtk_menu_shell_append (GTK_MENU_SHELL (menu), label);
-      for (i = 0; (uid = gpa_gpgme_key_get_userid (key, i)) != NULL; i++)
+
+      uid = key->uids;
+      while (uid)
 	{
-	  label = gtk_menu_item_new_with_label (uid);
+	  gchar *uid_string = gpa_gpgme_key_get_userid (uid);
+	  label = gtk_menu_item_new_with_label (uid_string);
 	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), label);
-	  g_free (uid);
+	  g_free (uid_string);
+
+	  uid = uid->next;
 	}
+
       gtk_option_menu_set_menu (GTK_OPTION_MENU (editor->signatures_uids), 
 				menu);
       gtk_widget_show_all (menu);
@@ -1660,11 +1673,11 @@
 keyring_update_status_bar (GPAKeyringEditor * editor)
 {
   gpgme_key_t key = gpa_options_get_default_key (gpa_options_get_instance ());
-  gchar *string;
 
   if (key)
     {
-      string =  gpa_gpgme_key_get_userid (key, 0);
+      gchar *string = gpa_gpgme_key_get_userid (key->uids);
+
       gtk_label_set_text (GTK_LABEL (editor->status_key_user), string);
       g_free (string);
       gtk_label_set_text (GTK_LABEL (editor->status_key_id),

Modified: trunk/src/keysigndlg.c
===================================================================
--- trunk/src/keysigndlg.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/keysigndlg.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,24 +1,27 @@
 /* keysigndlg.c  -  The GNU Privacy Assistant
- *	Copyright (C) 2000, 2001 G-N-U 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+   Copyright (C) 2000, 2001 G-N-U GmbH.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+#if HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 #include <stdlib.h>
@@ -53,8 +56,8 @@
   GtkWidget *label;
   GtkWidget *uid_box;
   GtkResponseType response;
-  gint uid_count;
   gchar *string;
+  gpgme_user_id_t uid;
 
   window = gtk_dialog_new_with_buttons (_("Sign Key"), GTK_WINDOW(parent),
                                         GTK_DIALOG_MODAL,
@@ -83,23 +86,32 @@
 
   /* Build this first, so that we can know how may user ID's there are */
   uid_box = gtk_vbox_new (TRUE, 0);
-  for (uid_count = 0; 
-       gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, uid_count);
-       uid_count++)
+
+  /* One user ID on each line.  */
+  string = gpa_gpgme_key_get_userid (key->uids);
+  uid = key->uids->next;
+  while (uid)
     {
-      if (!gpgme_key_get_ulong_attr (key, GPGME_ATTR_UID_REVOKED, NULL, 
-                                     uid_count))
-        {
-          string = gpa_gpgme_key_get_userid (key, uid_count);
+      if (!uid->revoked)
+	{
+	  gchar *uid_string = gpa_gpgme_key_get_userid (uid);
+          gchar *tmp = string;
+          string = g_strconcat (string, "\n", uid_string, NULL);
+          g_free (tmp);
+	  g_free (uid_string);
+
           label = gtk_label_new (string);
           g_free (string);
           gtk_box_pack_start_defaults (GTK_BOX(uid_box), label);
           gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
         }
+      uid = uid->next;
     }
 
-  label = gtk_label_new ( uid_count == 1 ? _("User Name:") : _("User Names:"));
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+  label = gtk_label_new (key->uids->next == NULL
+			 ? _("User Name:") : _("User Names:"));
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+		    GTK_FILL, GTK_FILL, 0, 0);
   gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);
 
   gtk_table_attach (GTK_TABLE (table), uid_box, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
@@ -119,7 +131,7 @@
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
 
-  if (uid_count > 1)
+  if (key->uids->next)
     {
       label = gtk_label_new (_("All user names in this key will be signed."));
       gtk_box_pack_start (GTK_BOX (vboxSign), label, FALSE, TRUE, 10);

Modified: trunk/src/verifydlg.c
===================================================================
--- trunk/src/verifydlg.c	2005-10-28 14:35:30 UTC (rev 713)
+++ trunk/src/verifydlg.c	2005-10-28 15:15:56 UTC (rev 714)
@@ -1,24 +1,27 @@
-/* fileverifydlg.c  -  The GNU Privacy Assistant
- *	Copyright (C) 2000, 2001 G-N-U 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 2 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+/* fileverifydlg.c - Dialog for verifying files.
+   Copyright (C) 2000, 2001 G-N-U GmbH.
+   Copyright (C) 2005 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 2 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 GPA; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  */
+
+#if HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 #include <string.h>
@@ -257,7 +260,7 @@
   if (data->key)
     {
       keyid = gpa_gpgme_key_get_short_keyid (data->key, 0);
-      userid = gpa_gpgme_key_get_userid (data->key, 0);
+      userid = gpa_gpgme_key_get_userid (data->key->uids);
       status = signature_status_label (data);
     }
   else



More information about the Gpa-commits mailing list