[Gpa-commits] r944 - in trunk: . pixmaps src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Feb 4 09:58:25 CET 2009
Author: werner
Date: 2009-02-04 09:58:24 +0100 (Wed, 04 Feb 2009)
New Revision: 944
Added:
trunk/pixmaps/blue_yellow_cardkey.xpm
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/pixmaps/ChangeLog
trunk/pixmaps/Makefile.am
trunk/src/ChangeLog
trunk/src/gpasubkeylist.c
trunk/src/icons.c
trunk/src/icons.h
trunk/src/keylist.c
trunk/src/keyring.c
Log:
Show information about smartcards.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/ChangeLog 2009-02-04 08:58:24 UTC (rev 944)
@@ -1,3 +1,7 @@
+2009-02-04 Werner Koch <wk at g10code.com>
+
+ * configure.ac: Check for card_number member of gpgme_subkey_t.
+
2009-01-26 Werner Koch <wk at g10code.com>
* configure.ac: Check for gpgme_op_assuan_transact.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/configure.ac 2009-02-04 08:58:24 UTC (rev 944)
@@ -221,9 +221,15 @@
have_gpgme=yes,have_gpgme=no)
fi
_save_libs=$LIBS
+_save_cflags=$CFLAGS
LIBS="$LIBS $GPGME_LIBS"
+CFLAGS="$CFLAGS $GPGME_CFLAGS"
AC_CHECK_FUNCS([gpgme_op_assuan_transact])
+# Fixme: We should write a test based on gpgme_subkey_t
+# We might even want to put such a test into gpgme.m4.
+AC_CHECK_MEMBERS([struct _gpgme_subkey.card_number],,,[#include <gpgme.h>])
LIBS=$_save_libs
+CFLAGS="$_save_CFLAGS"
#
@@ -243,7 +249,7 @@
GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
#
-# Check for library fucntions
+# Check for library functions
#
# See whether libc supports the Linux inotify interface
Modified: trunk/pixmaps/ChangeLog
===================================================================
--- trunk/pixmaps/ChangeLog 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/pixmaps/ChangeLog 2009-02-04 08:58:24 UTC (rev 944)
@@ -1,3 +1,7 @@
+2009-02-03 Werner Koch <wk at g10code.com>
+
+ * blue_yellow_cardkey.xpm: New.
+
2008-12-17 Marcus Brinkmann <marcus at g10code.de>
* smartcard.xpm: Darken border.
Modified: trunk/pixmaps/Makefile.am
===================================================================
--- trunk/pixmaps/Makefile.am 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/pixmaps/Makefile.am 2009-02-04 08:58:24 UTC (rev 944)
@@ -3,4 +3,5 @@
folder.xpm gpa_blue_key.xpm gpa_logo.xpm gpa_yellow_key.xpm \
harddisk.xpm help.xpm import.xpm keyring.xpm openfile.xpm \
open_folder.xpm sign.xpm verify.xpm wizard_backup.xpm \
- wizard_genkey.xpm keyringeditor.xpm smartcard.xpm
+ wizard_genkey.xpm keyringeditor.xpm smartcard.xpm \
+ blue_yellow_cardkey.xpm
Added: trunk/pixmaps/blue_yellow_cardkey.xpm
===================================================================
--- trunk/pixmaps/blue_yellow_cardkey.xpm 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/pixmaps/blue_yellow_cardkey.xpm 2009-02-04 08:58:24 UTC (rev 944)
@@ -0,0 +1,56 @@
+/* XPM */
+static char * blue_yellow_cardkey_xpm[] = {
+"22 14 39 1",
+" c None",
+". c #AAAAAA",
+"+ c #555129",
+"@ c #000000",
+"# c #554E12",
+"$ c #FFE935",
+"% c #AA9C24",
+"& c #514C24",
+"* c #555555",
+"= c #AAA67E",
+"- c #8E8E8E",
+"; c #7F7F7F",
+"> c #393939",
+", c #716C45",
+"' c #47421A",
+") c #2B2B2B",
+"! c #9C9C9C",
+"~ c #707070",
+"{ c #737575",
+"] c #6E7171",
+"^ c #868E8E",
+"/ c #9EAAAA",
+"( c #DAFFFF",
+"_ c #BCD5D5",
+": c #5C5F5F",
+"< c #8C9C9C",
+"[ c #3B3F3F",
+"} c #92AAAA",
+"| c #495555",
+"1 c #404949",
+"2 c #353939",
+"3 c #697171",
+"4 c #3F4747",
+"5 c #545959",
+"6 c #828484",
+"7 c #303030",
+"8 c #FF9D00",
+"9 c #B9B9B9",
+"0 c #D5D5D5",
+" .+@@+ ",
+" .#$$$%&. ",
+" .********@%$$$$$& ",
+" =#$$$$$$$$$$$$#@##- ",
+" @$$$$$$$$$$$$$@;##> ",
+" ,#'#@''#''%$$$%#%#) ",
+" !**;;~;*~~'$$$$$$'{. ",
+" ]^/((_/((:'%$$$#,<[ ",
+" [}}}|}}(||*'@@'*{}1 ",
+" $$$$$$234*;56;;;/(|7 ",
+" $8$$$$-9;0 ;|((((}4! ",
+" $$$$$$ 24|||4;0 ",
+" $$$$$$ !;))*;0 ",
+" ... "};
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/src/ChangeLog 2009-02-04 08:58:24 UTC (rev 944)
@@ -1,3 +1,13 @@
+2009-02-03 Werner Koch <wk at g10code.com>
+
+ * icons.h, icons.c (GPA_STOCK_SECRET_CARDKEY): New.
+ * keylist.c (get_key_pixbuf): Test for card key.
+ * keyring.c (keyring_details_page_fill_key): Ditto.
+ * gpasubkeylist.c (SUBKEY_IS_CARDKEY, SUBKEY_CARD_NUMBER): New.
+ (gpa_subkey_list_new): Create new fields. Change column title and
+ implement tooltips.
+ (gpa_subkey_list_set_key): Set new fields.
+
2009-01-31 Moritz <moritz at gnu.org>
* cardman.c (struct _GpaCardManager): New member: big_label.
Modified: trunk/src/gpasubkeylist.c
===================================================================
--- trunk/src/gpasubkeylist.c 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/src/gpasubkeylist.c 2009-02-04 08:58:24 UTC (rev 944)
@@ -1,5 +1,6 @@
/* gpasubkeylist.c - The GNU Privacy Assistant
- * Copyright (C) 2003, Miguel Coca.
+ * Copyright (C) 2003 Miguel Coca.
+ * Copyright (C) 2009 g10 Code GmbH.
*
* This file is part of GPA
*
@@ -14,14 +15,15 @@
* 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
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include "gpa.h"
#include "convert.h"
+#include "gtktools.h"
+#include "keytable.h"
#include "gpasubkeylist.h"
/*
@@ -38,13 +40,18 @@
SUBKEY_CAN_CERTIFY,
SUBKEY_CAN_ENCRYPT,
SUBKEY_CAN_AUTHENTICATE,
+#ifdef HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER
+ SUBKEY_IS_CARDKEY,
+ SUBKEY_CARD_NUMBER,
+#endif /*HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER*/
SUBKEY_STATUS,
SUBKEY_N_COLUMNS
} SubkeyListColumn;
-/* Create a new subkey list.
- */
-GtkWidget * gpa_subkey_list_new (void)
+
+/* Create a new subkey list. */
+GtkWidget *
+gpa_subkey_list_new (void)
{
GtkListStore *store;
GtkWidget *list;
@@ -61,6 +68,10 @@
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
+#ifdef HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER
+ G_TYPE_BOOLEAN,
+ G_TYPE_STRING,
+#endif /*HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER*/
G_TYPE_STRING);
/* The view */
@@ -101,36 +112,51 @@
gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
renderer = gtk_cell_renderer_toggle_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Can sign"), renderer,
- "active", SUBKEY_CAN_SIGN,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "active", SUBKEY_CAN_SIGN, NULL);
+ gpa_set_column_title (column, _("[S]"), _("Can sign"));
gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
renderer = gtk_cell_renderer_toggle_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Can certify"),
- renderer,
- "active", SUBKEY_CAN_CERTIFY,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "active", SUBKEY_CAN_CERTIFY, NULL);
+ gpa_set_column_title (column, _("[C]"), _("Can certify"));
gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
renderer = gtk_cell_renderer_toggle_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Can encrypt"),
- renderer,
- "active", SUBKEY_CAN_ENCRYPT,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "active", SUBKEY_CAN_ENCRYPT, NULL);
+ gpa_set_column_title (column, _("[E]"), _("Can encrypt"));
gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
renderer = gtk_cell_renderer_toggle_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Can authenticate"),
- renderer,
- "active", SUBKEY_CAN_AUTHENTICATE,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "active", SUBKEY_CAN_AUTHENTICATE, NULL);
+ gpa_set_column_title (column, _("[A]"), _("Can authenticate"));
gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+#ifdef HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER
+ renderer = gtk_cell_renderer_toggle_new ();
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "active", SUBKEY_IS_CARDKEY, NULL);
+ gpa_set_column_title (column, _("[T]"),
+ _("Secret key stored on a smartcard."));
+ 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", SUBKEY_CARD_NUMBER, NULL);
+ gpa_set_column_title (column, _("Card S/N"),
+ _("Serial number of the smart card."));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
+#endif /*HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER*/
+
return list;
}
-const gchar *subkey_status (gpgme_subkey_t subkey)
+
+const gchar *
+subkey_status (gpgme_subkey_t subkey)
{
if (subkey->revoked)
{
@@ -154,13 +180,15 @@
}
}
-/* Set the key whose subkeys should be displayed.
- */
-void gpa_subkey_list_set_key (GtkWidget * list, gpgme_key_t key)
+
+/* Set the key whose subkeys should be displayed. */
+void
+gpa_subkey_list_set_key (GtkWidget *list, gpgme_key_t key)
{
GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model
(GTK_TREE_VIEW (list)));
- gpgme_subkey_t subkey;
+ gpgme_subkey_t subkey, secsubkey;
+ gpgme_key_t seckey;
gchar *size;
/* Empty the list */
@@ -168,27 +196,46 @@
if (key)
{
+ seckey = gpa_keytable_lookup_key
+ (gpa_keytable_get_secret_instance (), key->subkeys->fpr);
+
/* Add all the subkeys */
for (subkey = key->subkeys; subkey; subkey = subkey->next)
{
GtkTreeIter iter;
+ if (seckey)
+ {
+ for (secsubkey = seckey->subkeys; secsubkey;
+ secsubkey = secsubkey->next)
+ if (subkey->fpr && secsubkey->fpr
+ && g_str_equal (subkey->fpr, secsubkey->fpr))
+ break;
+ }
+ else
+ secsubkey = NULL;
+
/* Append */
gtk_list_store_append (store, &iter);
size = g_strdup_printf ("%i bits", subkey->length);
- gtk_list_store_set (store, &iter,
- SUBKEY_ID, subkey->keyid+8,
- SUBKEY_SIZE, size,
- SUBKEY_ALGO,
- gpgme_pubkey_algo_name (subkey->pubkey_algo),
- SUBKEY_EXPIRE,
- gpa_expiry_date_string (subkey->expires),
- SUBKEY_CAN_SIGN, subkey->can_sign,
- SUBKEY_CAN_CERTIFY, subkey->can_certify,
- SUBKEY_CAN_ENCRYPT, subkey->can_encrypt,
- SUBKEY_CAN_AUTHENTICATE, subkey->can_authenticate,
- SUBKEY_STATUS, subkey_status (subkey),
- -1);
+ gtk_list_store_set
+ (store, &iter,
+ SUBKEY_ID, subkey->keyid+8,
+ SUBKEY_SIZE, size,
+ SUBKEY_ALGO,
+ gpgme_pubkey_algo_name (subkey->pubkey_algo),
+ SUBKEY_EXPIRE,
+ gpa_expiry_date_string (subkey->expires),
+ SUBKEY_CAN_SIGN, subkey->can_sign,
+ SUBKEY_CAN_CERTIFY, subkey->can_certify,
+ SUBKEY_CAN_ENCRYPT, subkey->can_encrypt,
+ SUBKEY_CAN_AUTHENTICATE, subkey->can_authenticate,
+#ifdef HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER
+ SUBKEY_IS_CARDKEY, secsubkey? secsubkey->is_cardkey :0,
+ SUBKEY_CARD_NUMBER, secsubkey? secsubkey->card_number:NULL,
+#endif /*HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER*/
+ SUBKEY_STATUS, subkey_status (subkey),
+ -1);
g_free (size);
}
}
Modified: trunk/src/icons.c
===================================================================
--- trunk/src/icons.c 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/src/icons.c 2009-02-04 08:58:24 UTC (rev 944)
@@ -35,6 +35,7 @@
#include "verify.xpm"
#include "blue_key.xpm"
#include "blue_yellow_key.xpm"
+#include "blue_yellow_cardkey.xpm"
#include "brief.xpm"
#include "decrypt.xpm"
#include "detailed.xpm"
@@ -73,6 +74,7 @@
{ "gpa_yellow_key", gpa_yellow_key_xpm },
{ GPA_STOCK_PUBLIC_KEY, blue_key_xpm },
{ GPA_STOCK_SECRET_KEY, blue_yellow_key_xpm },
+ { GPA_STOCK_SECRET_CARDKEY, blue_yellow_cardkey_xpm },
{ "wizard_genkey", wizard_genkey_xpm},
{ "wizard_backup", wizard_backup_xpm},
{ GPA_STOCK_CARDMAN, smartcard_xpm },
Modified: trunk/src/icons.h
===================================================================
--- trunk/src/icons.h 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/src/icons.h 2009-02-04 08:58:24 UTC (rev 944)
@@ -49,6 +49,7 @@
#define GPA_STOCK_EXPORT "gpa-export"
#define GPA_STOCK_BACKUP "gpa-backup"
+#define GPA_STOCK_SECRET_CARDKEY "gpa-secret-cardkey"
#define GPA_STOCK_SECRET_KEY "gpa-secret-key"
#define GPA_STOCK_PUBLIC_KEY "gpa-public-key"
Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/src/keylist.c 2009-02-04 08:58:24 UTC (rev 944)
@@ -369,9 +369,18 @@
static const gchar *
get_key_pixbuf (gpgme_key_t key)
{
- if (gpa_keytable_lookup_key (gpa_keytable_get_secret_instance (),
- key->subkeys->fpr) != NULL)
- return GPA_STOCK_SECRET_KEY;
+ gpgme_key_t seckey;
+
+ seckey = gpa_keytable_lookup_key (gpa_keytable_get_secret_instance (),
+ key->subkeys->fpr);
+ if (seckey)
+ {
+#ifdef HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER
+ if (seckey->subkeys && seckey->subkeys->is_cardkey)
+ return GPA_STOCK_SECRET_CARDKEY;
+#endif
+ return GPA_STOCK_SECRET_KEY;
+ }
else
return GPA_STOCK_PUBLIC_KEY;
}
Modified: trunk/src/keyring.c
===================================================================
--- trunk/src/keyring.c 2009-01-31 22:54:26 UTC (rev 943)
+++ trunk/src/keyring.c 2009-02-04 08:58:24 UTC (rev 944)
@@ -1326,12 +1326,23 @@
keyring_details_page_fill_key (GPAKeyringEditor *editor, gpgme_key_t key)
{
gpgme_user_id_t uid;
- gchar *text;
+ gpgme_key_t seckey;
+ char *text;
- if (gpa_keytable_lookup_key (gpa_keytable_get_secret_instance(),
- key->subkeys->fpr) != NULL)
- gtk_label_set_text (GTK_LABEL (editor->detail_public_private),
- _("The key has both a private and a public part"));
+ seckey = gpa_keytable_lookup_key (gpa_keytable_get_secret_instance(),
+ key->subkeys->fpr);
+ if (seckey)
+ {
+#ifdef HAVE_STRUCT__GPGME_SUBKEY_CARD_NUMBER
+ if (seckey->subkeys && seckey->subkeys->is_cardkey)
+ gtk_label_set_text (GTK_LABEL (editor->detail_public_private),
+ _("The key has both a smartcard based private part"
+ " and a public part"));
+ else
+#endif
+ gtk_label_set_text (GTK_LABEL (editor->detail_public_private),
+ _("The key has both a private and a public part"));
+ }
else
gtk_label_set_text (GTK_LABEL (editor->detail_public_private),
_("The key has only a public part"));
More information about the Gpa-commits
mailing list