[seahorse] gpgme: Port GpgmeGenerate to GtkTemplate
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] gpgme: Port GpgmeGenerate to GtkTemplate
- Date: Fri, 14 Feb 2020 17:28:27 +0000 (UTC)
commit a840410f04fe08345145219b5b2012774e496f62
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri Feb 14 18:27:45 2020 +0100
gpgme: Port GpgmeGenerate to GtkTemplate
data/seahorse.gresource.xml | 2 +-
pgp/meson.build | 2 +-
pgp/seahorse-gpgme-generate-dialog.c | 395 ++++++++++++++++++
pgp/seahorse-gpgme-generate-dialog.h | 34 ++
...nerate.ui => seahorse-gpgme-generate-dialog.ui} | 42 +-
pgp/seahorse-gpgme-generate.c | 452 ---------------------
pgp/seahorse-pgp-actions.c | 10 +-
po/POTFILES.in | 4 +-
8 files changed, 459 insertions(+), 482 deletions(-)
---
diff --git a/data/seahorse.gresource.xml b/data/seahorse.gresource.xml
index 15b7f746..576f1026 100644
--- a/data/seahorse.gresource.xml
+++ b/data/seahorse.gresource.xml
@@ -30,11 +30,11 @@
<file alias="seahorse-expires.ui" preprocess="xml-stripblanks">../pgp/seahorse-expires.ui</file>
<file alias="seahorse-gpgme-add-subkey.ui"
preprocess="xml-stripblanks">../pgp/seahorse-gpgme-add-subkey.ui</file>
<file alias="seahorse-gpgme-add-uid.ui"
preprocess="xml-stripblanks">../pgp/seahorse-gpgme-add-uid.ui</file>
+ <file alias="seahorse-gpgme-generate-dialog.ui"
preprocess="xml-stripblanks">../pgp/seahorse-gpgme-generate-dialog.ui</file>
<file alias="seahorse-gpgme-sign-dialog.ui"
preprocess="xml-stripblanks">../pgp/seahorse-gpgme-sign-dialog.ui</file>
<file alias="seahorse-keyserver-results.ui"
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-results.ui</file>
<file alias="seahorse-keyserver-search.ui"
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-search.ui</file>
<file alias="seahorse-keyserver-sync.ui"
preprocess="xml-stripblanks">../pgp/seahorse-keyserver-sync.ui</file>
- <file alias="seahorse-pgp-generate.ui"
preprocess="xml-stripblanks">../pgp/seahorse-pgp-generate.ui</file>
<file alias="seahorse-pgp-private-key-properties.ui"
preprocess="xml-stripblanks">../pgp/seahorse-pgp-private-key-properties.ui</file>
<file alias="seahorse-pgp-public-key-properties.ui"
preprocess="xml-stripblanks">../pgp/seahorse-pgp-public-key-properties.ui</file>
<file alias="seahorse-revoke.ui" preprocess="xml-stripblanks">../pgp/seahorse-revoke.ui</file>
diff --git a/pgp/meson.build b/pgp/meson.build
index ea332723..0311dcab 100644
--- a/pgp/meson.build
+++ b/pgp/meson.build
@@ -7,7 +7,7 @@ pgp_sources = [
'seahorse-gpgme-data.c',
'seahorse-gpgme-expires.c',
'seahorse-gpgme-exporter.c',
- 'seahorse-gpgme-generate.c',
+ 'seahorse-gpgme-generate-dialog.c',
'seahorse-gpgme-key.c',
'seahorse-gpgme-key-deleter.c',
'seahorse-gpgme-key-op.c',
diff --git a/pgp/seahorse-gpgme-generate-dialog.c b/pgp/seahorse-gpgme-generate-dialog.c
new file mode 100644
index 00000000..7c17897a
--- /dev/null
+++ b/pgp/seahorse-gpgme-generate-dialog.c
@@ -0,0 +1,395 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2006 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This program 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "seahorse-gpgme-generate-dialog.h"
+
+#include "seahorse-pgp-backend.h"
+#include "seahorse-gpgme.h"
+#include "seahorse-gpgme-key.h"
+#include "seahorse-gpgme-key-op.h"
+#include "seahorse-gpgme-keyring.h"
+
+#include "seahorse-common.h"
+
+#include "libegg/egg-datetime.h"
+
+#include "libseahorse/seahorse-progress.h"
+#include "libseahorse/seahorse-util.h"
+
+#include <glib/gi18n.h>
+
+#include <string.h>
+#include <time.h>
+
+/**
+ * SECTION:seahorse-gpgme-generate
+ * @short_description: This file contains creation dialogs for pgp key creation.
+ *
+ **/
+
+struct _SeahorseGpgmeGenerateDialog {
+ GtkDialog parent_instance;
+
+ SeahorseGpgmeKeyring *keyring;
+
+ GtkWidget *name_entry;
+ GtkWidget *email_entry;
+ GtkWidget *comment_entry;
+
+ GtkWidget *algorithm_choice;
+ GtkWidget *bits_entry;
+
+ GtkWidget *expires_check;
+ GtkWidget *expiry_date_container;
+ GtkWidget *expiry_date;
+};
+
+enum {
+ PROP_0,
+ PROP_KEYRING,
+ N_PROPS
+};
+static GParamSpec *obj_props[N_PROPS] = { NULL, };
+
+G_DEFINE_TYPE (SeahorseGpgmeGenerateDialog, seahorse_gpgme_generate_dialog, GTK_TYPE_DIALOG)
+
+typedef struct _AlgorithmDesc {
+ const gchar* desc;
+ guint type;
+ guint min;
+ guint max;
+ guint def;
+} AlgorithmDesc;
+
+static AlgorithmDesc available_algorithms[] = {
+ { N_("RSA"), RSA_RSA, RSA_MIN, LENGTH_MAX, LENGTH_DEFAULT },
+ { N_("DSA ElGamal"), DSA_ELGAMAL, ELGAMAL_MIN, LENGTH_MAX, LENGTH_DEFAULT },
+ { N_("DSA (sign only)"), DSA, DSA_MIN, DSA_MAX, LENGTH_DEFAULT },
+ { N_("RSA (sign only)"), RSA_SIGN, RSA_MIN, LENGTH_MAX, LENGTH_DEFAULT }
+};
+
+static void
+on_generate_key_complete (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ SeahorseCatalog *catalog = SEAHORSE_CATALOG (user_data);
+ GError *error = NULL;
+
+ if (!seahorse_gpgme_key_op_generate_finish (SEAHORSE_GPGME_KEYRING (source), result, &error)) {
+ seahorse_util_handle_error (&error,
+ GTK_WINDOW (catalog),
+ _("Couldn’t generate PGP key"));
+ return;
+ }
+
+ g_action_group_activate_action (G_ACTION_GROUP (catalog),
+ "focus-place",
+ g_variant_new_string ("gnupg"));
+}
+
+/**
+ * gpgme_generate_key:
+ * @sksrc: the seahorse source
+ * @name: the user's full name
+ * @email: the user's email address
+ * @comment: a comment, added to the key
+ * @type: key type like DSA_ELGAMAL
+ * @bits: the number of bits for the key to generate (2048)
+ * @expires: expiry date can be 0
+ *
+ * Displays a password generation box and creates a key afterwards. For the key
+ * data it uses @name @email and @comment ncryption is chosen by @type and @bits
+ * @expire sets the expiry date
+ *
+ */
+void
+seahorse_gpgme_generate_key (SeahorseGpgmeKeyring *keyring,
+ const char *name,
+ const char *email,
+ const char *comment,
+ guint type,
+ guint bits,
+ time_t expires,
+ GtkWindow *parent)
+{
+ GCancellable *cancellable;
+ const gchar *pass;
+ SeahorsePassphrasePrompt *dialog;
+ const gchar *notice;
+
+ dialog = seahorse_passphrase_prompt_show_dialog (_("Passphrase for New PGP Key"),
+ _("Enter the passphrase for your new key twice."),
+ NULL, NULL, TRUE);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+ pass = seahorse_passphrase_prompt_get_text (dialog);
+ cancellable = g_cancellable_new ();
+ seahorse_gpgme_key_op_generate_async (keyring, name, email, comment,
+ pass, type, bits, expires,
+ cancellable, on_generate_key_complete,
+ parent);
+
+ /* Has line breaks because GtkLabel is completely broken WRT wrapping */
+ notice = _("When creating a key we need to generate a lot of\n"
+ "random data and we need you to help. It’s a good\n"
+ "idea to perform some other action like typing on\n"
+ "the keyboard, moving the mouse, using applications.\n"
+ "This gives the system the random data that it needs.");
+ seahorse_progress_show_with_notice (cancellable, _("Generating key"), notice, FALSE);
+ g_object_unref (cancellable);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+/* If the name has more than 5 characters, this sets the ok button sensitive */
+static void
+on_gpgme_generate_entry_changed (GtkEditable *editable,
+ gpointer user_data)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (user_data);
+ g_autofree char *name = NULL;
+ gboolean name_long_enough;
+
+ /* A 5 character name is required */
+ name = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->name_entry)));
+ name_long_enough = name && strlen (g_strstrip (name)) >= 5;
+
+ /* If not, show the user and disable the create button */
+ if (!name_long_enough) {
+ g_object_set (self->name_entry,
+ "secondary-icon-name", "dialog-warning-symbolic",
+ "secondary-icon-tooltip-text", _("Name must be at least 5 characters long."),
+ NULL);
+ } else {
+ g_object_set (self->name_entry, "secondary-icon-name", NULL, NULL);
+ }
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, name_long_enough);
+}
+
+/* Handles the expires toggle button feedback */
+static void
+on_gpgme_generate_expires_toggled (GtkToggleButton *button,
+ gpointer user_data)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (user_data);
+
+ gtk_widget_set_sensitive (self->expiry_date_container,
+ !gtk_toggle_button_get_active (button));
+}
+
+/* Changes the bit range depending on the algorithm set */
+static void
+on_gpgme_generate_algorithm_changed (GtkComboBox *combo,
+ gpointer user_data)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (user_data);
+ int sel;
+
+ sel = gtk_combo_box_get_active (combo);
+ g_assert (sel < (int)G_N_ELEMENTS (available_algorithms));
+
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (self->bits_entry),
+ available_algorithms[sel].min,
+ available_algorithms[sel].max);
+
+ /* Set sane default key length */
+ if (available_algorithms[sel].def > available_algorithms[sel].max)
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->bits_entry), available_algorithms[sel].max);
+ else
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (self->bits_entry), available_algorithms[sel].def);
+}
+
+static void
+seahorse_gpgme_generate_dialog_response (GtkDialog *dialog, int response)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (dialog);
+ g_autofree char *name = NULL;
+ const char *email, *comment;
+ int sel;
+ guint type;
+ time_t expires;
+ guint bits;
+
+ if (response != GTK_RESPONSE_OK)
+ return;
+
+ /* Make sure the name is the right length. Should've been checked earlier */
+ name = g_strdup (gtk_entry_get_text (GTK_ENTRY (self->name_entry)));
+ g_return_if_fail (name);
+ name = g_strstrip (name);
+ g_return_if_fail (strlen(name) >= 5);
+
+ email = gtk_entry_get_text (GTK_ENTRY (self->email_entry));
+ comment = gtk_entry_get_text (GTK_ENTRY (self->comment_entry));
+
+ /* The algorithm */
+ sel = gtk_combo_box_get_active (GTK_COMBO_BOX (self->algorithm_choice));
+ g_assert (sel <= (int) G_N_ELEMENTS(available_algorithms));
+ type = available_algorithms[sel].type;
+
+ /* The number of bits */
+ bits = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (self->bits_entry));
+ if (bits < available_algorithms[sel].min || bits > available_algorithms[sel].max) {
+ bits = available_algorithms[sel].def;
+ g_message ("invalid key size: %s defaulting to %u", available_algorithms[sel].desc, bits);
+ }
+
+ /* The expiry */
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->expires_check)))
+ expires = 0;
+ else
+ egg_datetime_get_as_time_t (EGG_DATETIME (self->expiry_date), &expires);
+
+ /* Less confusing with less on the screen */
+ gtk_widget_hide (GTK_WIDGET (self));
+
+ seahorse_gpgme_generate_key (self->keyring,
+ name, email, comment, type, bits, expires,
+ gtk_window_get_transient_for (GTK_WINDOW (self)));
+}
+
+static void
+seahorse_gpgme_generate_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (object);
+
+ switch (prop_id) {
+ case PROP_KEYRING:
+ g_value_set_object (value, self->keyring);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+seahorse_gpgme_generate_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (object);
+
+ switch (prop_id) {
+ case PROP_KEYRING:
+ g_clear_object (&self->keyring);
+ self->keyring = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+seahorse_gpgme_generate_dialog_finalize (GObject *obj)
+{
+ SeahorseGpgmeGenerateDialog *self = SEAHORSE_GPGME_GENERATE_DIALOG (obj);
+
+ g_clear_object (&self->keyring);
+
+ G_OBJECT_CLASS (seahorse_gpgme_generate_dialog_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_gpgme_generate_dialog_init (SeahorseGpgmeGenerateDialog *self)
+{
+ time_t expires;
+ guint i;
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ /* The algorithms */
+ gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (self->algorithm_choice), 0);
+ for (i = 0; i < G_N_ELEMENTS(available_algorithms); i++) {
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (self->algorithm_choice),
+ _(available_algorithms[i].desc));
+ }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (self->algorithm_choice), 0);
+ on_gpgme_generate_algorithm_changed (GTK_COMBO_BOX (self->algorithm_choice),
+ self);
+
+ expires = time (NULL);
+ expires += (60 * 60 * 24 * 365); /* Seconds in a year */
+
+ /* Default expiry date */
+ self->expiry_date = egg_datetime_new_from_time_t (expires);
+ gtk_box_pack_start (GTK_BOX (self->expiry_date_container),
+ self->expiry_date, TRUE, TRUE, 0);
+ gtk_widget_set_sensitive (self->expiry_date, FALSE);
+ gtk_widget_show (self->expiry_date);
+
+ on_gpgme_generate_entry_changed (NULL, self);
+}
+
+static void
+seahorse_gpgme_generate_dialog_class_init (SeahorseGpgmeGenerateDialogClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
+
+ gobject_class->get_property = seahorse_gpgme_generate_dialog_get_property;
+ gobject_class->set_property = seahorse_gpgme_generate_dialog_set_property;
+ gobject_class->finalize = seahorse_gpgme_generate_dialog_finalize;
+
+ obj_props[PROP_KEYRING] =
+ g_param_spec_object ("keyring", "keyring",
+ "Keyring to use for generating",
+ SEAHORSE_TYPE_GPGME_KEYRING,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (gobject_class, N_PROPS, obj_props);
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/Seahorse/seahorse-gpgme-generate-dialog.ui");
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, name_entry);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, email_entry);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, comment_entry);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, algorithm_choice);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, bits_entry);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, expiry_date_container);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeGenerateDialog, expires_check);
+ gtk_widget_class_bind_template_callback (widget_class, on_gpgme_generate_entry_changed);
+ gtk_widget_class_bind_template_callback (widget_class, on_gpgme_generate_expires_toggled);
+ gtk_widget_class_bind_template_callback (widget_class, on_gpgme_generate_algorithm_changed);
+
+ dialog_class->response = seahorse_gpgme_generate_dialog_response;
+}
+
+GtkDialog *
+seahorse_gpgme_generate_dialog_new (SeahorseGpgmeKeyring *keyring,
+ GtkWindow *parent)
+{
+ return g_object_new (SEAHORSE_GPGME_TYPE_GENERATE_DIALOG,
+ "keyring", keyring,
+ "use-header-bar", 1,
+ NULL);
+}
diff --git a/pgp/seahorse-gpgme-generate-dialog.h b/pgp/seahorse-gpgme-generate-dialog.h
new file mode 100644
index 00000000..113a4f20
--- /dev/null
+++ b/pgp/seahorse-gpgme-generate-dialog.h
@@ -0,0 +1,34 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2020 Niels De Graef
+ *
+ * This program 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.
+ *
+ * This program 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/>.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "pgp/seahorse-gpgme-keyring.h"
+
+#define SEAHORSE_GPGME_TYPE_GENERATE_DIALOG (seahorse_gpgme_generate_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (SeahorseGpgmeGenerateDialog, seahorse_gpgme_generate_dialog,
+ SEAHORSE_GPGME, GENERATE_DIALOG,
+ GtkDialog)
+
+void seahorse_gpgme_generate_register (void);
+
+GtkDialog* seahorse_gpgme_generate_dialog_new (SeahorseGpgmeKeyring *keyring,
+ GtkWindow *parent);
diff --git a/pgp/seahorse-pgp-generate.ui b/pgp/seahorse-gpgme-generate-dialog.ui
similarity index 91%
rename from pgp/seahorse-pgp-generate.ui
rename to pgp/seahorse-gpgme-generate-dialog.ui
index 35f27483..35c8a995 100644
--- a/pgp/seahorse-pgp-generate.ui
+++ b/pgp/seahorse-gpgme-generate-dialog.ui
@@ -14,32 +14,28 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkDialog" id="pgp-generate">
+ <template class="SeahorseGpgmeGenerateDialog" parent="GtkDialog">
<property name="title" translatable="yes">New PGP key</property>
<property name="visible">True</property>
- <property name="use_header_bar">1</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="resizable">False</property>
<property name="modal">True</property>
- <property name="type_hint">dialog</property>
- <signal name="delete-event" handler="on_widget_delete_event" swapped="no"/>
- <signal name="response" handler="on_gpgme_generate_response" swapped="no"/>
<child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
- <object class="GtkBox" id="vbox1">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="margin">12</property>
<child>
- <object class="GtkLabel" id="label45">
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -53,19 +49,19 @@
</packing>
</child>
<child>
- <object class="GtkGrid" id="table12">
+ <object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="name-label">
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes" comments="Full name of the key, usually the
name of the user.">Full _Name</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">name-entry</property>
+ <property name="mnemonic_widget">name_entry</property>
<style>
<class name="dim-label"/>
</style>
@@ -76,7 +72,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="name-entry">
+ <object class="GtkEntry" id="name_entry">
<property name="width_request">180</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -96,7 +92,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Email Address</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">email-entry</property>
+ <property name="mnemonic_widget">email_entry</property>
<style>
<class name="dim-label"/>
</style>
@@ -107,7 +103,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="email-entry">
+ <object class="GtkEntry" id="email_entry">
<property name="width_request">180</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -136,13 +132,13 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label54">
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="halign">end</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Comment</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">comment-entry</property>
+ <property name="mnemonic_widget">comment_entry</property>
<style>
<class name="dim-label"/>
</style>
@@ -153,7 +149,7 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="comment-entry">
+ <object class="GtkEntry" id="comment_entry">
<property name="width_request">180</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -183,7 +179,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="algorithm-choice">
+ <object class="GtkComboBoxText" id="algorithm_choice">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
@@ -213,7 +209,7 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="bits-entry">
+ <object class="GtkSpinButton" id="bits_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
@@ -227,7 +223,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="label55">
+ <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
@@ -243,7 +239,7 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="expiry-date-container">
+ <object class="GtkBox" id="expiry_date_container">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="can_focus">False</property>
@@ -252,7 +248,7 @@
<placeholder/>
</child>
<child>
- <object class="GtkCheckButton" id="expires-check">
+ <object class="GtkCheckButton" id="expires_check">
<property name="label" translatable="yes">Ne_ver Expires</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -312,5 +308,5 @@
<action-widget response="-6">cancelbutton1</action-widget>
<action-widget response="-5" default="true">ok</action-widget>
</action-widgets>
- </object>
+ </template>
</interface>
diff --git a/pgp/seahorse-pgp-actions.c b/pgp/seahorse-pgp-actions.c
index 255c2119..1dd6774c 100644
--- a/pgp/seahorse-pgp-actions.c
+++ b/pgp/seahorse-pgp-actions.c
@@ -24,6 +24,7 @@
#include <glib/gi18n.h>
#include "seahorse-gpgme-dialogs.h"
+#include "seahorse-gpgme-generate-dialog.h"
#include "seahorse-gpgme-key.h"
#include "seahorse-gpgme-key-op.h"
#include "seahorse-gpgme-uid.h"
@@ -136,14 +137,17 @@ on_pgp_generate_key (GSimpleAction *action,
SeahorseActionGroup *actions = SEAHORSE_ACTION_GROUP (user_data);
SeahorseGpgmeKeyring* keyring;
SeahorseCatalog *catalog;
+ GtkDialog *dialog;
keyring = seahorse_pgp_backend_get_default_keyring (NULL);
g_return_if_fail (keyring != NULL);
catalog = seahorse_action_group_get_catalog (actions);
- seahorse_gpgme_generate_show (keyring,
- GTK_WINDOW (catalog),
- NULL, NULL, NULL);
+
+ dialog = seahorse_gpgme_generate_dialog_new (keyring, GTK_WINDOW (catalog));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
g_clear_object (&catalog);
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 01cd1692..70d58324 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -45,7 +45,8 @@ pgp/seahorse-gpgme-add-uid.ui
pgp/seahorse-gpgme.c
pgp/seahorse-gpgme-expires.c
pgp/seahorse-gpgme-exporter.c
-pgp/seahorse-gpgme-generate.c
+pgp/seahorse-gpgme-generate-dialog.c
+pgp/seahorse-gpgme-generate-dialog.ui
pgp/seahorse-gpgme-key.c
pgp/seahorse-gpgme-key-deleter.c
pgp/seahorse-gpgme-key-op.c
@@ -67,7 +68,6 @@ pgp/seahorse-keyserver-sync.ui
pgp/seahorse-ldap-source.c
pgp/seahorse-pgp-actions.c
pgp/seahorse-pgp-backend.c
-pgp/seahorse-pgp-generate.ui
pgp/seahorse-pgp-key.c
pgp/seahorse-pgp-key-properties.c
pgp/seahorse-pgp-private-key-properties.ui
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]