[Gpa-commits] r868 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 3 03:43:15 CEST 2008


Author: marcus
Date: 2008-04-03 03:43:04 +0200 (Thu, 03 Apr 2008)
New Revision: 868

Modified:
   trunk/src/ChangeLog
   trunk/src/encryptdlg.c
   trunk/src/filesigndlg.c
   trunk/src/gparecvkeydlg.c
   trunk/src/gtktools.c
   trunk/src/gtktools.h
   trunk/src/keygendlg.c
   trunk/src/keyimpseldlg.c
   trunk/src/keyring.c
   trunk/src/recipientdlg.c
   trunk/src/selectkeydlg.c
   trunk/src/settingsdlg.c
Log:
2008-04-03  Marcus Brinkmann  <marcus at g10code.de>

	* gtktools.h (gpa_connect_by_accelerator): Remove prototype.
	* gtktools.c (gpa_connect_by_accelerator): Remove obsolete interface.
	* selectkeydlg.c (select_key_dlg_constructor): Remove accel_group.
	* keyring.c (keyring_editor_new): Likewise.
	* keyimpseldlg.c (gpa_key_import_selection_dialog_run): Likewise.
	* encryptdlg.c (gpa_file_encrypt_dialog_constructor): Remove
	accelGroup variable.  Use gtk_label_set_mnemonic_widget instead of
	gpa_connect_by_accelerator.
	* filesigndlg.c (gpa_file_sign_dialog_constructor): Likewise.
	* gparecvkeydlg.c (gpa_receive_key_dialog_init): Likewise.
	* recipientdlg.c (recipient_dlg_constructor): Likewise.
	* keyimpseldlg.c (gpa_key_import_selection_dialog_run): Likewise.
	* keygendlg.c (gpa_key_gen_run_dialog): Likewise.
	Also clean up use of combo boxes and ESC key handling.
	(struct _GPAKeyGenDialog): New member comboKeysize.
	(response_cb): Check keysize parameter.
	* settingsdlg.c (keyserver_selected_cb): Adjust to new combo box method.
	(selected_from_list_cb): Likewise.
	(append_to_combo): New function.
	(default_keyserver_frame): Use new combo box interface.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/ChangeLog	2008-04-03 01:43:04 UTC (rev 868)
@@ -1,3 +1,26 @@
+2008-04-03  Marcus Brinkmann  <marcus at g10code.de>
+
+	* gtktools.h (gpa_connect_by_accelerator): Remove prototype.
+	* gtktools.c (gpa_connect_by_accelerator): Remove obsolete interface.
+	* selectkeydlg.c (select_key_dlg_constructor): Remove accel_group.
+	* keyring.c (keyring_editor_new): Likewise.
+	* keyimpseldlg.c (gpa_key_import_selection_dialog_run): Likewise.
+	* encryptdlg.c (gpa_file_encrypt_dialog_constructor): Remove
+	accelGroup variable.  Use gtk_label_set_mnemonic_widget instead of
+	gpa_connect_by_accelerator.
+	* filesigndlg.c (gpa_file_sign_dialog_constructor): Likewise.
+	* gparecvkeydlg.c (gpa_receive_key_dialog_init): Likewise.
+	* recipientdlg.c (recipient_dlg_constructor): Likewise.
+	* keyimpseldlg.c (gpa_key_import_selection_dialog_run): Likewise.
+	* keygendlg.c (gpa_key_gen_run_dialog): Likewise.
+	Also clean up use of combo boxes and ESC key handling.
+	(struct _GPAKeyGenDialog): New member comboKeysize.
+	(response_cb): Check keysize parameter.
+	* settingsdlg.c (keyserver_selected_cb): Adjust to new combo box method.
+	(selected_from_list_cb): Likewise.
+	(append_to_combo): New function.
+	(default_keyserver_frame): Use new combo box interface.
+
 2008-04-02  Marcus Brinkmann  <marcus at g10code.de>
 
 	* gpafileverifyop.c (gpa_file_verify_operation_done_cb): Emit

Modified: trunk/src/encryptdlg.c
===================================================================
--- trunk/src/encryptdlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/encryptdlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -118,7 +118,6 @@
 {
   GObject *object;
   GpaFileEncryptDialog *dialog;
-  GtkAccelGroup *accelGroup;
   GtkWidget *vboxEncrypt;
   GtkWidget *labelKeys;
   GtkWidget *scrollerKeys;
@@ -146,13 +145,10 @@
 				     FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
 
-  accelGroup = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (dialog), accelGroup);
-
   vboxEncrypt = GTK_DIALOG (dialog)->vbox;
   gtk_container_set_border_width (GTK_CONTAINER (vboxEncrypt), 5);
 
-  labelKeys = gtk_label_new ("");
+  labelKeys = gtk_label_new_with_mnemonic (_("_Public Keys"));
   gtk_misc_set_alignment (GTK_MISC (labelKeys), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (vboxEncrypt), labelKeys, FALSE, FALSE, 0);
 
@@ -172,8 +168,7 @@
 		    dialog);
   dialog->clist_keys = clistKeys;
   gtk_container_add (GTK_CONTAINER (scrollerKeys), clistKeys);
-  gpa_connect_by_accelerator (GTK_LABEL (labelKeys), clistKeys, accelGroup,
-			      _("_Public Keys"));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelKeys), clistKeys);
 
  
   checkerSign = gtk_check_button_new_with_mnemonic (_("_Sign"));
@@ -182,8 +177,7 @@
   gtk_signal_connect (GTK_OBJECT (checkerSign), "toggled",
 		      GTK_SIGNAL_FUNC (toggle_sign_cb), dialog);
 
-  labelWho = gtk_label_new (NULL);
-  gtk_misc_set_alignment (GTK_MISC (labelWho), 0.0, 0.5);
+  labelWho = gtk_label_new_with_mnemonic (_("Sign _as "));
   gtk_box_pack_start (GTK_BOX (vboxEncrypt), labelWho, FALSE, TRUE, 0);
 
   scrollerWho = gtk_scrolled_window_new (NULL, NULL);
@@ -198,8 +192,8 @@
   clistWho = gpa_key_selector_new (TRUE);
   dialog->clist_who = clistWho;
   gtk_container_add (GTK_CONTAINER (scrollerWho), clistWho);
-  gpa_connect_by_accelerator (GTK_LABEL (labelWho), clistWho, accelGroup,
-			      _("Sign _as "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelWho), clistWho);
+
   /* FIXME: We can't make the key selector insensitive, as it will
      make itself sensitive again automatically after the keyloading.
      So we make the whole scroller insensitive.  This is a bit

Modified: trunk/src/filesigndlg.c
===================================================================
--- trunk/src/filesigndlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/filesigndlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -107,7 +107,6 @@
 {
   GObject *object;
   GpaFileSignDialog *dialog;
-  GtkAccelGroup *accelGroup;
   GtkWidget *vboxSign;
   GtkWidget *frameMode;
   GtkWidget *vboxMode;
@@ -135,9 +134,6 @@
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
 
-  accelGroup = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (dialog), accelGroup);
-
   vboxSign = GTK_DIALOG (dialog)->vbox;
   gtk_container_set_border_width (GTK_CONTAINER (vboxSign), 5);
 
@@ -169,7 +165,7 @@
   gtk_container_set_border_width (GTK_CONTAINER (vboxWho), 5);
   gtk_box_pack_start (GTK_BOX (vboxSign), vboxWho, TRUE, TRUE, 0);
 
-  labelWho = gtk_label_new ("");
+  labelWho = gtk_label_new_with_mnemonic (_("Sign _as "));
   gtk_misc_set_alignment (GTK_MISC (labelWho), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (vboxWho), labelWho, FALSE, TRUE, 0);
 
@@ -182,8 +178,8 @@
   clistWho = gpa_key_selector_new (TRUE);
   dialog->clist_who = clistWho;
   gtk_container_add (GTK_CONTAINER (scrollerWho), clistWho);
-  gpa_connect_by_accelerator (GTK_LABEL (labelWho), clistWho, accelGroup,
-			      _("Sign _as "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelWho), clistWho);
+			      
 
   checkerArmor = gtk_check_button_new_with_mnemonic (_("A_rmor"));
   gtk_container_set_border_width (GTK_CONTAINER (checkerArmor), 5);

Modified: trunk/src/gparecvkeydlg.c
===================================================================
--- trunk/src/gparecvkeydlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/gparecvkeydlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -1,34 +1,38 @@
 /* gparecvkeydlg.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) 2008 g10 Code GmbH
 
-#include <config.h>
+   This file is part of GPA.
 
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
+   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/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <string.h>
 #include <errno.h>
+
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+
 #include "gpa.h"
 #include "gparecvkeydlg.h"
 #include "gtktools.h"
 
-/* Properties */
+
+/* Properties.  */
 enum
 {
   PROP_0,
@@ -38,10 +42,8 @@
 static GObjectClass *parent_class = NULL;
 
 static void
-gpa_receive_key_dialog_get_property (GObject     *object,
-				      guint        prop_id,
-				      GValue      *value,
-				      GParamSpec  *pspec)
+gpa_receive_key_dialog_get_property (GObject *object, guint prop_id,
+				     GValue *value, GParamSpec *pspec)
 {
   GpaReceiveKeyDialog *dialog = GPA_RECEIVE_KEY_DIALOG (object);
   
@@ -57,11 +59,10 @@
     }
 }
 
+
 static void
-gpa_receive_key_dialog_set_property (GObject     *object,
-				   guint        prop_id,
-				   const GValue      *value,
-				   GParamSpec  *pspec)
+gpa_receive_key_dialog_set_property (GObject *object, guint prop_id,
+				     const GValue *value, GParamSpec *pspec)
 {
   GpaReceiveKeyDialog *dialog = GPA_RECEIVE_KEY_DIALOG (object);
 
@@ -77,6 +78,7 @@
     }
 }
 
+
 static void
 gpa_receive_key_dialog_finalize (GObject *object)
 {
@@ -87,8 +89,8 @@
 static void
 gpa_receive_key_dialog_init (GpaReceiveKeyDialog *dialog)
 {
-  GtkWidget *label, *hbox;
-  GtkAccelGroup *accel_group;
+  GtkWidget *label;
+  GtkWidget *hbox;
 
   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
 			  GTK_STOCK_OK,
@@ -104,20 +106,18 @@
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE,
 		      TRUE, 5);
 
-  accel_group = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (dialog), accel_group);
-
   dialog->entry = gtk_entry_new ();
   hbox = gtk_hbox_new (0, FALSE);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, 
 		      TRUE, 5);
-  label = gtk_label_new ("");
-  gpa_connect_by_accelerator (GTK_LABEL (label), dialog->entry, accel_group,
-			      _("Key _ID:"));
+  label = gtk_label_new_with_mnemonic (_("Key _ID:"));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->entry);
+
   gtk_box_pack_start_defaults (GTK_BOX (hbox), label);
   gtk_box_pack_start_defaults (GTK_BOX (hbox), dialog->entry);
 }
 
+
 static void
 gpa_receive_key_dialog_class_init (GpaReceiveKeyDialogClass *klass)
 {
@@ -138,6 +138,7 @@
 				    G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
 }
 
+
 GType
 gpa_receive_key_dialog_get_type (void)
 {
@@ -168,8 +169,7 @@
 
 /* API */
 
-/* Create a new receive key dialog.
- */
+/* Create a new receive key dialog.  */
 GtkWidget*
 gpa_receive_key_dialog_new (GtkWidget *parent)
 {
@@ -181,8 +181,7 @@
   return GTK_WIDGET(dialog);
 }
 
-/* Retrieve the selected key ID.
- */
+/* Retrieve the selected key ID.  */
 const gchar*
 gpa_receive_key_dialog_get_id (GpaReceiveKeyDialog *dialog)
 {

Modified: trunk/src/gtktools.c
===================================================================
--- trunk/src/gtktools.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/gtktools.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -67,18 +67,6 @@
 
 
 void
-gpa_connect_by_accelerator (GtkLabel * label, GtkWidget * widget,
-			    GtkAccelGroup * accelGroup, gchar * labelText)
-{
-  guint accelKey;
-
-  accelKey = gtk_label_parse_uline (label, labelText);
-  gtk_widget_add_accelerator (widget, "grab_focus", accelGroup, accelKey,
-			      GDK_MOD1_MASK, 0);
-}
-
-
-void
 gpa_window_error (const gchar *message, GtkWidget *messenger)
 {
   GtkWidget *windowError;

Modified: trunk/src/gtktools.h
===================================================================
--- trunk/src/gtktools.h	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/gtktools.h	2008-04-03 01:43:04 UTC (rev 868)
@@ -23,9 +23,6 @@
 
 #include <gtk/gtk.h>
 
-extern void gpa_connect_by_accelerator (GtkLabel * label, GtkWidget * widget,
-					GtkAccelGroup * accelGroup,
-					gchar * labelText);
 extern void gpa_window_show_centered (GtkWidget * widget, GtkWidget * parent);
 extern void gpa_window_error (const gchar * message, GtkWidget * messenger);
 extern void gpa_window_message (gchar * message, GtkWidget * messenger);

Modified: trunk/src/keygendlg.c
===================================================================
--- trunk/src/keygendlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/keygendlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -1,26 +1,28 @@
-/* keygendlg.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
- */
+/* keygendlg.c - The GNU Privacy Assistant
+   Copyright (C) 2000, 2001 G-N-U GmbH.
+   Copyright (C) 2008 g10 Code GmbH
 
-#include <config.h>
+   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/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <gtk/gtk.h>
+
 #include "gpa.h"
 #include "gpapastrings.h"
 #include "gpawidgets.h"
@@ -28,91 +30,98 @@
 #include "keygendlg.h"
 #include "qdchkpwd.h"
 
-#define	XSTRDUP_OR_NULL(s)	((s != NULL) ? g_strdup(s): NULL)
+#define	XSTRDUP_OR_NULL(s)	((s != NULL) ? g_strdup (s) : NULL)
 
-struct _GPAKeyGenDialog {
-  GtkWidget * window;
-  GtkWidget * entryUserID;
-  GtkWidget * entryPasswd;
-  GtkWidget * entryRepeat;
-  GtkWidget * frameExpire;
+struct _GPAKeyGenDialog
+{
+  GtkWidget *window;
+  GtkWidget *entryUserID;
+  GtkWidget *entryPasswd;
+  GtkWidget *entryRepeat;
+  GtkWidget *frameExpire;
+  GtkWidget *comboKeysize;
 };
 typedef struct _GPAKeyGenDialog GPAKeyGenDialog;
 
-/* This callback gets called each time the user clicks on the [OK] or [Cancel]
- * buttons. If the button was [OK], it verifies that the input makes sense.
- */
+
+/* This callback gets called each time the user clicks on the [OK] or
+   [Cancel] buttons.  If the button was [OK], it verifies that the
+   input makes sense.  */
 static void
-response_cb(GtkDialog *dlg, gint response, gpointer param)
+response_cb (GtkDialog *dlg, gint response, gpointer param)
 {
-  GPAKeyGenDialog * dialog = param;
-  gchar * expiry_error;
+  GPAKeyGenDialog *dialog = param;
+  gchar *expiry_error;
   const gchar *userid = gtk_entry_get_text (GTK_ENTRY (dialog->entryUserID));
   const gchar *passwd = gtk_entry_get_text (GTK_ENTRY (dialog->entryPasswd));
   const gchar *repeat = gtk_entry_get_text (GTK_ENTRY (dialog->entryRepeat));
+  const gchar *keysize
+    = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->comboKeysize));
 
-  if (response == GTK_RESPONSE_OK)
-    { 
-      if (! *userid)
-        {
-          gpa_window_error (_("You must enter a User ID."), dialog->window);
-          g_signal_stop_emission_by_name (dlg, "response");
-        }
-      else if (!g_str_equal (passwd, repeat))
-        {
-          gpa_window_error (_("In \"Passphrase\" and \"Repeat passphrase\",\n"
-                              "you must enter the same passphrase."),
-                            dialog->window);
-          g_signal_stop_emission_by_name (dlg, "response");
-        }
-      else if (strlen (passwd) == 0)
-        {
-          gpa_window_error (_("You did not enter a passphrase.\n"
-                              "It is needed to protect your private key."),
-                            dialog->window);
-          g_signal_stop_emission_by_name (dlg, "response");
-        }
-      else if (strlen (passwd) < 10 || qdchkpwd (passwd) < 0.6)
-        {
-          GtkWidget *msgbox;
-          
-          msgbox = gtk_message_dialog_new (GTK_WINDOW (dialog->window),
-                                           GTK_DIALOG_MODAL,
-                                           GTK_MESSAGE_WARNING,
-                                           GTK_BUTTONS_NONE,
-                                           _("Warning: You have entered a "
-                                             "passphrase\n"
-                                             "that is obviously not secure.\n\n"
-                                             "Please enter a new passphrase."));
-          gtk_dialog_add_buttons (GTK_DIALOG (msgbox), 
-                                  _("_Enter new passphrase"), GTK_RESPONSE_CANCEL,
-                                  _("Take this one _anyway"), GTK_RESPONSE_OK,
-                                  NULL);
-          if (gtk_dialog_run (GTK_DIALOG (msgbox)) == GTK_RESPONSE_CANCEL)
-            {
-              g_signal_stop_emission_by_name (dlg, "response");
-            }
-          gtk_widget_destroy (msgbox);
-        }
-      else if ((expiry_error = gpa_expiry_frame_validate (dialog->frameExpire)))
-        {
-          g_signal_stop_emission_by_name (dlg, "response");
-          gpa_window_error (expiry_error, dialog->window);
-        }
+  if (response != GTK_RESPONSE_OK)
+    return;
+
+  if (keysize == NULL || *keysize == '\0')
+    {
+      /* FIXME: We should check it is a valid number.  */
+      gpa_window_error (_("You must enter a key size."), dialog->window);
+      g_signal_stop_emission_by_name (dlg, "response");
+    }      
+  else if (! *userid)
+    {
+      gpa_window_error (_("You must enter a User ID."), dialog->window);
+      g_signal_stop_emission_by_name (dlg, "response");
     }
+  else if (!g_str_equal (passwd, repeat))
+    {
+      gpa_window_error (_("In \"Passphrase\" and \"Repeat passphrase\",\n"
+			  "you must enter the same passphrase."),
+			dialog->window);
+      g_signal_stop_emission_by_name (dlg, "response");
+    }
+  else if (strlen (passwd) == 0)
+    {
+      gpa_window_error (_("You did not enter a passphrase.\n"
+			  "It is needed to protect your private key."),
+			dialog->window);
+      g_signal_stop_emission_by_name (dlg, "response");
+    }
+  else if (strlen (passwd) < 10 || qdchkpwd (passwd) < 0.6)
+    {
+      GtkWidget *msgbox;
+      
+      msgbox = gtk_message_dialog_new (GTK_WINDOW (dialog->window),
+				       GTK_DIALOG_MODAL,
+				       GTK_MESSAGE_WARNING,
+				       GTK_BUTTONS_NONE,
+				       _("Warning: You have entered a "
+					 "passphrase\n"
+					 "that is obviously not secure.\n\n"
+					 "Please enter a new passphrase."));
+      gtk_dialog_add_buttons (GTK_DIALOG (msgbox), 
+			      _("_Enter new passphrase"),
+			      GTK_RESPONSE_CANCEL,
+			      _("Take this one _anyway"), GTK_RESPONSE_OK,
+			      NULL);
+      if (gtk_dialog_run (GTK_DIALOG (msgbox)) == GTK_RESPONSE_CANCEL)
+	g_signal_stop_emission_by_name (dlg, "response");
+      gtk_widget_destroy (msgbox);
+    }
+  else if ((expiry_error = gpa_expiry_frame_validate (dialog->frameExpire)))
+    {
+      g_signal_stop_emission_by_name (dlg, "response");
+      gpa_window_error (expiry_error, dialog->window);
+    }
 }
 
 
-/* Run the "Generate Key" dialog and if the user presses OK, return the
- * values from the dialog in a newly allocated GPAKeyGenParameters struct.
- * If the user pressed "Cancel", return NULL
- *
- * The returned struct has to be deleted with gpa_key_gen_free_parameters.
- */
+/* Run the "Generate Key" dialog and if the user presses OK, return
+   the values from the dialog in a newly allocated GPAKeyGenParameters
+   struct.  If the user pressed "Cancel", return NULL.  The returned
+   struct has to be deleted with gpa_key_gen_free_parameters.  */
 GPAKeyGenParameters *
-gpa_key_gen_run_dialog (GtkWidget * parent)
+gpa_key_gen_run_dialog (GtkWidget *parent)
 {
-  GtkAccelGroup *accelGroup;
   GtkWidget *windowGenerate;
   GtkWidget *vboxGenerate;
   GtkWidget *table;
@@ -135,12 +144,8 @@
   GPAKeyGenDialog dialog;
   GPAKeyGenParameters * params = NULL;
 
-  GList *contentsAlgorithm = NULL;
   GPAKeyGenAlgo algo;
-  GList *contentsKeysize = NULL;
 
-  accelGroup = gtk_accel_group_new ();
-
   windowGenerate = gtk_dialog_new_with_buttons (_("Generate key"),
                                                 GTK_WINDOW (parent),
                                                 GTK_DIALOG_MODAL,
@@ -152,112 +157,99 @@
   gtk_dialog_set_default_response (GTK_DIALOG (windowGenerate),
                                    GTK_RESPONSE_OK);
   dialog.window = windowGenerate;
-  gtk_window_add_accel_group (GTK_WINDOW (windowGenerate), accelGroup);
-  /* use gtk_signal_connect_object here to make the dialog pointer the
-   * first parameter of the handler */
-  g_signal_connect (G_OBJECT (windowGenerate), "delete-event",
-                    G_CALLBACK (gtk_widget_destroy), &dialog);
+
+  /* Use gtk_signal_connect_object here to make the dialog pointer the
+     first parameter of the handler.  */
+  //  g_signal_connect (G_OBJECT (windowGenerate), "delete-event",
+  //  		    G_CALLBACK (gtk_widget_destroy), dialog.window);
   g_signal_connect (G_OBJECT (windowGenerate), "response",
-                    G_CALLBACK(response_cb), &dialog);
+                    G_CALLBACK (response_cb), &dialog);
 
   vboxGenerate = GTK_DIALOG(dialog.window)->vbox;
-  gtk_container_add (GTK_CONTAINER (windowGenerate), vboxGenerate);
   gtk_container_set_border_width (GTK_CONTAINER (vboxGenerate), 5);
 
   table = gtk_table_new (7, 2, FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (table), 5);
   gtk_box_pack_start (GTK_BOX (vboxGenerate), table, FALSE, FALSE, 0);
 
-  labelAlgorithm = gtk_label_new ("");
+  labelAlgorithm = gtk_label_new_with_mnemonic (_("_Algorithm: "));
   gtk_misc_set_alignment (GTK_MISC (labelAlgorithm), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelAlgorithm, 0, 1, 0, 1,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
-  comboAlgorithm = gtk_combo_new ();
-  gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (comboAlgorithm)->entry),
-			     FALSE);
+  comboAlgorithm = gtk_combo_box_new_text ();
+
   for (algo = GPA_KEYGEN_ALGO_FIRST; algo <= GPA_KEYGEN_ALGO_LAST; algo++)
-    contentsAlgorithm = g_list_append (contentsAlgorithm,
-				       (gchar*) gpa_algorithm_string(algo));
-  gtk_combo_set_popdown_strings (GTK_COMBO (comboAlgorithm),
-				 contentsAlgorithm);
-  gpa_connect_by_accelerator (GTK_LABEL (labelAlgorithm),
-			      GTK_COMBO (comboAlgorithm)->entry, accelGroup,
-			      _("_Algorithm: "));
+    gtk_combo_box_append_text (GTK_COMBO_BOX (comboAlgorithm), 
+				 gpa_algorithm_string (algo));
+  gtk_combo_box_set_active (GTK_COMBO_BOX (comboAlgorithm), 0);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelAlgorithm), comboAlgorithm);
+			      
   gtk_table_attach (GTK_TABLE (table), comboAlgorithm, 1, 2, 0, 1,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
 
-  labelKeysize = gtk_label_new ("");
+  labelKeysize = gtk_label_new_with_mnemonic (_("_Key size (bits): "));
   gtk_misc_set_alignment (GTK_MISC (labelKeysize), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelKeysize, 0, 1, 1, 2,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
-  comboKeysize = gtk_combo_new ();
-  gtk_combo_set_value_in_list (GTK_COMBO (comboKeysize), FALSE, FALSE);
-  gpa_connect_by_accelerator (GTK_LABEL (labelKeysize),
-			      GTK_COMBO (comboKeysize)->entry, accelGroup,
-			      _("_Key size (bits): "));
-  contentsKeysize = g_list_append (contentsKeysize, _("768"));
-  contentsKeysize = g_list_append (contentsKeysize, _("1024"));
-  contentsKeysize = g_list_append (contentsKeysize, _("2048"));
-  gtk_combo_set_popdown_strings (GTK_COMBO (comboKeysize), contentsKeysize);
-  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (comboKeysize)->entry), "1024");
+  comboKeysize = gtk_combo_box_entry_new_text ();
+  dialog.comboKeysize = comboKeysize;
+  gtk_combo_box_append_text (GTK_COMBO_BOX (comboKeysize), _("768"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (comboKeysize), _("1024"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (comboKeysize), _("2048"));
+  gtk_combo_box_set_active (GTK_COMBO_BOX (comboKeysize), 1 /* 1024 */);
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelKeysize), comboKeysize);
   gtk_table_attach (GTK_TABLE (table), comboKeysize, 1, 2, 1, 2,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
-  /* FIXME: In the above we should either translate all key sizes
-   * (including the one in the gtk_entry_set_text call) or generate all
-   * strings via sprintf or a similar locale aware function */
 
-  labelUserID = gtk_label_new ("");
+  labelUserID = gtk_label_new_with_mnemonic (_("_User ID: "));
   gtk_misc_set_alignment (GTK_MISC (labelUserID), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelUserID, 0, 1, 2, 3,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
   entryUserID = gtk_entry_new ();
   dialog.entryUserID = entryUserID;
-  gpa_connect_by_accelerator (GTK_LABEL (labelUserID), entryUserID,
-			      accelGroup, _("_User ID: "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelUserID), entryUserID);
+
   gtk_table_attach (GTK_TABLE (table), entryUserID, 1, 2, 2, 3, GTK_FILL,
 		    GTK_SHRINK, 0, 0);
 
-  labelEmail = gtk_label_new ("");
+  labelEmail = gtk_label_new_with_mnemonic (_("_Email: "));
   gtk_misc_set_alignment (GTK_MISC (labelEmail), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelEmail, 0, 1, 3, 4,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
   entryEmail = gtk_entry_new ();
-  gpa_connect_by_accelerator (GTK_LABEL (labelEmail), entryEmail, accelGroup,
-			      _("_Email: "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelEmail), entryEmail);
   gtk_table_attach (GTK_TABLE (table), entryEmail, 1, 2, 3, 4, GTK_FILL,
 		    GTK_SHRINK, 0, 0);
 
-  labelComment = gtk_label_new ("");
+  labelComment = gtk_label_new_with_mnemonic (_("_Comment: "));
   gtk_misc_set_alignment (GTK_MISC (labelComment), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelComment, 0, 1, 4, 5,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
   entryComment = gtk_entry_new ();
-  gpa_connect_by_accelerator (GTK_LABEL (labelComment), entryComment,
-			      accelGroup, _("_Comment: "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelComment), entryComment);
   gtk_table_attach (GTK_TABLE (table), entryComment, 1, 2, 4, 5, GTK_FILL,
 		    GTK_SHRINK, 0, 0);
 
-  labelPasswd = gtk_label_new ("");
+  labelPasswd = gtk_label_new_with_mnemonic (_("_Passphrase: "));
   gtk_misc_set_alignment (GTK_MISC (labelPasswd), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelPasswd, 0, 1, 5, 6,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
   entryPasswd = gtk_entry_new ();
   dialog.entryPasswd = entryPasswd;
   gtk_entry_set_visibility (GTK_ENTRY (entryPasswd), FALSE);
-  gpa_connect_by_accelerator (GTK_LABEL (labelPasswd), entryPasswd,
-			      accelGroup, _("_Passphrase: "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelPasswd), entryPasswd);
   gtk_table_attach (GTK_TABLE (table), entryPasswd, 1, 2, 5, 6, GTK_FILL,
 		    GTK_SHRINK, 0, 0);
 
-  labelRepeat = gtk_label_new ("");
+  labelRepeat = gtk_label_new_with_mnemonic (_("_Repeat passphrase: "));
   gtk_misc_set_alignment (GTK_MISC (labelRepeat), 1.0, 0.5);
   gtk_table_attach (GTK_TABLE (table), labelRepeat, 0, 1, 6, 7,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
   entryRepeat = gtk_entry_new ();
   dialog.entryRepeat = entryRepeat;
   gtk_entry_set_visibility (GTK_ENTRY (entryRepeat), FALSE);
-  gpa_connect_by_accelerator (GTK_LABEL (labelRepeat), entryRepeat,
-			      accelGroup, _("_Repeat passphrase: "));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelRepeat), entryRepeat);
+
   gtk_table_attach (GTK_TABLE (table), entryRepeat, 1, 2, 6, 7,
 		    GTK_FILL, GTK_SHRINK, 0, 0);
 
@@ -268,43 +260,43 @@
 
   gtk_widget_show_all (windowGenerate);
   if (gtk_dialog_run (GTK_DIALOG (windowGenerate)) == GTK_RESPONSE_OK)
-  {
-      /* the user pressed OK, so create a GPAKeyGenParameters struct and
-       * fill it with the values from the dialog
-       */
-      gchar * temp;
+    {
+      /* The user pressed OK, so create a GPAKeyGenParameters struct
+	 and fill it with the values from the dialog.  */
+      gchar *temp;
 
       params = key_gen_params_new ();
-      params->userID = XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY (entryUserID)));
-      params->email = XSTRDUP_OR_NULL(gtk_entry_get_text (GTK_ENTRY (entryEmail)));
-      params->comment = XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY(entryComment)));
+      params->userID
+	= XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY (entryUserID)));
+      params->email
+	= XSTRDUP_OR_NULL(gtk_entry_get_text (GTK_ENTRY (entryEmail)));
+      params->comment
+	= XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY(entryComment)));
+      params->password
+	= XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY(entryPasswd)));
 
-      params->password = XSTRDUP_OR_NULL (gtk_entry_get_text (GTK_ENTRY(entryPasswd)));
-	  
-      temp = (gchar *) gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(comboAlgorithm)->entry));
+      temp = gtk_combo_box_get_active_text (GTK_COMBO_BOX (comboAlgorithm));
       params->algo = gpa_algorithm_from_string (temp);
-      temp = (gchar *) gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (comboKeysize)->entry));
+      temp = gtk_combo_box_get_active_text (GTK_COMBO_BOX (comboKeysize));
       params->keysize = atoi (temp);
 
       params->expiryDate = NULL;
       params->interval = 0;
-      if (!gpa_expiry_frame_get_expiration (frameExpire, &(params->expiryDate),
-					    &(params->interval),
-					    &(params->unit)))
-      {
+      if (! gpa_expiry_frame_get_expiration (frameExpire, &(params->expiryDate),
+					     &(params->interval),
+					     &(params->unit)))
+	{
 	  gpa_window_error (_("!FATAL ERROR!\n"
 			      "Invalid insert mode for expiry date."),
 			    parent);
 	  gpa_key_gen_free_parameters(params);
 	  params = NULL;
-      }
-  }
+	}
+    }
   else
-  {
-      params = NULL;
-  }
+    params = NULL;
 
   gtk_widget_destroy (windowGenerate);
 
   return params;
-} /* gpa_key_gen_run_dialog */
+}

Modified: trunk/src/keyimpseldlg.c
===================================================================
--- trunk/src/keyimpseldlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/keyimpseldlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -84,15 +84,14 @@
   gtk_main_quit ();
 }
 
+
 /* Run the key import selection dialog and import the selected keys
- * from the given keyserver.
- */
+   from the given keyserver.  */
 void
 gpa_key_import_selection_dialog_run (GtkWidget *parent,
                                      GList *keys, const gchar *keyserver)
 {
   GPAKeyImportSelectionDialog dialog;
-  GtkAccelGroup *accelGroup;
   GtkWidget *windowSelect;
   GtkWidget *vboxSelect;
   GtkWidget *vboxWhich;
@@ -120,9 +119,6 @@
   gtk_signal_connect (GTK_OBJECT (windowSelect), "destroy",
 		      GTK_SIGNAL_FUNC (key_import_selection_destroy), NULL);
 
-  accelGroup = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (windowSelect), accelGroup);
-
   vboxSelect = gtk_vbox_new (FALSE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (vboxSelect), 5);
 
@@ -130,7 +126,7 @@
   gtk_container_set_border_width (GTK_CONTAINER (vboxWhich), 5);
   gtk_box_pack_start (GTK_BOX (vboxSelect), vboxWhich, TRUE, TRUE, 0);
 
-  labelWhich = gtk_label_new ("");
+  labelWhich = gtk_label_new_with_mnemonic (_("_Import"));
   gtk_misc_set_alignment (GTK_MISC (labelWhich), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (vboxWhich), labelWhich, FALSE, TRUE, 0);
 
@@ -141,8 +137,7 @@
   clistWhich = gpa_key_list_new_from_glist (parent, dialog.keys);
   dialog.clist_which = GTK_CLIST (clistWhich);
   gtk_container_add (GTK_CONTAINER (scrollerWhich), clistWhich);
-  gpa_connect_by_accelerator (GTK_LABEL (labelWhich), clistWhich, accelGroup,
-			      _("_Import"));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelWhich), clistWhich);
 
   hButtonBoxSelect = gtk_hbutton_box_new ();
   gtk_box_pack_start (GTK_BOX (vboxSelect), hButtonBoxSelect, FALSE, FALSE, 0);
@@ -161,8 +156,6 @@
   buttonCancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
   gtk_signal_connect (GTK_OBJECT (button), "clicked",
 		      key_import_selection_cancel, &dialog);
-  gtk_widget_add_accelerator (buttonCancel, "clicked", accelGroup, GDK_Escape,
-                              0, 0);
   gtk_container_add (GTK_CONTAINER (hButtonBoxSelect), buttonCancel);
 
   gtk_container_add (GTK_CONTAINER (windowSelect), vboxSelect);

Modified: trunk/src/keyring.c
===================================================================
--- trunk/src/keyring.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/keyring.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -1662,8 +1662,6 @@
 keyring_editor_new (void)
 {
   GPAKeyringEditor *editor;
-  GtkAccelGroup *accel_group;
-
   GtkWidget *window;
   GtkWidget *vbox;
   GtkWidget *label;
@@ -1689,8 +1687,6 @@
   gtk_object_set_data_full (GTK_OBJECT (window), "user_data", editor,
                             keyring_editor_destroy);
   gtk_window_set_default_size (GTK_WINDOW (window), 680, 600);
-  accel_group = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
   gtk_signal_connect_object (GTK_OBJECT (window), "map",
                              GTK_SIGNAL_FUNC (keyring_editor_mapped),
                              (gpointer) editor);

Modified: trunk/src/recipientdlg.c
===================================================================
--- trunk/src/recipientdlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/recipientdlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -1,24 +1,27 @@
 /* recipientdlg.c - A dialog to select a mail recipient.
- * Copyright (C) 2008 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/>.
- */
+   Copyright (C) 2008 g10 Code GmbH.
 
-#include <config.h>
+   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/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
 #include "gpa.h"
 #include "i18n.h"
 
@@ -40,11 +43,11 @@
   GtkWidget *popup_menu;
 
   /* Flag to disable updates of the status hint.  This is actual a
-     counter with updates only allowed if it is zero. */
+     counter with updates only allowed if it is zero.  */
   int freeze_update_statushint;
 
   /* Flag to disable any key selection.  This is used while a key
-     selection is active.  Implemented as a counter. */
+     selection is active.  Implemented as a counter.  */
   int freeze_key_selection;
 
   /* Set if this dialog has usable key to be passed back to the
@@ -893,7 +896,6 @@
 {
   GObject *object;
   RecipientDlg *dialog;
-  GtkAccelGroup *accel_group;
   GtkWidget *vbox;
   GtkWidget *hbox;
   GtkWidget *widget;
@@ -917,13 +919,10 @@
 				     FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
 
-  accel_group = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (dialog), accel_group);
-
   vbox = GTK_DIALOG (dialog)->vbox;
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
 
-  labelKeys = gtk_label_new ("");
+  labelKeys = gtk_label_new_with_mnemonic (_("_Recipient list"));
   gtk_misc_set_alignment (GTK_MISC (labelKeys), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (vbox), labelKeys, FALSE, FALSE, 0);
 
@@ -937,8 +936,8 @@
   clistKeys = recplist_window_new ();
   dialog->clist_keys = clistKeys;
   gtk_container_add (GTK_CONTAINER (scrollerKeys), clistKeys);
-  gpa_connect_by_accelerator (GTK_LABEL (labelKeys), clistKeys, accel_group,
-			      _("_Recipient list"));
+  gtk_label_set_mnemonic_widget (GTK_LABEL (labelKeys), clistKeys);
+			      
 
   dialog->popup_menu = recplist_popup_menu_new (dialog->clist_keys, dialog);
   g_signal_connect_swapped (GTK_OBJECT (dialog->clist_keys),

Modified: trunk/src/selectkeydlg.c
===================================================================
--- trunk/src/selectkeydlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/selectkeydlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -168,7 +168,6 @@
 {
   GObject *object;
   SelectKeyDlg *dialog;
-  GtkAccelGroup *accel_group;
   GtkWidget *vbox;
   GtkWidget *scroller;
 
@@ -188,9 +187,6 @@
 				     FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
 
-  accel_group = gtk_accel_group_new ();
-  gtk_window_add_accel_group (GTK_WINDOW (dialog), accel_group);
-
   vbox = GTK_DIALOG (dialog)->vbox;
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
 

Modified: trunk/src/settingsdlg.c
===================================================================
--- trunk/src/settingsdlg.c	2008-04-02 20:02:00 UTC (rev 867)
+++ trunk/src/settingsdlg.c	2008-04-03 01:43:04 UTC (rev 868)
@@ -85,26 +85,42 @@
 
 /* Default keyserver section.  */
 static void
-keyserver_selected_cb (GtkWidget *entry, gpointer user_data)
+keyserver_selected_cb (GtkWidget *combo, gpointer user_data)
 {
-  gpa_options_set_default_keyserver (gpa_options_get_instance (),
-                                     gtk_entry_get_text (GTK_ENTRY (entry)));
+  gchar *text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
+
+  if (text != NULL && *text != '\0')
+    gpa_options_set_default_keyserver (gpa_options_get_instance (), text);
 }
 
 
 static void
-selected_from_list_cb (GtkList *list, GtkWidget *widget, GtkWidget *entry)
+selected_from_list_cb (GtkComboBox *combo, gpointer user_data)
 {
   /* Consider the text entry activated.  */
-  keyserver_selected_cb (entry, NULL);
+  if (gtk_combo_box_get_active (combo) != -1)
+    keyserver_selected_cb (GTK_WIDGET (combo), NULL);
 }
 
 
+static void
+append_to_combo (gpointer item, gpointer data)
+{
+  GtkWidget *combo = data;
+  gchar *text = item;
+
+  gtk_combo_box_append_text (GTK_COMBO_BOX (combo), text);
+}
+
+
 static GtkWidget *
 default_keyserver_frame (void)
 {
-  GtkWidget *frame, *label, *combo;
-  
+  GtkWidget *frame;
+  GtkWidget *label;
+  GtkWidget *combo;
+  GList *servers;
+
   /* Build UI */
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
@@ -112,21 +128,22 @@
   gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
   gtk_frame_set_label_widget (GTK_FRAME (frame), label);
 
-  combo = gtk_combo_new ();
-  gtk_combo_set_value_in_list (GTK_COMBO (combo), FALSE, FALSE);
+  combo = gtk_combo_box_entry_new_text ();
   gtk_container_set_border_width (GTK_CONTAINER (combo), 5);
   gtk_container_add (GTK_CONTAINER (frame), combo);
-  /* Set current value */
-  gtk_combo_set_popdown_strings (GTK_COMBO (combo), keyserver_get_as_glist ());
-  gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry),
-                      gpa_options_get_default_keyserver 
+  /* Set current value.  */
+  servers = keyserver_get_as_glist ();
+  g_list_foreach (servers, append_to_combo, combo);
+  g_list_free (servers);
+  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
+                      gpa_options_get_default_keyserver
 		      (gpa_options_get_instance ()));
   /* Connect signals.  Try to follow instant-apply principle.  */
-  g_signal_connect (G_OBJECT (GTK_COMBO (combo)->entry), "focus-out-event",
-                    G_CALLBACK (keyserver_selected_cb), NULL);
-  g_signal_connect (G_OBJECT (GTK_COMBO (combo)->list), "select-child",
-                    G_CALLBACK (selected_from_list_cb),
-                    GTK_COMBO (combo)->entry);
+  g_signal_connect_swapped (G_OBJECT (gtk_bin_get_child (GTK_BIN (combo))),
+			    "focus-out-event",
+			    G_CALLBACK (keyserver_selected_cb), combo);
+  g_signal_connect (G_OBJECT (combo),
+		    "changed", G_CALLBACK (selected_from_list_cb), NULL);
 
 
   return frame;



More information about the Gpa-commits mailing list