[seahorse/wip/nielsdg/cleanup-sign-dialog: 2/3] gpgme: Port "add subkey" dialog to GtkTemplate
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/wip/nielsdg/cleanup-sign-dialog: 2/3] gpgme: Port "add subkey" dialog to GtkTemplate
- Date: Thu, 13 Feb 2020 07:16:05 +0000 (UTC)
commit a788b16c513b05668eb7a24b8059483b11bd57ec
Author: Niels De Graef <nielsdegraef gmail com>
Date: Tue Feb 11 07:32:27 2020 +0100
gpgme: Port "add subkey" dialog to GtkTemplate
data/seahorse.gresource.xml | 2 +-
pgp/seahorse-add-subkey.ui | 219 --------------------
pgp/seahorse-gpgme-add-subkey.c | 406 +++++++++++++++++++++++---------------
pgp/seahorse-gpgme-add-subkey.h | 33 ++++
pgp/seahorse-gpgme-add-subkey.ui | 164 +++++++++++++++
pgp/seahorse-gpgme-dialogs.h | 3 -
pgp/seahorse-pgp-key-properties.c | 9 +-
po/POTFILES.in | 2 +-
8 files changed, 455 insertions(+), 383 deletions(-)
---
diff --git a/data/seahorse.gresource.xml b/data/seahorse.gresource.xml
index 12aafc98..15b7f746 100644
--- a/data/seahorse.gresource.xml
+++ b/data/seahorse.gresource.xml
@@ -27,8 +27,8 @@
<file alias="seahorse-ssh-upload.ui" preprocess="xml-stripblanks">../ssh/seahorse-ssh-upload.ui</file>
<!-- PGP -->
- <file alias="seahorse-add-subkey.ui" preprocess="xml-stripblanks">../pgp/seahorse-add-subkey.ui</file>
<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-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>
diff --git a/pgp/seahorse-gpgme-add-subkey.c b/pgp/seahorse-gpgme-add-subkey.c
index ac5032e5..246ee63e 100644
--- a/pgp/seahorse-gpgme-add-subkey.c
+++ b/pgp/seahorse-gpgme-add-subkey.c
@@ -17,212 +17,304 @@
* <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
+#include <glib/gi18n.h>
+#include "config.h"
+#include "libseahorse/seahorse-object-widget.h"
+#include "libseahorse/seahorse-util.h"
+#include "libegg/egg-datetime.h"
+#include "seahorse-gpgme-add-subkey.h"
#include "seahorse-gpgme-key-op.h"
-#include "seahorse-gpgme-dialogs.h"
-#include "libseahorse/seahorse-object-widget.h"
-#include "libseahorse/seahorse-util.h"
+/**
+ * SECTION:seahorse-gpgme-add-subkey
+ * @short_description: A dialog that allows a user to add a new subkey to a
+ * key
+ **/
-#include "libegg/egg-datetime.h"
+struct _SeahorseGpgmeAddSubkey {
+ GtkDialog parent_instance;
-#include <glib/gi18n.h>
+ SeahorseGpgmeKey *key;
-#define LENGTH "length"
+ GtkTreeModel *types_model;
+ GtkWidget *type_combo;
-enum {
- COMBO_STRING,
- COMBO_INT,
- N_COLUMNS
+ GtkWidget *length_spinner;
+
+ GtkWidget *datetime_placeholder;
+ GtkWidget *expires_datetime;
+ GtkWidget *never_expires_check;
};
-void hanlder_gpgme_add_subkey_type_changed (GtkComboBox *combo,
- gpointer user_data);
+enum {
+ PROP_0,
+ PROP_KEY,
+};
-void on_gpgme_add_subkey_never_expires_toggled (GtkToggleButton *togglebutton,
- gpointer user_data);
+G_DEFINE_TYPE (SeahorseGpgmeAddSubkey, seahorse_gpgme_add_subkey, GTK_TYPE_DIALOG)
-void on_gpgme_add_subkey_ok_clicked (GtkButton *button,
- gpointer user_data);
+enum {
+ COMBO_STRING,
+ COMBO_INT,
+ N_COLUMNS
+};
-G_MODULE_EXPORT void
-hanlder_gpgme_add_subkey_type_changed (GtkComboBox *combo,
+static void
+handler_gpgme_add_subkey_type_changed (GtkComboBox *combo,
gpointer user_data)
{
- SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
- gint type;
- GtkSpinButton *length;
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (user_data);
+ int type;
+ GtkSpinButton *length;
GtkTreeModel *model;
GtkTreeIter iter;
-
- length = GTK_SPIN_BUTTON (seahorse_widget_get_widget (swidget, LENGTH));
-
- model = gtk_combo_box_get_model (combo);
- gtk_combo_box_get_active_iter (combo, &iter);
- gtk_tree_model_get (model, &iter,
+
+ length = GTK_SPIN_BUTTON (self->length_spinner);
+
+ model = gtk_combo_box_get_model (combo);
+ gtk_combo_box_get_active_iter (combo, &iter);
+ gtk_tree_model_get (model, &iter,
COMBO_INT, &type,
-1);
-
- switch (type) {
- /* DSA */
- case 0:
- gtk_spin_button_set_range (length, DSA_MIN, DSA_MAX);
- gtk_spin_button_set_value (length, LENGTH_DEFAULT < DSA_MAX ? LENGTH_DEFAULT :
DSA_MAX);
- break;
- /* ElGamal */
- case 1:
- gtk_spin_button_set_range (length, ELGAMAL_MIN, LENGTH_MAX);
- gtk_spin_button_set_value (length, LENGTH_DEFAULT);
- break;
- /* RSA */
- default:
- gtk_spin_button_set_range (length, RSA_MIN, LENGTH_MAX);
- gtk_spin_button_set_value (length, LENGTH_DEFAULT);
- break;
- }
+
+ switch (type) {
+ /* DSA */
+ case 0:
+ gtk_spin_button_set_range (length, DSA_MIN, DSA_MAX);
+ gtk_spin_button_set_value (length, LENGTH_DEFAULT < DSA_MAX ? LENGTH_DEFAULT : DSA_MAX);
+ break;
+ /* ElGamal */
+ case 1:
+ gtk_spin_button_set_range (length, ELGAMAL_MIN, LENGTH_MAX);
+ gtk_spin_button_set_value (length, LENGTH_DEFAULT);
+ break;
+ /* RSA */
+ default:
+ gtk_spin_button_set_range (length, RSA_MIN, LENGTH_MAX);
+ gtk_spin_button_set_value (length, LENGTH_DEFAULT);
+ break;
+ }
}
-G_MODULE_EXPORT void
+static void
on_gpgme_add_subkey_never_expires_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
- SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
- GtkWidget *widget;
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (user_data);
- widget = GTK_WIDGET (g_object_get_data (G_OBJECT (swidget), "expires-datetime"));
- g_return_if_fail (widget);
-
- gtk_widget_set_sensitive (GTK_WIDGET (widget),
+ gtk_widget_set_sensitive (self->expires_datetime,
!gtk_toggle_button_get_active (togglebutton));
}
-G_MODULE_EXPORT void
+static void
on_gpgme_add_subkey_ok_clicked (GtkButton *button,
gpointer user_data)
{
- SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
- SeahorseObjectWidget *skwidget;
- SeahorseKeyEncType real_type;
- gint type;
- guint length;
- time_t expires;
- gpgme_error_t err;
- GtkWidget *widget;
- GtkComboBox *combo;
- GtkTreeModel *model;
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (user_data);
+ SeahorseKeyEncType real_type;
+ int type;
+ guint length;
+ time_t expires;
+ gpgme_error_t err;
GtkTreeIter iter;
-
- skwidget = SEAHORSE_OBJECT_WIDGET (swidget);
-
- combo = GTK_COMBO_BOX (seahorse_widget_get_widget (swidget, "type"));
- gtk_combo_box_get_active_iter (combo, &iter);
- model = gtk_combo_box_get_model (combo);
- gtk_tree_model_get (model, &iter,
+
+ gtk_combo_box_get_active_iter (GTK_COMBO_BOX (self->type_combo), &iter);
+ gtk_tree_model_get (self->types_model, &iter,
COMBO_INT, &type,
- -1);
-
- length = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (
- seahorse_widget_get_widget (swidget, LENGTH)));
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
- seahorse_widget_get_widget (swidget, "never_expires"))))
- expires = 0;
- else {
- widget = GTK_WIDGET (g_object_get_data (G_OBJECT (swidget), "expires-datetime"));
- g_return_if_fail (widget);
-
- egg_datetime_get_as_time_t (EGG_DATETIME (widget), &expires);
+ -1);
+
+ length = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (self->length_spinner));
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->never_expires_check)))
+ expires = 0;
+ else {
+ egg_datetime_get_as_time_t (EGG_DATETIME (self->expires_datetime),
+ &expires);
}
-
- switch (type) {
- case 0:
- real_type = DSA;
- break;
- case 1:
- real_type = ELGAMAL;
- break;
- case 2:
- real_type = RSA_SIGN;
- break;
- default:
- real_type = RSA_ENCRYPT;
- break;
- }
-
- widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
- gtk_widget_set_sensitive (widget, FALSE);
- err = seahorse_gpgme_key_op_add_subkey (SEAHORSE_GPGME_KEY (skwidget->object),
- real_type, length, expires);
- gtk_widget_set_sensitive (widget, TRUE);
-
- if (!GPG_IS_OK (err))
- seahorse_gpgme_handle_error (err, _("Couldn’t add subkey"));
-
- seahorse_widget_destroy (swidget);
+
+ switch (type) {
+ case 0:
+ real_type = DSA;
+ break;
+ case 1:
+ real_type = ELGAMAL;
+ break;
+ case 2:
+ real_type = RSA_SIGN;
+ break;
+ default:
+ real_type = RSA_ENCRYPT;
+ break;
+ }
+
+ gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE);
+ err = seahorse_gpgme_key_op_add_subkey (SEAHORSE_GPGME_KEY (self->key),
+ real_type, length, expires);
+ gtk_widget_set_sensitive (GTK_WIDGET (self), TRUE);
+
+ if (!GPG_IS_OK (err))
+ seahorse_gpgme_handle_error (err, _("Couldn’t add subkey"));
+}
+
+static void
+seahorse_gpgme_add_subkey_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (object);
+
+ switch (prop_id) {
+ case PROP_KEY:
+ g_value_set_object (value, self->key);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+seahorse_gpgme_add_subkey_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (object);
+
+ switch (prop_id) {
+ case PROP_KEY:
+ g_clear_object (&self->key);
+ self->key = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+seahorse_gpgme_add_subkey_finalize (GObject *obj)
+{
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (obj);
+
+ g_clear_object (&self->key);
+
+ G_OBJECT_CLASS (seahorse_gpgme_add_subkey_parent_class)->finalize (obj);
+}
+
+static void
+seahorse_gpgme_add_subkey_constructed (GObject *obj)
+{
+ SeahorseGpgmeAddSubkey *self = SEAHORSE_GPGME_ADD_SUBKEY (obj);
+ g_autofree char *title = NULL;
+
+ G_OBJECT_CLASS (seahorse_gpgme_add_subkey_parent_class)->constructed (obj);
+
+ title = g_strdup_printf (_("Add subkey to %s"),
+ seahorse_object_get_label (SEAHORSE_OBJECT (self->key)));
+ gtk_window_set_title (GTK_WINDOW (self), title);
}
-void
-seahorse_gpgme_add_subkey_new (SeahorseGpgmeKey *pkey, GtkWindow *parent)
+static void
+seahorse_gpgme_add_subkey_init (SeahorseGpgmeAddSubkey *self)
{
- SeahorseWidget *swidget;
- GtkComboBox* combo;
- GtkTreeModel *model;
- GtkTreeIter iter;
- GtkCellRenderer *renderer;
- GtkWidget *widget, *datetime;
-
- swidget = seahorse_object_widget_new ("add-subkey", parent, G_OBJECT (pkey));
- g_return_if_fail (swidget != NULL);
-
- gtk_window_set_title (GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name)),
- g_strdup_printf (_("Add subkey to %s"), seahorse_object_get_label (SEAHORSE_OBJECT (pkey))));
-
- combo = GTK_COMBO_BOX (seahorse_widget_get_widget (swidget, "type"));
- model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT));
-
- gtk_combo_box_set_model (combo, model);
-
- gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ self->types_model = GTK_TREE_MODEL (gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT));
+ gtk_combo_box_set_model (GTK_COMBO_BOX (self->type_combo),
+ GTK_TREE_MODEL (self->types_model));
+
+ gtk_cell_layout_clear (GTK_CELL_LAYOUT (self->type_combo));
renderer = gtk_cell_renderer_text_new ();
-
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer,
+
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->type_combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (self->type_combo), renderer,
"text", COMBO_STRING);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+
+ gtk_list_store_append (GTK_LIST_STORE (self->types_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (self->types_model), &iter,
COMBO_STRING, _("DSA (sign only)"),
COMBO_INT, 0,
-1);
-
- gtk_combo_box_set_active_iter (combo, &iter);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self->type_combo), &iter);
+
+ gtk_list_store_append (GTK_LIST_STORE (self->types_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (self->types_model), &iter,
COMBO_STRING, _("ElGamal (encrypt only)"),
COMBO_INT, 1,
-1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+
+ gtk_list_store_append (GTK_LIST_STORE (self->types_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (self->types_model), &iter,
COMBO_STRING, _("RSA (sign only)"),
COMBO_INT, 2,
-1);
-
- gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+
+ gtk_list_store_append (GTK_LIST_STORE (self->types_model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (self->types_model), &iter,
COMBO_STRING, _("RSA (encrypt only)"),
COMBO_INT, 3,
-1);
-
- widget = seahorse_widget_get_widget (swidget, "datetime-placeholder");
- g_return_if_fail (widget != NULL);
-
- datetime = egg_datetime_new ();
- gtk_container_add (GTK_CONTAINER (widget), datetime);
- gtk_widget_show (datetime);
- gtk_widget_set_sensitive (datetime, FALSE);
- g_object_set_data (G_OBJECT (swidget), "expires-datetime", datetime);
+
+ self->expires_datetime = egg_datetime_new ();
+ gtk_container_add (GTK_CONTAINER (self->datetime_placeholder),
+ self->expires_datetime);
+ gtk_widget_show (self->expires_datetime);
+ gtk_widget_set_sensitive (self->expires_datetime, FALSE);
+}
+
+static void
+seahorse_gpgme_add_subkey_class_init (SeahorseGpgmeAddSubkeyClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gobject_class->constructed = seahorse_gpgme_add_subkey_constructed;
+ gobject_class->get_property = seahorse_gpgme_add_subkey_get_property;
+ gobject_class->set_property = seahorse_gpgme_add_subkey_set_property;
+ gobject_class->finalize = seahorse_gpgme_add_subkey_finalize;
+
+ g_object_class_install_property (gobject_class, PROP_KEY,
+ g_param_spec_object ("key", "GPGME key",
+ "The GPGME key which we're adding a new subkey to",
+ SEAHORSE_GPGME_TYPE_KEY,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/Seahorse/seahorse-gpgme-add-subkey.ui");
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeAddSubkey, type_combo);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeAddSubkey, length_spinner);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeAddSubkey, datetime_placeholder);
+ gtk_widget_class_bind_template_child (widget_class, SeahorseGpgmeAddSubkey, never_expires_check);
+ gtk_widget_class_bind_template_callback (widget_class, handler_gpgme_add_subkey_type_changed);
+ gtk_widget_class_bind_template_callback (widget_class, on_gpgme_add_subkey_never_expires_toggled);
+ gtk_widget_class_bind_template_callback (widget_class, on_gpgme_add_subkey_ok_clicked);
+}
+
+/**
+ * seahorse_add_subkey_new:
+ * @key: A #SeahorseGpgmeKey
+ *
+ * Creates a new #SeahorseGpgmeAddSubkey dialog for adding a user ID to @skey.
+ */
+GtkDialog *
+seahorse_gpgme_add_subkey_new (SeahorseGpgmeKey *key, GtkWindow *parent)
+{
+ g_autoptr(SeahorseGpgmeAddSubkey) self = NULL;
+
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (key), NULL);
+
+ self = g_object_new (SEAHORSE_GPGME_TYPE_ADD_SUBKEY,
+ "key", key,
+ "transient-for", parent,
+ "use-header-bar", 1,
+ NULL);
+
+ return GTK_DIALOG (g_steal_pointer (&self));
}
diff --git a/pgp/seahorse-gpgme-add-subkey.h b/pgp/seahorse-gpgme-add-subkey.h
new file mode 100644
index 00000000..9974834c
--- /dev/null
+++ b/pgp/seahorse-gpgme-add-subkey.h
@@ -0,0 +1,33 @@
+/*
+ * 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-key.h"
+#include "pgp/seahorse-gpgme-subkey.h"
+
+#define SEAHORSE_GPGME_TYPE_ADD_SUBKEY (seahorse_gpgme_add_subkey_get_type ())
+G_DECLARE_FINAL_TYPE (SeahorseGpgmeAddSubkey, seahorse_gpgme_add_subkey,
+ SEAHORSE_GPGME, ADD_SUBKEY,
+ GtkDialog)
+
+GtkDialog* seahorse_gpgme_add_subkey_new (SeahorseGpgmeKey *pkey,
+ GtkWindow *parent);
diff --git a/pgp/seahorse-gpgme-add-subkey.ui b/pgp/seahorse-gpgme-add-subkey.ui
new file mode 100644
index 00000000..e6ee37d6
--- /dev/null
+++ b/pgp/seahorse-gpgme-add-subkey.ui
@@ -0,0 +1,164 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="3.24"/>
+ <object class="GtkAdjustment" id="length_spinner_adjustment">
+ <property name="value">1024</property>
+ <property name="lower">768</property>
+ <property name="upper">1024</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">128</property>
+ </object>
+ <template class="SeahorseGpgmeAddSubkey" parent="GtkDialog">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="column-spacing">12</property>
+ <property name="row-spacing">6</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Key _Type</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">type_combo</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="top_attach">0</property>
+ <property name="left_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="type_combo">
+ <property name="visible">True</property>
+ <signal name="changed" handler="handler_gpgme_add_subkey_type_changed"/>
+ </object>
+ <packing>
+ <property name="top_attach">0</property>
+ <property name="left_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Key _Length</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">length_spinner</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="left_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="length_spinner">
+ <property name="width_request">80</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Length of Key</property>
+ <property name="adjustment">length_spinner_adjustment</property>
+ <property name="climb_rate">128</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="left_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Expiration Date</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="left_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="datetime_placeholder">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="left_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="never_expires_check">
+ <property name="label" translatable="yes">Never E_xpires</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">If key never expires</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_gpgme_add_subkey_never_expires_toggled"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="left_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancelbutton1">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="okbutton1">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Generate a new subkey</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_gpgme_add_subkey_ok_clicked"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">cancelbutton1</action-widget>
+ <action-widget response="-5">okbutton1</action-widget>
+ </action-widgets>
+ </template>
+</interface>
diff --git a/pgp/seahorse-gpgme-dialogs.h b/pgp/seahorse-gpgme-dialogs.h
index b9bb01c0..bf73debd 100644
--- a/pgp/seahorse-gpgme-dialogs.h
+++ b/pgp/seahorse-gpgme-dialogs.h
@@ -56,9 +56,6 @@ void seahorse_gpgme_add_revoker_new (SeahorseGpgmeKey *pkey,
void seahorse_gpgme_expires_new (SeahorseGpgmeSubkey *subkey,
GtkWindow *parent);
-void seahorse_gpgme_add_subkey_new (SeahorseGpgmeKey *pkey,
- GtkWindow *parent);
-
void seahorse_gpgme_revoke_new (SeahorseGpgmeSubkey *subkey,
GtkWindow *parent);
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 98152978..e03d532a 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -24,6 +24,7 @@
#include "config.h"
#include "seahorse-pgp-dialogs.h"
+#include "seahorse-gpgme-add-subkey.h"
#include "seahorse-gpgme-add-uid.h"
#include "seahorse-gpgme-dialogs.h"
#include "seahorse-gpgme-exporter.h"
@@ -942,10 +943,14 @@ static void
on_subkeys_add (GSimpleAction *action, GVariant *param, gpointer user_data)
{
SeahorsePgpKeyProperties *self = SEAHORSE_PGP_KEY_PROPERTIES (user_data);
+ GtkDialog *dialog;
g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
- seahorse_gpgme_add_subkey_new (SEAHORSE_GPGME_KEY (self->key),
- GTK_WINDOW (self));
+
+ dialog = seahorse_gpgme_add_subkey_new (SEAHORSE_GPGME_KEY (self->key),
+ GTK_WINDOW (self));
+ gtk_dialog_run (dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1b3df726..01cd1692 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -37,9 +37,9 @@ libegg/egg-datetime.c
libseahorse/seahorse-progress.ui
libseahorse/seahorse-util.c
libseahorse/seahorse-widget.c
-pgp/seahorse-add-subkey.ui
pgp/seahorse-expires.ui
pgp/seahorse-gpgme-add-subkey.c
+pgp/seahorse-gpgme-add-subkey.ui
pgp/seahorse-gpgme-add-uid.c
pgp/seahorse-gpgme-add-uid.ui
pgp/seahorse-gpgme.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]