[Gpa-commits] r930 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Jan 11 17:15:56 CET 2009


Author: moritzs
Date: 2009-01-11 17:15:55 +0100 (Sun, 11 Jan 2009)
New Revision: 930

Modified:
   trunk/src/ChangeLog
   trunk/src/cardman.c
   trunk/src/gpgmeedit.c
   trunk/src/keygendlg.c
Log:
2009-01-11  Moritz  <moritz at gnu.org>

	* gpgmeedit.c (card_edit_genkey_fnc_transit): Add default-case in
	switch.

	* cardman.c (construct_card_widget): Modify ADD_TABLE_ROW macro to
	enable the caller to pass in the GTK table and the rowidx counter.
	New variables: general_frame, personal_frame, keys_frame,
	general_table, personal_table, keys_table; removed variable:
	table. Modified function to divide the GUI into three frames.

	* keygendlg.c (gpa_key_gen_run_dialog): Use different window title
	in case forcard is true.
	(gpa_key_gen_run_dialog): If forcard is true: use hard-coded value
	"RSA" for combo box and store numerical identifier for RSA in
	params struct manually instead of looking it up through
	gpa_algorithm_from_string.
	Initialize entryPasswd to NULL to silence compiler warning.

	* gpgmeedit.c (DEBUG_FSM): Reset to 0.



Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-01-11 14:44:40 UTC (rev 929)
+++ trunk/src/ChangeLog	2009-01-11 16:15:55 UTC (rev 930)
@@ -1,5 +1,24 @@
 2009-01-11  Moritz  <moritz at gnu.org>
 
+	* gpgmeedit.c (card_edit_genkey_fnc_transit): Add default-case in
+	switch.
+
+	* cardman.c (construct_card_widget): Modify ADD_TABLE_ROW macro to
+	enable the caller to pass in the GTK table and the rowidx counter.
+	New variables: general_frame, personal_frame, keys_frame,
+	general_table, personal_table, keys_table; removed variable:
+	table. Modified function to divide the GUI into three frames.
+
+	* keygendlg.c (gpa_key_gen_run_dialog): Use different window title
+	in case forcard is true.
+	(gpa_key_gen_run_dialog): If forcard is true: use hard-coded value
+	"RSA" for combo box and store numerical identifier for RSA in
+	params struct manually instead of looking it up through
+	gpa_algorithm_from_string.
+	Initialize entryPasswd to NULL to silence compiler warning.
+
+	* gpgmeedit.c (DEBUG_FSM): Reset to 0.
+
 	* gpagenkeycardop.c (gpa_gen_key_card_operation_done_cb): Do not
 	use gpgme_op_genkey_result to retrieve result information about
 	the generated key.

Modified: trunk/src/cardman.c
===================================================================
--- trunk/src/cardman.c	2009-01-11 14:44:40 UTC (rev 929)
+++ trunk/src/cardman.c	2009-01-11 16:15:55 UTC (rev 930)
@@ -458,13 +458,28 @@
 static GtkWidget *
 construct_card_widget (GpaCardManager *cardman)
 {
-  GtkWidget *table;
+  GtkWidget *container;
+  GtkWidget *general_frame;
+  GtkWidget *general_table;
+  GtkWidget *personal_frame;
+  GtkWidget *personal_table;
+  GtkWidget *keys_frame;
+  GtkWidget *keys_table;
   int rowidx = 0;
 
-  table = gtk_table_new (4, 2, FALSE);
-  gtk_container_set_border_width (GTK_CONTAINER (table), 5);
+  container = gtk_vbox_new (FALSE, 0);
+
+  general_frame = gtk_frame_new ("General");
+  personal_frame = gtk_frame_new ("Personal");
+  keys_frame = gtk_frame_new ("Keys");
+
+  general_table = gtk_table_new (4, 2, FALSE);
+  personal_table = gtk_table_new (4, 2, FALSE);
+  keys_table = gtk_table_new (4, 2, FALSE);
+
+  gtk_container_set_border_width (GTK_CONTAINER (general_table), 5);
   
-#define ADD_TABLE_ROW(label, widget)				       \
+#define ADD_TABLE_ROW(table, rowidx, label, widget)		       \
   {								       \
     GtkWidget *tmp_label = gtk_label_new (_(label));		       \
     gtk_misc_set_alignment (GTK_MISC (tmp_label), 0, 0.5);	       \
@@ -476,25 +491,32 @@
     rowidx++;							       \
   }
   
+  /* General frame.  */
+
   cardman->entrySerialno = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entrySerialno), FALSE);
-  ADD_TABLE_ROW ("Serial Number: ", cardman->entrySerialno);
+  ADD_TABLE_ROW (general_table, rowidx, "Serial Number: ", cardman->entrySerialno);
 
   cardman->entryVersion = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryVersion), FALSE);
-  ADD_TABLE_ROW ("Card Version: ", cardman->entryVersion);
+  ADD_TABLE_ROW (general_table, rowidx, "Card Version: ", cardman->entryVersion);
 
   cardman->entryManufacturer = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryManufacturer), FALSE);
-  ADD_TABLE_ROW ("Manufacturer: ", cardman->entryManufacturer);
+  ADD_TABLE_ROW (general_table, rowidx, "Manufacturer: ", cardman->entryManufacturer);
 
+  gtk_container_add (GTK_CONTAINER (general_frame), general_table);
+  rowidx = 0;
+
+  /* Personal frame.  */
+
   cardman->entryFirstName = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryFirstName), FALSE);
-  ADD_TABLE_ROW ("First Name: ", cardman->entryFirstName);
+  ADD_TABLE_ROW (personal_table, rowidx, "First Name: ", cardman->entryFirstName);
 
   cardman->entryLastName = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryLastName), FALSE);
-  ADD_TABLE_ROW ("Last Name: ", cardman->entryLastName);
+  ADD_TABLE_ROW (personal_table, rowidx, "Last Name: ", cardman->entryLastName);
 
 #if 0
   cardman->comboSex = gtk_combo_box_new_text ();
@@ -507,32 +529,43 @@
 
   cardman->entryLanguage = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryLanguage), FALSE);
-  ADD_TABLE_ROW ("Language: ", cardman->entryLanguage);
+  ADD_TABLE_ROW (personal_table, rowidx, "Language: ", cardman->entryLanguage);
 
   cardman->entryLogin = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryLogin), FALSE);
-  ADD_TABLE_ROW ("Login Data: ", cardman->entryLogin);
+  ADD_TABLE_ROW (personal_table, rowidx, "Login Data: ", cardman->entryLogin);
 
   cardman->entryPubkeyUrl = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryPubkeyUrl), FALSE);
-  ADD_TABLE_ROW ("Public key URL: ", cardman->entryPubkeyUrl);
+  ADD_TABLE_ROW (personal_table, rowidx, "Public key URL: ", cardman->entryPubkeyUrl);
 
+  gtk_container_add (GTK_CONTAINER (personal_frame), personal_table);
+  rowidx = 0;
+
+  /* Keys frame.  */
+
   cardman->entryKeySig = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryKeySig), FALSE);
   gtk_entry_set_width_chars (GTK_ENTRY (cardman->entryKeySig), 42);
-  ADD_TABLE_ROW ("Signature Key: ", cardman->entryKeySig);
+  ADD_TABLE_ROW (keys_table, rowidx, "Signature Key: ", cardman->entryKeySig);
 
   cardman->entryKeyEnc = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryKeyEnc), FALSE);
   gtk_entry_set_width_chars (GTK_ENTRY (cardman->entryKeyEnc), 42);
-  ADD_TABLE_ROW ("Encryption Key: ", cardman->entryKeyEnc);
+  ADD_TABLE_ROW (keys_table, rowidx, "Encryption Key: ", cardman->entryKeyEnc);
 
   cardman->entryKeyAuth = gtk_entry_new ();
   gtk_editable_set_editable (GTK_EDITABLE (cardman->entryKeyAuth), FALSE);
   gtk_entry_set_width_chars (GTK_ENTRY (cardman->entryKeyAuth), 42);
-  ADD_TABLE_ROW ("Authentication Key: ", cardman->entryKeyAuth);
+  ADD_TABLE_ROW (keys_table, rowidx, "Authentication Key: ", cardman->entryKeyAuth);
 
-  return table;
+  gtk_container_add (GTK_CONTAINER (keys_frame), keys_table);
+
+  gtk_box_pack_start (GTK_BOX (container), general_frame, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (container), personal_frame, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (container), keys_frame, FALSE, TRUE, 0);
+
+  return container;
 }
 
 

Modified: trunk/src/gpgmeedit.c
===================================================================
--- trunk/src/gpgmeedit.c	2009-01-11 14:44:40 UTC (rev 929)
+++ trunk/src/gpgmeedit.c	2009-01-11 16:15:55 UTC (rev 930)
@@ -44,7 +44,7 @@
  */
 
 /* Define this macro to 1 to enable debugging of the FSM. */
-#define DEBUG_FSM 1
+#define DEBUG_FSM 0
 
 
 /* Prototype of the action function. Returns the error if there is one */
@@ -1404,7 +1404,10 @@
           *err =  gpg_error (GPG_ERR_GENERAL);
         }
       break;
-      
+
+    default:
+      next_state = CARD_ERROR;
+      *err = gpg_error (GPG_ERR_GENERAL);
     }
 
   return next_state;

Modified: trunk/src/keygendlg.c
===================================================================
--- trunk/src/keygendlg.c	2009-01-11 14:44:40 UTC (rev 929)
+++ trunk/src/keygendlg.c	2009-01-11 16:15:55 UTC (rev 930)
@@ -153,7 +153,7 @@
   dialog.forcard = forcard;
 
   windowGenerate = gtk_dialog_new_with_buttons
-    (_("Generate key"), GTK_WINDOW (parent),
+    (forcard ? _("Generate new keys on card") : _("Generate key"), GTK_WINDOW (parent),
      GTK_DIALOG_MODAL,
      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
      GTK_STOCK_OK, GTK_RESPONSE_OK,
@@ -188,8 +188,7 @@
 
   if (forcard)
     /* The OpenPGP smartcard does only support RSA. */
-    gtk_combo_box_append_text (GTK_COMBO_BOX (comboAlgorithm),
-			       gpa_algorithm_string (GPA_KEYGEN_ALGO_RSA));
+    gtk_combo_box_append_text (GTK_COMBO_BOX (comboAlgorithm), "RSA");
   else
     {
       for (algo = GPA_KEYGEN_ALGO_FIRST; algo <= GPA_KEYGEN_ALGO_LAST; algo++)
@@ -256,6 +255,8 @@
   gtk_table_attach (GTK_TABLE (table), entryComment, 1, 2, 4, 5, GTK_FILL,
 		    GTK_SHRINK, 0, 0);
 
+  entryPasswd = NULL;		/* Silence compiler warning. */
+
   if (forcard)
     {
       /* This doesn't make sense for the smartcard. */
@@ -314,8 +315,15 @@
 	params->password
 	  = XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY(entryPasswd)));
 
-      temp = gtk_combo_box_get_active_text (GTK_COMBO_BOX (comboAlgorithm));
-      params->algo = gpa_algorithm_from_string (temp);
+      if (forcard)
+	/* Although this values isn't used... */
+	params->algo = GPA_KEYGEN_ALGO_RSA;
+      else
+	{
+	  temp = gtk_combo_box_get_active_text (GTK_COMBO_BOX (comboAlgorithm));
+	  params->algo = gpa_algorithm_from_string (temp);
+	}
+
       temp = gtk_combo_box_get_active_text (GTK_COMBO_BOX (comboKeysize));
       params->keysize = atoi (temp);
 



More information about the Gpa-commits mailing list