[seahorse/wip/nielsdg/remove-more-deprecated: 8/8] gpgme: Key: Don't use g_type_class_add_private()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/wip/nielsdg/remove-more-deprecated: 8/8] gpgme: Key: Don't use g_type_class_add_private()
- Date: Tue, 19 Feb 2019 05:43:39 +0000 (UTC)
commit 72604c8cc69140fbfb5d6ba33e84eb58f4fbe284
Author: Niels De Graef <nielsdegraef gmail com>
Date: Tue Feb 19 06:42:19 2019 +0100
gpgme: Key: Don't use g_type_class_add_private()
It's been deprecated a while now in favor of `G_ADD_PRIVATE ()`
pgp/seahorse-gpgme-add-uid.c | 6 +-
pgp/seahorse-gpgme-exporter.c | 2 +-
pgp/seahorse-gpgme-key-deleter.c | 2 +-
pgp/seahorse-gpgme-key-op.c | 24 +-
pgp/seahorse-gpgme-key.c | 962 ++++++++++++++++++------------------
pgp/seahorse-gpgme-key.h | 26 +-
pgp/seahorse-gpgme-keyring.c | 4 +-
pgp/seahorse-gpgme-photos.c | 2 +-
pgp/seahorse-gpgme-revoke.c | 2 +-
pgp/seahorse-gpgme-secret-deleter.c | 2 +-
pgp/seahorse-gpgme-sign.c | 4 +-
pgp/seahorse-pgp-key-properties.c | 26 +-
pgp/seahorse-pgp-keysets.c | 2 +-
13 files changed, 518 insertions(+), 546 deletions(-)
---
diff --git a/pgp/seahorse-gpgme-add-uid.c b/pgp/seahorse-gpgme-add-uid.c
index 95210554..ed9b70a2 100644
--- a/pgp/seahorse-gpgme-add-uid.c
+++ b/pgp/seahorse-gpgme-add-uid.c
@@ -169,7 +169,7 @@ seahorse_gpgme_add_uid_class_init (SeahorseGpgmeAddUidClass *klass)
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 UID to",
- SEAHORSE_TYPE_GPGME_KEY,
+ 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-uid.ui");
@@ -193,7 +193,7 @@ seahorse_gpgme_add_uid_new (SeahorseGpgmeKey *pkey, GtkWindow *parent)
{
g_autoptr(SeahorseGpgmeAddUid) self = NULL;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), NULL);
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), NULL);
self = g_object_new (SEAHORSE_GPGME_TYPE_ADD_UID,
"key", pkey,
@@ -230,7 +230,7 @@ seahorse_gpgme_add_uid_run_dialog (SeahorseGpgmeKey *pkey, GtkWindow *parent)
GtkResponseType response;
const gchar *name, *email, *comment;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (pkey));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (pkey));
dialog = seahorse_gpgme_add_uid_new (pkey, parent);
response = gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/pgp/seahorse-gpgme-exporter.c b/pgp/seahorse-gpgme-exporter.c
index b08a87c4..0fc69f57 100644
--- a/pgp/seahorse-gpgme-exporter.c
+++ b/pgp/seahorse-gpgme-exporter.c
@@ -221,7 +221,7 @@ seahorse_gpgme_exporter_add_object (SeahorseExporter *exporter,
SeahorseGpgmeExporter *self = SEAHORSE_GPGME_EXPORTER (exporter);
SeahorseGpgmeKey *key;
- if (SEAHORSE_IS_GPGME_KEY (object)) {
+ if (SEAHORSE_GPGME_IS_KEY (object)) {
key = SEAHORSE_GPGME_KEY (object);
if (self->secret && seahorse_gpgme_key_get_private (key) == NULL)
return FALSE;
diff --git a/pgp/seahorse-gpgme-key-deleter.c b/pgp/seahorse-gpgme-key-deleter.c
index ab4d1f6c..ab2e9a71 100644
--- a/pgp/seahorse-gpgme-key-deleter.c
+++ b/pgp/seahorse-gpgme-key-deleter.c
@@ -102,7 +102,7 @@ seahorse_gpgme_key_deleter_add_object (SeahorseDeleter *deleter,
{
SeahorseGpgmeKeyDeleter *self = SEAHORSE_GPGME_KEY_DELETER (deleter);
- if (!SEAHORSE_IS_GPGME_KEY (object))
+ if (!SEAHORSE_GPGME_IS_KEY (object))
return FALSE;
self->keys = g_list_append (self->keys, g_object_ref (object));
return TRUE;
diff --git a/pgp/seahorse-gpgme-key-op.c b/pgp/seahorse-gpgme-key-op.c
index 2cd6be37..03ce3a99 100644
--- a/pgp/seahorse-gpgme-key-op.c
+++ b/pgp/seahorse-gpgme-key-op.c
@@ -601,7 +601,7 @@ seahorse_gpgme_key_op_sign_uid (SeahorseGpgmeUid *uid, SeahorseGpgmeKey *signer
seahorse_gpgme_key_get_private (signer);
g_return_val_if_fail (SEAHORSE_GPGME_IS_UID (uid), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
signing_key = seahorse_gpgme_key_get_private (signer);
g_return_val_if_fail (signing_key, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
@@ -623,8 +623,8 @@ seahorse_gpgme_key_op_sign (SeahorseGpgmeKey *pkey, SeahorseGpgmeKey *signer,
seahorse_gpgme_key_get_private (signer);
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (signer), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
signing_key = seahorse_gpgme_key_get_private (signer);
g_return_val_if_fail (signing_key, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
@@ -674,7 +674,7 @@ seahorse_gpgme_key_op_change_pass_async (SeahorseGpgmeKey *pkey,
g_autoptr(GSource) gsource = NULL;
gpgme_key_t key;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (pkey));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (pkey));
g_return_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY);
gctx = seahorse_gpgme_keyring_new_context (&gerr);
@@ -841,7 +841,7 @@ seahorse_gpgme_key_op_set_trust (SeahorseGpgmeKey *pkey, SeahorseValidity trust)
g_debug ("[GPGME_KEY_OP] set_trust: trust = %i", trust);
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (trust >= SEAHORSE_VALIDITY_NEVER, GPG_E (GPG_ERR_INV_VALUE));
g_return_val_if_fail (seahorse_gpgme_key_get_trust (pkey) != trust, GPG_E (GPG_ERR_INV_VALUE));
@@ -960,7 +960,7 @@ seahorse_gpgme_key_op_set_disabled (SeahorseGpgmeKey *pkey, gboolean disabled)
gchar *command;
SeahorseEditParm *parms;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
/* Get command and op */
if (disabled)
@@ -1226,8 +1226,8 @@ seahorse_gpgme_key_op_add_revoker (SeahorseGpgmeKey *pkey, SeahorseGpgmeKey *rev
SeahorseEditParm *parms;
const gchar *keyid;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (revoker), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (revoker), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) ==
SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (revoker)) ==
SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
@@ -1274,7 +1274,7 @@ seahorse_gpgme_key_op_add_uid_async (SeahorseGpgmeKey *pkey,
gpgme_key_t key;
g_autofree gchar* uid = NULL;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (pkey));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (pkey));
g_return_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY);
gctx = seahorse_gpgme_keyring_new_context (&gerr);
@@ -1433,7 +1433,7 @@ seahorse_gpgme_key_op_add_subkey (SeahorseGpgmeKey *pkey, const SeahorseKeyEncTy
SeahorseKeyTypeTable table;
gpgme_error_t gerr;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (seahorse_object_get_usage (SEAHORSE_OBJECT (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY,
GPG_E (GPG_ERR_WRONG_KEY_USAGE));
gerr = seahorse_gpgme_get_keytype_table (&table);
@@ -2170,7 +2170,7 @@ seahorse_gpgme_key_op_photo_add (SeahorseGpgmeKey *pkey, const gchar *filename)
PhotoIdAddParm photoid_add_parm;
gpgme_key_t key;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (filename, GPG_E (GPG_ERR_INV_VALUE));
key = seahorse_gpgme_key_get_public (pkey);
@@ -2373,7 +2373,7 @@ seahorse_gpgme_key_op_photos_load (SeahorseGpgmeKey *pkey)
gchar *path;
gint fd;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
key = seahorse_gpgme_key_get_public (pkey);
g_return_val_if_fail (key, GPG_E (GPG_ERR_INV_VALUE));
diff --git a/pgp/seahorse-gpgme-key.c b/pgp/seahorse-gpgme-key.c
index 9e12880c..0fda7239 100644
--- a/pgp/seahorse-gpgme-key.c
+++ b/pgp/seahorse-gpgme-key.c
@@ -40,15 +40,29 @@
#include <string.h>
enum {
- PROP_0,
- PROP_PUBKEY,
- PROP_SECKEY,
- PROP_VALIDITY,
- PROP_TRUST
+ PROP_0,
+ PROP_PUBKEY,
+ PROP_SECKEY,
+ PROP_VALIDITY,
+ PROP_TRUST
};
-static void seahorse_gpgme_key_deletable_iface (SeahorseDeletableIface *iface);
+struct _SeahorseGpgmeKey {
+ SeahorsePgpKey parent_instance;
+
+ gpgme_key_t pubkey; /* The public key */
+ gpgme_key_t seckey; /* The secret key */
+ gboolean has_secret; /* Whether we have a secret key or not */
+
+ GList *uids; /* We keep a copy of the uids. */
+
+ int list_mode; /* What to load our public key as */
+ gboolean photos_loaded; /* Photos were loaded */
+
+ gint block_loading; /* Loading is blocked while this flag is set */
+};
+static void seahorse_gpgme_key_deletable_iface (SeahorseDeletableIface *iface);
static void seahorse_gpgme_key_exportable_iface (SeahorseExportableIface *iface);
G_DEFINE_TYPE_WITH_CODE (SeahorseGpgmeKey, seahorse_gpgme_key, SEAHORSE_PGP_TYPE_KEY,
@@ -56,668 +70,644 @@ G_DEFINE_TYPE_WITH_CODE (SeahorseGpgmeKey, seahorse_gpgme_key, SEAHORSE_PGP_TYPE
G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_DELETABLE, seahorse_gpgme_key_deletable_iface);
);
-struct _SeahorseGpgmeKeyPrivate {
- gpgme_key_t pubkey; /* The public key */
- gpgme_key_t seckey; /* The secret key */
- gboolean has_secret; /* Whether we have a secret key or not */
-
- GList *uids; /* We keep a copy of the uids. */
-
- int list_mode; /* What to load our public key as */
- gboolean photos_loaded; /* Photos were loaded */
-
- gint block_loading; /* Loading is blocked while this flag is set */
-};
-
-/* -----------------------------------------------------------------------------
- * INTERNAL HELPERS
- */
-
-static gboolean
+static gboolean
load_gpgme_key (const gchar *keyid,
int mode,
int secret,
gpgme_key_t *key)
{
- GError *error = NULL;
- gpgme_ctx_t ctx;
- gpgme_error_t gerr;
+ GError *error = NULL;
+ gpgme_ctx_t ctx;
+ gpgme_error_t gerr;
+
+ ctx = seahorse_gpgme_keyring_new_context (&gerr);
+ if (gerr != 0)
+ return FALSE;
- ctx = seahorse_gpgme_keyring_new_context (&gerr);
- if (gerr != 0)
- return FALSE;
+ gpgme_set_keylist_mode (ctx, mode);
+ gerr = gpgme_op_keylist_start (ctx, keyid, secret);
+ if (GPG_IS_OK (gerr)) {
+ gerr = gpgme_op_keylist_next (ctx, key);
+ gpgme_op_keylist_end (ctx);
+ }
- gpgme_set_keylist_mode (ctx, mode);
- gerr = gpgme_op_keylist_start (ctx, keyid, secret);
- if (GPG_IS_OK (gerr)) {
- gerr = gpgme_op_keylist_next (ctx, key);
- gpgme_op_keylist_end (ctx);
- }
+ gpgme_release (ctx);
- gpgme_release (ctx);
+ if (seahorse_gpgme_propagate_error (gerr, &error)) {
+ g_message ("couldn't load GPGME key: %s", error->message);
+ g_clear_error (&error);
+ return FALSE;
+ }
- if (seahorse_gpgme_propagate_error (gerr, &error)) {
- g_message ("couldn't load GPGME key: %s", error->message);
- g_clear_error (&error);
- return FALSE;
- }
-
- return TRUE;
+ return TRUE;
}
static void
load_key_public (SeahorseGpgmeKey *self, int list_mode)
{
- gpgme_key_t key = NULL;
- const gchar *keyid;
- gboolean ret;
+ gpgme_key_t key = NULL;
+ const gchar *keyid;
+ gboolean ret;
- if (self->pv->block_loading)
- return;
-
- list_mode |= self->pv->list_mode;
+ if (self->block_loading)
+ return;
- keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (self));
- ret = load_gpgme_key (keyid, list_mode, FALSE, &key);
- if (ret) {
- self->pv->list_mode = list_mode;
- seahorse_gpgme_key_set_public (self, key);
- gpgme_key_unref (key);
- }
+ list_mode |= self->list_mode;
+
+ keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (self));
+ ret = load_gpgme_key (keyid, list_mode, FALSE, &key);
+ if (ret) {
+ self->list_mode = list_mode;
+ seahorse_gpgme_key_set_public (self, key);
+ gpgme_key_unref (key);
+ }
}
static gboolean
require_key_public (SeahorseGpgmeKey *self, int list_mode)
{
- if (!self->pv->pubkey || (self->pv->list_mode & list_mode) != list_mode)
- load_key_public (self, list_mode);
- return self->pv->pubkey && (self->pv->list_mode & list_mode) == list_mode;
+ if (!self->pubkey || (self->list_mode & list_mode) != list_mode)
+ load_key_public (self, list_mode);
+ return self->pubkey && (self->list_mode & list_mode) == list_mode;
}
static void
load_key_private (SeahorseGpgmeKey *self)
{
- gpgme_key_t key = NULL;
- const gchar *keyid;
- gboolean ret;
+ gpgme_key_t key = NULL;
+ const gchar *keyid;
+ gboolean ret;
- if (!self->pv->has_secret || self->pv->block_loading)
- return;
+ if (!self->has_secret || self->block_loading)
+ return;
- keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (self));
- ret = load_gpgme_key (keyid, GPGME_KEYLIST_MODE_LOCAL, TRUE, &key);
- if (ret) {
- seahorse_gpgme_key_set_private (self, key);
- gpgme_key_unref (key);
- }
+ keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (self));
+ ret = load_gpgme_key (keyid, GPGME_KEYLIST_MODE_LOCAL, TRUE, &key);
+ if (ret) {
+ seahorse_gpgme_key_set_private (self, key);
+ gpgme_key_unref (key);
+ }
}
static gboolean
require_key_private (SeahorseGpgmeKey *self)
{
- if (!self->pv->seckey)
- load_key_private (self);
- return self->pv->seckey != NULL;
+ if (!self->seckey)
+ load_key_private (self);
+ return self->seckey != NULL;
}
static gboolean
require_key_uids (SeahorseGpgmeKey *self)
{
- return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
+ return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
}
static gboolean
require_key_subkeys (SeahorseGpgmeKey *self)
{
- return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
+ return require_key_public (self, GPGME_KEYLIST_MODE_LOCAL);
}
static void
load_key_photos (SeahorseGpgmeKey *self)
{
- gpgme_error_t gerr;
-
- if (self->pv->block_loading)
- return;
+ gpgme_error_t gerr;
+
+ if (self->block_loading)
+ return;
- gerr = seahorse_gpgme_key_op_photos_load (self);
- if (!GPG_IS_OK (gerr))
- g_message ("couldn't load key photos: %s", gpgme_strerror (gerr));
- else
- self->pv->photos_loaded = TRUE;
+ gerr = seahorse_gpgme_key_op_photos_load (self);
+ if (!GPG_IS_OK (gerr))
+ g_message ("couldn't load key photos: %s", gpgme_strerror (gerr));
+ else
+ self->photos_loaded = TRUE;
}
static gboolean
require_key_photos (SeahorseGpgmeKey *self)
{
- if (!self->pv->photos_loaded)
- load_key_photos (self);
- return self->pv->photos_loaded;
+ if (!self->photos_loaded)
+ load_key_photos (self);
+ return self->photos_loaded;
}
static void
renumber_actual_uids (SeahorseGpgmeKey *self)
{
- GArray *index_map;
- GList *photos, *uids, *l;
- guint index, i;
-
- g_assert (SEAHORSE_IS_GPGME_KEY (self));
-
- /*
- * This function is necessary because the uid stored in a gpgme_user_id_t
- * struct is only usable with gpgme functions. Problems will be caused if
- * that uid is used with functions found in seahorse-gpgme-key-op.h. This
- * function is only to be called with uids from gpgme_user_id_t structs.
- */
-
- ++self->pv->block_loading;
- photos = seahorse_pgp_key_get_photos (SEAHORSE_PGP_KEY (self));
- uids = self->pv->uids;
- --self->pv->block_loading;
-
- /* First we build a bitmap of where all the photo uid indexes are */
- index_map = g_array_new (FALSE, TRUE, sizeof (gboolean));
- for (l = photos; l; l = g_list_next (l)) {
- index = seahorse_gpgme_photo_get_index (l->data);
- if (index >= index_map->len)
- g_array_set_size (index_map, index + 1);
- g_array_index (index_map, gboolean, index) = TRUE;
- }
-
- /* Now for each UID we add however many photo indexes are below the gpgme index */
- for (l = uids; l; l = g_list_next (l)) {
- index = seahorse_gpgme_uid_get_gpgme_index (l->data);
- for (i = 0; i < index_map->len && i < index; ++i) {
- if(g_array_index (index_map, gboolean, index))
- ++index;
- }
- seahorse_gpgme_uid_set_actual_index (l->data, index + 1);
- }
-
- g_array_free (index_map, TRUE);
+ GArray *index_map;
+ GList *photos, *uids, *l;
+ guint index, i;
+
+ g_assert (SEAHORSE_GPGME_IS_KEY (self));
+
+ /*
+ * This function is necessary because the uid stored in a gpgme_user_id_t
+ * struct is only usable with gpgme functions. Problems will be caused if
+ * that uid is used with functions found in seahorse-gpgme-key-op.h. This
+ * function is only to be called with uids from gpgme_user_id_t structs.
+ */
+
+ ++self->block_loading;
+ photos = seahorse_pgp_key_get_photos (SEAHORSE_PGP_KEY (self));
+ uids = self->uids;
+ --self->block_loading;
+
+ /* First we build a bitmap of where all the photo uid indexes are */
+ index_map = g_array_new (FALSE, TRUE, sizeof (gboolean));
+ for (l = photos; l; l = g_list_next (l)) {
+ index = seahorse_gpgme_photo_get_index (l->data);
+ if (index >= index_map->len)
+ g_array_set_size (index_map, index + 1);
+ g_array_index (index_map, gboolean, index) = TRUE;
+ }
+
+ /* Now for each UID we add however many photo indexes are below the gpgme index */
+ for (l = uids; l; l = g_list_next (l)) {
+ index = seahorse_gpgme_uid_get_gpgme_index (l->data);
+ for (i = 0; i < index_map->len && i < index; ++i) {
+ if(g_array_index (index_map, gboolean, index))
+ ++index;
+ }
+ seahorse_gpgme_uid_set_actual_index (l->data, index + 1);
+ }
+
+ g_array_free (index_map, TRUE);
}
static void
realize_uids (SeahorseGpgmeKey *self)
{
- gpgme_user_id_t guid;
- SeahorseGpgmeUid *uid;
- GList *results = NULL;
- gboolean changed = FALSE;
- GList *uids;
-
- uids = self->pv->uids;
- guid = self->pv->pubkey ? self->pv->pubkey->uids : NULL;
-
- /* Look for out of sync or missing UIDs */
- while (uids != NULL) {
- g_return_if_fail (SEAHORSE_GPGME_IS_UID (uids->data));
- uid = SEAHORSE_GPGME_UID (uids->data);
- uids = g_list_next (uids);
-
- /* Bring this UID up to date */
- if (guid && seahorse_gpgme_uid_is_same (uid, guid)) {
- if (seahorse_gpgme_uid_get_userid (uid) != guid) {
- g_object_set (uid, "pubkey", self->pv->pubkey, "userid", guid, NULL);
- changed = TRUE;
- }
- results = seahorse_object_list_append (results, uid);
- guid = guid->next;
- }
- }
-
- /* Add new UIDs */
- while (guid != NULL) {
- uid = seahorse_gpgme_uid_new (self, guid);
- changed = TRUE;
- results = seahorse_object_list_append (results, uid);
- g_object_unref (uid);
- guid = guid->next;
- }
-
- if (changed)
- seahorse_pgp_key_set_uids (SEAHORSE_PGP_KEY (self), results);
- seahorse_object_list_free (results);
-}
-
-static void
+ gpgme_user_id_t guid;
+ SeahorseGpgmeUid *uid;
+ GList *results = NULL;
+ gboolean changed = FALSE;
+ GList *uids;
+
+ uids = self->uids;
+ guid = self->pubkey ? self->pubkey->uids : NULL;
+
+ /* Look for out of sync or missing UIDs */
+ while (uids != NULL) {
+ g_return_if_fail (SEAHORSE_GPGME_IS_UID (uids->data));
+ uid = SEAHORSE_GPGME_UID (uids->data);
+ uids = g_list_next (uids);
+
+ /* Bring this UID up to date */
+ if (guid && seahorse_gpgme_uid_is_same (uid, guid)) {
+ if (seahorse_gpgme_uid_get_userid (uid) != guid) {
+ g_object_set (uid, "pubkey", self->pubkey, "userid", guid, NULL);
+ changed = TRUE;
+ }
+ results = seahorse_object_list_append (results, uid);
+ guid = guid->next;
+ }
+ }
+
+ /* Add new UIDs */
+ while (guid != NULL) {
+ uid = seahorse_gpgme_uid_new (self, guid);
+ changed = TRUE;
+ results = seahorse_object_list_append (results, uid);
+ g_object_unref (uid);
+ guid = guid->next;
+ }
+
+ if (changed)
+ seahorse_pgp_key_set_uids (SEAHORSE_PGP_KEY (self), results);
+ seahorse_object_list_free (results);
+}
+
+static void
realize_subkeys (SeahorseGpgmeKey *self)
{
- gpgme_subkey_t gsubkey;
- SeahorseGpgmeSubkey *subkey;
- GList *list = NULL;
-
- if (self->pv->pubkey) {
+ gpgme_subkey_t gsubkey;
+ SeahorseGpgmeSubkey *subkey;
+ GList *list = NULL;
- for (gsubkey = self->pv->pubkey->subkeys; gsubkey; gsubkey = gsubkey->next) {
- subkey = seahorse_gpgme_subkey_new (self->pv->pubkey, gsubkey);
- list = seahorse_object_list_prepend (list, subkey);
- g_object_unref (subkey);
- }
-
- list = g_list_reverse (list);
- }
+ if (self->pubkey) {
- seahorse_pgp_key_set_subkeys (SEAHORSE_PGP_KEY (self), list);
- seahorse_object_list_free (list);
+ for (gsubkey = self->pubkey->subkeys; gsubkey; gsubkey = gsubkey->next) {
+ subkey = seahorse_gpgme_subkey_new (self->pubkey, gsubkey);
+ list = seahorse_object_list_prepend (list, subkey);
+ g_object_unref (subkey);
+ }
+
+ list = g_list_reverse (list);
+ }
+
+ seahorse_pgp_key_set_subkeys (SEAHORSE_PGP_KEY (self), list);
+ seahorse_object_list_free (list);
}
void
seahorse_gpgme_key_realize (SeahorseGpgmeKey *self)
{
- SeahorseUsage usage;
- guint flags;
-
- if (!self->pv->pubkey)
- return;
-
- if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
- g_return_if_reached ();
-
- g_return_if_fail (self->pv->pubkey);
- g_return_if_fail (self->pv->pubkey->subkeys);
-
- /* Update the sub UIDs */
- realize_uids (self);
- realize_subkeys (self);
-
- /* The flags */
- flags = SEAHORSE_FLAG_EXPORTABLE | SEAHORSE_FLAG_DELETABLE;
-
- if (!self->pv->pubkey->disabled && !self->pv->pubkey->expired &&
- !self->pv->pubkey->revoked && !self->pv->pubkey->invalid) {
- if (seahorse_gpgme_key_get_validity (self) >= SEAHORSE_VALIDITY_MARGINAL)
- flags |= SEAHORSE_FLAG_IS_VALID;
- if (self->pv->pubkey->can_encrypt)
- flags |= SEAHORSE_FLAG_CAN_ENCRYPT;
- if (self->pv->seckey && self->pv->pubkey->can_sign)
- flags |= SEAHORSE_FLAG_CAN_SIGN;
- }
-
- if (self->pv->pubkey->expired)
- flags |= SEAHORSE_FLAG_EXPIRED;
-
- if (self->pv->pubkey->revoked)
- flags |= SEAHORSE_FLAG_REVOKED;
-
- if (self->pv->pubkey->disabled)
- flags |= SEAHORSE_FLAG_DISABLED;
-
- if (seahorse_gpgme_key_get_trust (self) >= SEAHORSE_VALIDITY_MARGINAL &&
- !self->pv->pubkey->revoked && !self->pv->pubkey->disabled &&
- !self->pv->pubkey->expired)
- flags |= SEAHORSE_FLAG_TRUSTED;
-
- /* The type */
- if (self->pv->seckey) {
- usage = SEAHORSE_USAGE_PRIVATE_KEY;
- flags |= SEAHORSE_FLAG_PERSONAL;
- } else {
- usage = SEAHORSE_USAGE_PUBLIC_KEY;
- }
-
- g_object_set (self,
- "usage", usage,
- "object-flags", flags,
- NULL);
-
- seahorse_pgp_key_realize (SEAHORSE_PGP_KEY (self));
+ SeahorseUsage usage;
+ guint flags;
+
+ if (!self->pubkey)
+ return;
+
+ if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+ g_return_if_reached ();
+
+ g_return_if_fail (self->pubkey);
+ g_return_if_fail (self->pubkey->subkeys);
+
+ /* Update the sub UIDs */
+ realize_uids (self);
+ realize_subkeys (self);
+
+ /* The flags */
+ flags = SEAHORSE_FLAG_EXPORTABLE | SEAHORSE_FLAG_DELETABLE;
+
+ if (!self->pubkey->disabled && !self->pubkey->expired &&
+ !self->pubkey->revoked && !self->pubkey->invalid) {
+ if (seahorse_gpgme_key_get_validity (self) >= SEAHORSE_VALIDITY_MARGINAL)
+ flags |= SEAHORSE_FLAG_IS_VALID;
+ if (self->pubkey->can_encrypt)
+ flags |= SEAHORSE_FLAG_CAN_ENCRYPT;
+ if (self->seckey && self->pubkey->can_sign)
+ flags |= SEAHORSE_FLAG_CAN_SIGN;
+ }
+
+ if (self->pubkey->expired)
+ flags |= SEAHORSE_FLAG_EXPIRED;
+
+ if (self->pubkey->revoked)
+ flags |= SEAHORSE_FLAG_REVOKED;
+
+ if (self->pubkey->disabled)
+ flags |= SEAHORSE_FLAG_DISABLED;
+
+ if (seahorse_gpgme_key_get_trust (self) >= SEAHORSE_VALIDITY_MARGINAL &&
+ !self->pubkey->revoked && !self->pubkey->disabled &&
+ !self->pubkey->expired)
+ flags |= SEAHORSE_FLAG_TRUSTED;
+
+ /* The type */
+ if (self->seckey) {
+ usage = SEAHORSE_USAGE_PRIVATE_KEY;
+ flags |= SEAHORSE_FLAG_PERSONAL;
+ } else {
+ usage = SEAHORSE_USAGE_PUBLIC_KEY;
+ }
+
+ g_object_set (self,
+ "usage", usage,
+ "object-flags", flags,
+ NULL);
+
+ seahorse_pgp_key_realize (SEAHORSE_PGP_KEY (self));
}
void
seahorse_gpgme_key_ensure_signatures (SeahorseGpgmeKey *self)
{
- require_key_public (self, GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_SIGS);
+ require_key_public (self, GPGME_KEYLIST_MODE_LOCAL | GPGME_KEYLIST_MODE_SIGS);
}
void
seahorse_gpgme_key_refresh (SeahorseGpgmeKey *self)
{
- if (self->pv->pubkey)
- load_key_public (self, self->pv->list_mode);
- if (self->pv->seckey)
- load_key_private (self);
- if (self->pv->photos_loaded)
- load_key_photos (self);
+ if (self->pubkey)
+ load_key_public (self, self->list_mode);
+ if (self->seckey)
+ load_key_private (self);
+ if (self->photos_loaded)
+ load_key_photos (self);
}
static GList*
seahorse_gpgme_key_get_uids (SeahorsePgpKey *base)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
- require_key_uids (self);
- return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_uids (base);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+ require_key_uids (self);
+ return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_uids (base);
}
static void
seahorse_gpgme_key_set_uids (SeahorsePgpKey *base, GList *uids)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
- SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->set_uids (base, uids);
+ SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->set_uids (base, uids);
- /* Keep our own copy of the UID list */
- seahorse_object_list_free (self->pv->uids);
- self->pv->uids = seahorse_object_list_copy (uids);
+ /* Keep our own copy of the UID list */
+ seahorse_object_list_free (self->uids);
+ self->uids = seahorse_object_list_copy (uids);
- renumber_actual_uids (self);
+ renumber_actual_uids (self);
}
static GList*
seahorse_gpgme_key_get_subkeys (SeahorsePgpKey *base)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
- require_key_subkeys (self);
- return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_subkeys (base);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+ require_key_subkeys (self);
+ return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_subkeys (base);
}
static GList*
seahorse_gpgme_key_get_photos (SeahorsePgpKey *base)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
- require_key_photos (self);
- return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_photos (base);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+ require_key_photos (self);
+ return SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->get_photos (base);
}
static void
seahorse_gpgme_key_set_photos (SeahorsePgpKey *base, GList *photos)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
- self->pv->photos_loaded = TRUE;
- SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->set_photos (base, photos);
- renumber_actual_uids (self);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (base);
+ self->photos_loaded = TRUE;
+ SEAHORSE_PGP_KEY_CLASS (seahorse_gpgme_key_parent_class)->set_photos (base, photos);
+ renumber_actual_uids (self);
}
-static void
-seahorse_gpgme_key_init (SeahorseGpgmeKey *self)
+static SeahorseDeleter *
+seahorse_gpgme_key_create_deleter (SeahorseDeletable *deletable)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_GPGME_KEY, SeahorseGpgmeKeyPrivate);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (deletable);
+ if (self->seckey)
+ return seahorse_gpgme_secret_deleter_new (self);
+ else
+ return seahorse_gpgme_key_deleter_new (self);
+}
+
+static gboolean
+seahorse_gpgme_key_get_deletable (SeahorseDeletable *deletable)
+{
+ gboolean can;
+ g_object_get (deletable, "deletable", &can, NULL);
+ return can;
}
static void
-seahorse_gpgme_key_object_constructed (GObject *object)
+seahorse_gpgme_key_deletable_iface (SeahorseDeletableIface *iface)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
+ iface->create_deleter = seahorse_gpgme_key_create_deleter;
+ iface->get_deletable = seahorse_gpgme_key_get_deletable;
+}
- G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->constructed (object);
+static GList *
+seahorse_gpgme_key_create_exporters (SeahorseExportable *exportable,
+ SeahorseExporterType type)
+{
+ GList *result = NULL;
+
+ if (type != SEAHORSE_EXPORTER_TYPE_TEXTUAL)
+ result = g_list_append (result, seahorse_gpgme_exporter_new (G_OBJECT (exportable), FALSE, FALSE));
+ result = g_list_append (result, seahorse_gpgme_exporter_new (G_OBJECT (exportable), TRUE, FALSE));
- seahorse_gpgme_key_realize (self);
+ return result;
}
-static void
-seahorse_gpgme_key_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+static gboolean
+seahorse_gpgme_key_get_exportable (SeahorseExportable *exportable)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
-
- switch (prop_id) {
- case PROP_PUBKEY:
- g_value_set_boxed (value, seahorse_gpgme_key_get_public (self));
- break;
- case PROP_SECKEY:
- g_value_set_boxed (value, seahorse_gpgme_key_get_private (self));
- break;
- case PROP_VALIDITY:
- g_value_set_uint (value, seahorse_gpgme_key_get_validity (self));
- break;
- case PROP_TRUST:
- g_value_set_uint (value, seahorse_gpgme_key_get_trust (self));
- break;
- }
+ gboolean can;
+ g_object_get (exportable, "exportable", &can, NULL);
+ return can;
}
static void
-seahorse_gpgme_key_set_property (GObject *object, guint prop_id, const GValue *value,
- GParamSpec *pspec)
+seahorse_gpgme_key_exportable_iface (SeahorseExportableIface *iface)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
+ iface->create_exporters = seahorse_gpgme_key_create_exporters;
+ iface->get_exportable = seahorse_gpgme_key_get_exportable;
+}
- switch (prop_id) {
- case PROP_PUBKEY:
- seahorse_gpgme_key_set_public (self, g_value_get_boxed (value));
- break;
- case PROP_SECKEY:
- seahorse_gpgme_key_set_private (self, g_value_get_boxed (value));
- break;
- }
+gpgme_key_t
+seahorse_gpgme_key_get_public (SeahorseGpgmeKey *self)
+{
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (self), NULL);
+ if (require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+ return self->pubkey;
+ return NULL;
}
-static void
-seahorse_gpgme_key_object_dispose (GObject *obj)
+void
+seahorse_gpgme_key_set_public (SeahorseGpgmeKey *self, gpgme_key_t key)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
+ GObject *obj;
+
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self));
- if (self->pv->pubkey)
- gpgme_key_unref (self->pv->pubkey);
- if (self->pv->seckey)
- gpgme_key_unref (self->pv->seckey);
- self->pv->pubkey = self->pv->seckey = NULL;
-
- seahorse_object_list_free (self->pv->uids);
- self->pv->uids = NULL;
+ if (self->pubkey)
+ gpgme_key_unref (self->pubkey);
+ self->pubkey = key;
+ if (self->pubkey) {
+ gpgme_key_ref (self->pubkey);
+ self->list_mode |= self->pubkey->keylist_mode;
+ }
- G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->dispose (obj);
+ obj = G_OBJECT (self);
+ g_object_freeze_notify (obj);
+ seahorse_gpgme_key_realize (self);
+ g_object_notify (obj, "fingerprint");
+ g_object_notify (obj, "validity");
+ g_object_notify (obj, "trust");
+ g_object_notify (obj, "expires");
+ g_object_notify (obj, "length");
+ g_object_notify (obj, "algo");
+ g_object_thaw_notify (obj);
}
-static void
-seahorse_gpgme_key_object_finalize (GObject *obj)
+gpgme_key_t
+seahorse_gpgme_key_get_private (SeahorseGpgmeKey *self)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
-
- g_assert (self->pv->pubkey == NULL);
- g_assert (self->pv->seckey == NULL);
- g_assert (self->pv->uids == NULL);
-
- G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->finalize (G_OBJECT (self));
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (self), NULL);
+ if (require_key_private (self))
+ return self->seckey;
+ return NULL;
}
-static void
-seahorse_gpgme_key_class_init (SeahorseGpgmeKeyClass *klass)
+void
+seahorse_gpgme_key_set_private (SeahorseGpgmeKey *self, gpgme_key_t key)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorsePgpKeyClass *pgp_class = SEAHORSE_PGP_KEY_CLASS (klass);
-
- seahorse_gpgme_key_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (SeahorseGpgmeKeyPrivate));
+ GObject *obj;
+
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self));
- gobject_class->constructed = seahorse_gpgme_key_object_constructed;
- gobject_class->dispose = seahorse_gpgme_key_object_dispose;
- gobject_class->finalize = seahorse_gpgme_key_object_finalize;
- gobject_class->set_property = seahorse_gpgme_key_set_property;
- gobject_class->get_property = seahorse_gpgme_key_get_property;
+ if (self->seckey)
+ gpgme_key_unref (self->seckey);
+ self->seckey = key;
+ if (self->seckey)
+ gpgme_key_ref (self->seckey);
- pgp_class->get_uids = seahorse_gpgme_key_get_uids;
- pgp_class->set_uids = seahorse_gpgme_key_set_uids;
- pgp_class->get_subkeys = seahorse_gpgme_key_get_subkeys;
- pgp_class->get_photos = seahorse_gpgme_key_get_photos;
- pgp_class->set_photos = seahorse_gpgme_key_set_photos;
-
- g_object_class_install_property (gobject_class, PROP_PUBKEY,
- g_param_spec_boxed ("pubkey", "GPGME Public Key", "GPGME Public Key that this object
represents",
- SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE));
+ obj = G_OBJECT (self);
+ g_object_freeze_notify (obj);
+ seahorse_gpgme_key_realize (self);
+ g_object_thaw_notify (obj);
+}
+
+SeahorseValidity
+seahorse_gpgme_key_get_validity (SeahorseGpgmeKey *self)
+{
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
- g_object_class_install_property (gobject_class, PROP_SECKEY,
- g_param_spec_boxed ("seckey", "GPGME Secret Key", "GPGME Secret Key that this object
represents",
- SEAHORSE_GPGME_BOXED_KEY, G_PARAM_READWRITE));
+ if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+ return SEAHORSE_VALIDITY_UNKNOWN;
- g_object_class_override_property (gobject_class, PROP_VALIDITY, "validity");
+ g_return_val_if_fail (self->pubkey, SEAHORSE_VALIDITY_UNKNOWN);
+ g_return_val_if_fail (self->pubkey->uids, SEAHORSE_VALIDITY_UNKNOWN);
- g_object_class_override_property (gobject_class, PROP_TRUST, "trust");
+ if (self->pubkey->revoked)
+ return SEAHORSE_VALIDITY_REVOKED;
+ if (self->pubkey->disabled)
+ return SEAHORSE_VALIDITY_DISABLED;
+ return seahorse_gpgme_convert_validity (self->pubkey->uids->validity);
}
-static SeahorseDeleter *
-seahorse_gpgme_key_create_deleter (SeahorseDeletable *deletable)
+SeahorseValidity
+seahorse_gpgme_key_get_trust (SeahorseGpgmeKey *self)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (deletable);
- if (self->pv->seckey)
- return seahorse_gpgme_secret_deleter_new (self);
- else
- return seahorse_gpgme_key_deleter_new (self);
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
+ if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
+ return SEAHORSE_VALIDITY_UNKNOWN;
+
+ return seahorse_gpgme_convert_validity (self->pubkey->owner_trust);
}
-static gboolean
-seahorse_gpgme_key_get_deletable (SeahorseDeletable *deletable)
+void
+seahorse_gpgme_key_refresh_matching (gpgme_key_t key)
{
- gboolean can;
- g_object_get (deletable, "deletable", &can, NULL);
- return can;
+ SeahorseGpgmeKey *gkey;
+
+ g_return_if_fail (key->subkeys->keyid);
+
+ gkey = seahorse_gpgme_keyring_lookup (seahorse_pgp_backend_get_default_keyring (NULL),
+ key->subkeys->keyid);
+ if (gkey != NULL)
+ seahorse_gpgme_key_refresh (gkey);
}
static void
-seahorse_gpgme_key_deletable_iface (SeahorseDeletableIface *iface)
+seahorse_gpgme_key_init (SeahorseGpgmeKey *self)
{
- iface->create_deleter = seahorse_gpgme_key_create_deleter;
- iface->get_deletable = seahorse_gpgme_key_get_deletable;
}
-static GList *
-seahorse_gpgme_key_create_exporters (SeahorseExportable *exportable,
- SeahorseExporterType type)
+static void
+seahorse_gpgme_key_object_constructed (GObject *object)
{
- GList *result = NULL;
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
- if (type != SEAHORSE_EXPORTER_TYPE_TEXTUAL)
- result = g_list_append (result, seahorse_gpgme_exporter_new (G_OBJECT (exportable), FALSE,
FALSE));
- result = g_list_append (result, seahorse_gpgme_exporter_new (G_OBJECT (exportable), TRUE, FALSE));
+ G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->constructed (object);
- return result;
+ seahorse_gpgme_key_realize (self);
}
-static gboolean
-seahorse_gpgme_key_get_exportable (SeahorseExportable *exportable)
+static void
+seahorse_gpgme_key_get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
{
- gboolean can;
- g_object_get (exportable, "exportable", &can, NULL);
- return can;
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
+
+ switch (prop_id) {
+ case PROP_PUBKEY:
+ g_value_set_boxed (value, seahorse_gpgme_key_get_public (self));
+ break;
+ case PROP_SECKEY:
+ g_value_set_boxed (value, seahorse_gpgme_key_get_private (self));
+ break;
+ case PROP_VALIDITY:
+ g_value_set_uint (value, seahorse_gpgme_key_get_validity (self));
+ break;
+ case PROP_TRUST:
+ g_value_set_uint (value, seahorse_gpgme_key_get_trust (self));
+ break;
+ }
}
static void
-seahorse_gpgme_key_exportable_iface (SeahorseExportableIface *iface)
+seahorse_gpgme_key_set_property (GObject *object, guint prop_id, const GValue *value,
+ GParamSpec *pspec)
{
- iface->create_exporters = seahorse_gpgme_key_create_exporters;
- iface->get_exportable = seahorse_gpgme_key_get_exportable;
-}
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
-/* -----------------------------------------------------------------------------
- * PUBLIC
- */
+ switch (prop_id) {
+ case PROP_PUBKEY:
+ seahorse_gpgme_key_set_public (self, g_value_get_boxed (value));
+ break;
+ case PROP_SECKEY:
+ seahorse_gpgme_key_set_private (self, g_value_get_boxed (value));
+ break;
+ }
+}
-SeahorseGpgmeKey*
-seahorse_gpgme_key_new (SeahorsePlace *sksrc,
- gpgme_key_t pubkey,
- gpgme_key_t seckey)
+static void
+seahorse_gpgme_key_object_dispose (GObject *obj)
{
- g_return_val_if_fail (pubkey || seckey, NULL);
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
- return g_object_new (SEAHORSE_TYPE_GPGME_KEY,
- "place", sksrc,
- "pubkey", pubkey,
- "seckey", seckey,
- NULL);
-}
+ if (self->pubkey)
+ gpgme_key_unref (self->pubkey);
+ if (self->seckey)
+ gpgme_key_unref (self->seckey);
+ self->pubkey = self->seckey = NULL;
-gpgme_key_t
-seahorse_gpgme_key_get_public (SeahorseGpgmeKey *self)
-{
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), NULL);
- if (require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
- return self->pv->pubkey;
- return NULL;
-}
+ seahorse_object_list_free (self->uids);
+ self->uids = NULL;
-void
-seahorse_gpgme_key_set_public (SeahorseGpgmeKey *self, gpgme_key_t key)
-{
- GObject *obj;
-
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self));
-
- if (self->pv->pubkey)
- gpgme_key_unref (self->pv->pubkey);
- self->pv->pubkey = key;
- if (self->pv->pubkey) {
- gpgme_key_ref (self->pv->pubkey);
- self->pv->list_mode |= self->pv->pubkey->keylist_mode;
- }
-
- obj = G_OBJECT (self);
- g_object_freeze_notify (obj);
- seahorse_gpgme_key_realize (self);
- g_object_notify (obj, "fingerprint");
- g_object_notify (obj, "validity");
- g_object_notify (obj, "trust");
- g_object_notify (obj, "expires");
- g_object_notify (obj, "length");
- g_object_notify (obj, "algo");
- g_object_thaw_notify (obj);
+ G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->dispose (obj);
}
-gpgme_key_t
-seahorse_gpgme_key_get_private (SeahorseGpgmeKey *self)
+static void
+seahorse_gpgme_key_object_finalize (GObject *obj)
{
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), NULL);
- if (require_key_private (self))
- return self->pv->seckey;
- return NULL;
-}
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
-void
-seahorse_gpgme_key_set_private (SeahorseGpgmeKey *self, gpgme_key_t key)
-{
- GObject *obj;
-
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self));
-
- if (self->pv->seckey)
- gpgme_key_unref (self->pv->seckey);
- self->pv->seckey = key;
- if (self->pv->seckey)
- gpgme_key_ref (self->pv->seckey);
-
- obj = G_OBJECT (self);
- g_object_freeze_notify (obj);
- seahorse_gpgme_key_realize (self);
- g_object_thaw_notify (obj);
-}
+ g_assert (self->pubkey == NULL);
+ g_assert (self->seckey == NULL);
+ g_assert (self->uids == NULL);
-SeahorseValidity
-seahorse_gpgme_key_get_validity (SeahorseGpgmeKey *self)
-{
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
-
- if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
- return SEAHORSE_VALIDITY_UNKNOWN;
-
- g_return_val_if_fail (self->pv->pubkey, SEAHORSE_VALIDITY_UNKNOWN);
- g_return_val_if_fail (self->pv->pubkey->uids, SEAHORSE_VALIDITY_UNKNOWN);
-
- if (self->pv->pubkey->revoked)
- return SEAHORSE_VALIDITY_REVOKED;
- if (self->pv->pubkey->disabled)
- return SEAHORSE_VALIDITY_DISABLED;
- return seahorse_gpgme_convert_validity (self->pv->pubkey->uids->validity);
+ G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->finalize (G_OBJECT (self));
}
-SeahorseValidity
-seahorse_gpgme_key_get_trust (SeahorseGpgmeKey *self)
+static void
+seahorse_gpgme_key_class_init (SeahorseGpgmeKeyClass *klass)
{
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (self), SEAHORSE_VALIDITY_UNKNOWN);
- if (!require_key_public (self, GPGME_KEYLIST_MODE_LOCAL))
- return SEAHORSE_VALIDITY_UNKNOWN;
-
- return seahorse_gpgme_convert_validity (self->pv->pubkey->owner_trust);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ SeahorsePgpKeyClass *pgp_class = SEAHORSE_PGP_KEY_CLASS (klass);
+
+ gobject_class->constructed = seahorse_gpgme_key_object_constructed;
+ gobject_class->dispose = seahorse_gpgme_key_object_dispose;
+ gobject_class->finalize = seahorse_gpgme_key_object_finalize;
+ gobject_class->set_property = seahorse_gpgme_key_set_property;
+ gobject_class->get_property = seahorse_gpgme_key_get_property;
+
+ pgp_class->get_uids = seahorse_gpgme_key_get_uids;
+ pgp_class->set_uids = seahorse_gpgme_key_set_uids;
+ pgp_class->get_subkeys = seahorse_gpgme_key_get_subkeys;
+ pgp_class->get_photos = seahorse_gpgme_key_get_photos;
+ pgp_class->set_photos = seahorse_gpgme_key_set_photos;
+
+ g_object_class_install_property (gobject_class, PROP_PUBKEY,
+ g_param_spec_boxed ("pubkey", "GPGME Public Key", "GPGME Public Key that this object represents",
+ SEAHORSE_GPGME_BOXED_KEY,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_SECKEY,
+ g_param_spec_boxed ("seckey", "GPGME Secret Key", "GPGME Secret Key that this object represents",
+ SEAHORSE_GPGME_BOXED_KEY,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_override_property (gobject_class, PROP_VALIDITY, "validity");
+ g_object_class_override_property (gobject_class, PROP_TRUST, "trust");
}
-void
-seahorse_gpgme_key_refresh_matching (gpgme_key_t key)
+SeahorseGpgmeKey*
+seahorse_gpgme_key_new (SeahorsePlace *sksrc,
+ gpgme_key_t pubkey,
+ gpgme_key_t seckey)
{
- SeahorseGpgmeKey *gkey;
-
- g_return_if_fail (key->subkeys->keyid);
+ g_return_val_if_fail (pubkey || seckey, NULL);
- gkey = seahorse_gpgme_keyring_lookup (seahorse_pgp_backend_get_default_keyring (NULL),
- key->subkeys->keyid);
- if (gkey != NULL)
- seahorse_gpgme_key_refresh (gkey);
+ return g_object_new (SEAHORSE_GPGME_TYPE_KEY,
+ "place", sksrc,
+ "pubkey", pubkey,
+ "seckey", seckey,
+ NULL);
}
diff --git a/pgp/seahorse-gpgme-key.h b/pgp/seahorse-gpgme-key.h
index 1f7f825d..7f0d6e18 100644
--- a/pgp/seahorse-gpgme-key.h
+++ b/pgp/seahorse-gpgme-key.h
@@ -25,26 +25,10 @@
#include "seahorse-pgp-key.h"
-#define SEAHORSE_TYPE_GPGME_KEY (seahorse_gpgme_key_get_type ())
-#define SEAHORSE_GPGME_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GPGME_KEY,
SeahorseGpgmeKey))
-#define SEAHORSE_GPGME_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GPGME_KEY,
SeahorseGpgmeKeyClass))
-#define SEAHORSE_IS_GPGME_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GPGME_KEY))
-#define SEAHORSE_IS_GPGME_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GPGME_KEY))
-#define SEAHORSE_GPGME_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GPGME_KEY,
SeahorseGpgmeKeyClass))
-
-
-typedef struct _SeahorseGpgmeKey SeahorseGpgmeKey;
-typedef struct _SeahorseGpgmeKeyClass SeahorseGpgmeKeyClass;
-typedef struct _SeahorseGpgmeKeyPrivate SeahorseGpgmeKeyPrivate;
-
-struct _SeahorseGpgmeKey {
- SeahorsePgpKey parent;
- SeahorseGpgmeKeyPrivate *pv;
-};
-
-struct _SeahorseGpgmeKeyClass {
- SeahorsePgpKeyClass parent_class;
-};
+#define SEAHORSE_GPGME_TYPE_KEY (seahorse_gpgme_key_get_type ())
+G_DECLARE_FINAL_TYPE (SeahorseGpgmeKey, seahorse_gpgme_key,
+ SEAHORSE_GPGME, KEY,
+ SeahorsePgpKey)
SeahorseGpgmeKey* seahorse_gpgme_key_new (SeahorsePlace *sksrc,
gpgme_key_t pubkey,
@@ -56,8 +40,6 @@ void seahorse_gpgme_key_realize (SeahorseGpgmeKey *sel
void seahorse_gpgme_key_ensure_signatures (SeahorseGpgmeKey *self);
-GType seahorse_gpgme_key_get_type (void);
-
gpgme_key_t seahorse_gpgme_key_get_public (SeahorseGpgmeKey *self);
void seahorse_gpgme_key_set_public (SeahorseGpgmeKey *self,
diff --git a/pgp/seahorse-gpgme-keyring.c b/pgp/seahorse-gpgme-keyring.c
index 9c5d170e..af48a8aa 100644
--- a/pgp/seahorse-gpgme-keyring.c
+++ b/pgp/seahorse-gpgme-keyring.c
@@ -505,7 +505,7 @@ seahorse_gpgme_keyring_remove_key (SeahorseGpgmeKeyring *self,
const gchar *keyid;
g_return_if_fail (SEAHORSE_IS_GPGME_KEYRING (self));
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (key));
keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (key));
g_return_if_fail (g_hash_table_lookup (self->keys, keyid) == key);
@@ -927,7 +927,7 @@ seahorse_gpgme_keyring_contains (GcrCollection *collection,
SeahorseGpgmeKeyring *self = SEAHORSE_GPGME_KEYRING (collection);
const gchar *keyid;
- if (!SEAHORSE_IS_GPGME_KEY (object))
+ if (!SEAHORSE_GPGME_IS_KEY (object))
return FALSE;
keyid = seahorse_pgp_key_get_keyid (SEAHORSE_PGP_KEY (object));
diff --git a/pgp/seahorse-gpgme-photos.c b/pgp/seahorse-gpgme-photos.c
index 464af076..de3eb929 100644
--- a/pgp/seahorse-gpgme-photos.c
+++ b/pgp/seahorse-gpgme-photos.c
@@ -256,7 +256,7 @@ seahorse_gpgme_photo_add (SeahorseGpgmeKey *pkey,
GtkWidget *chooser;
gboolean res = TRUE;
- g_return_val_if_fail (SEAHORSE_IS_GPGME_KEY (pkey), FALSE);
+ g_return_val_if_fail (SEAHORSE_GPGME_IS_KEY (pkey), FALSE);
if (NULL == path) {
chooser = gtk_file_chooser_dialog_new (_("Choose Photo to Add to Key"), parent,
diff --git a/pgp/seahorse-gpgme-revoke.c b/pgp/seahorse-gpgme-revoke.c
index fd6f48da..e978a60c 100644
--- a/pgp/seahorse-gpgme-revoke.c
+++ b/pgp/seahorse-gpgme-revoke.c
@@ -150,7 +150,7 @@ seahorse_gpgme_add_revoker_new (SeahorseGpgmeKey *pkey, GtkWindow *parent)
gpgme_error_t err;
const gchar *userid1, *userid2;
- g_return_if_fail (pkey != NULL && SEAHORSE_IS_GPGME_KEY (pkey));
+ g_return_if_fail (pkey != NULL && SEAHORSE_GPGME_IS_KEY (pkey));
revoker = SEAHORSE_GPGME_KEY (seahorse_signer_get (parent));
if (revoker == NULL)
diff --git a/pgp/seahorse-gpgme-secret-deleter.c b/pgp/seahorse-gpgme-secret-deleter.c
index 4b6c19f0..0463f18c 100644
--- a/pgp/seahorse-gpgme-secret-deleter.c
+++ b/pgp/seahorse-gpgme-secret-deleter.c
@@ -98,7 +98,7 @@ seahorse_gpgme_secret_deleter_add_object (SeahorseDeleter *deleter,
{
SeahorseGpgmeSecretDeleter *self = SEAHORSE_GPGME_SECRET_DELETER (deleter);
- if (!SEAHORSE_IS_GPGME_KEY (object))
+ if (!SEAHORSE_GPGME_IS_KEY (object))
return FALSE;
if (self->key)
return FALSE;
diff --git a/pgp/seahorse-gpgme-sign.c b/pgp/seahorse-gpgme-sign.c
index 8d48ea08..958428ab 100644
--- a/pgp/seahorse-gpgme-sign.c
+++ b/pgp/seahorse-gpgme-sign.c
@@ -81,13 +81,13 @@ sign_ok_clicked (SeahorseWidget *swidget, GtkWindow *parent)
g_return_val_if_fail (w != NULL, FALSE);
signer = seahorse_combo_keys_get_active (GTK_COMBO_BOX (w));
- g_assert (!signer || (SEAHORSE_IS_GPGME_KEY (signer) &&
+ g_assert (!signer || (SEAHORSE_GPGME_IS_KEY (signer) &&
seahorse_object_get_usage (SEAHORSE_OBJECT (signer)) ==
SEAHORSE_USAGE_PRIVATE_KEY));
to_sign = g_object_get_data (G_OBJECT (swidget), "to-sign");
if (SEAHORSE_GPGME_IS_UID (to_sign))
err = seahorse_gpgme_key_op_sign_uid (SEAHORSE_GPGME_UID (to_sign), SEAHORSE_GPGME_KEY (signer),
check, options);
- else if (SEAHORSE_IS_GPGME_KEY (to_sign))
+ else if (SEAHORSE_GPGME_IS_KEY (to_sign))
err = seahorse_gpgme_key_op_sign (SEAHORSE_GPGME_KEY (to_sign), SEAHORSE_GPGME_KEY (signer),
check, options);
else
g_assert (FALSE);
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 866f59e9..4ff1790e 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -226,7 +226,7 @@ static void
on_uids_add (GSimpleAction *action, GVariant *param, gpointer user_data)
{
SeahorsePgpKeyProperties *self = SEAHORSE_PGP_KEY_PROPERTIES (user_data);
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
seahorse_gpgme_add_uid_run_dialog (SEAHORSE_GPGME_KEY (self->key),
GTK_WINDOW (self));
}
@@ -484,7 +484,7 @@ on_pgp_owner_photo_drag_received (GtkWidget *widget,
gboolean dnd_success = FALSE;
gint len = 0;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
/*
* This needs to be improved, support should be added for remote images
@@ -520,7 +520,7 @@ on_photos_add (GSimpleAction *action, GVariant *param, gpointer user_data)
{
SeahorsePgpKeyProperties *self = SEAHORSE_PGP_KEY_PROPERTIES (user_data);
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
if (seahorse_gpgme_photo_add (SEAHORSE_GPGME_KEY (self->key),
GTK_WINDOW (self), NULL))
@@ -569,7 +569,7 @@ set_photoid_state (SeahorsePgpKeyProperties *self)
photo = g_object_get_data (G_OBJECT (self), "current-photoid");
g_return_if_fail (!photo || SEAHORSE_PGP_IS_PHOTO (photo));
- is_gpgme = SEAHORSE_IS_GPGME_KEY (self->key);
+ is_gpgme = SEAHORSE_GPGME_IS_KEY (self->key);
if (etype == SEAHORSE_USAGE_PRIVATE_KEY) {
gtk_widget_set_visible (self->owner_photo_add_button, is_gpgme);
@@ -725,7 +725,7 @@ on_change_password (GSimpleAction *action, GVariant *param, gpointer user_data)
usage = seahorse_object_get_usage (SEAHORSE_OBJECT (self->key));
g_return_if_fail (usage == SEAHORSE_USAGE_PRIVATE_KEY);
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
seahorse_gpgme_key_op_change_pass_async (SEAHORSE_GPGME_KEY (self->key),
NULL,
@@ -924,7 +924,7 @@ on_subkeys_add (GSimpleAction *action, GVariant *param, gpointer user_data)
{
SeahorsePgpKeyProperties *self = SEAHORSE_PGP_KEY_PROPERTIES (user_data);
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
seahorse_gpgme_add_subkey_new (SEAHORSE_GPGME_KEY (self->key),
GTK_WINDOW (self));
}
@@ -1004,7 +1004,7 @@ on_pgp_details_trust_changed (GtkComboBox *selection, gpointer user_data)
if (!gtk_combo_box_get_active_iter (selection, &iter))
return;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
model = gtk_combo_box_get_model (selection);
gtk_tree_model_get (model, &iter, TRUST_VALIDITY, &trust, -1);
@@ -1155,7 +1155,7 @@ do_details (SeahorsePgpKeyProperties *self)
gtk_label_set_text (self->details_strength_label, dbuffer);
gulong expires = seahorse_pgp_subkey_get_expires (subkey);
- if (!SEAHORSE_IS_GPGME_KEY (self->key))
+ if (!SEAHORSE_GPGME_IS_KEY (self->key))
expires_str = NULL;
else if (expires == 0)
expires_str = g_strdup (C_("Expires", "Never"));
@@ -1164,7 +1164,7 @@ do_details (SeahorsePgpKeyProperties *self)
gtk_label_set_text (self->details_expires_label, expires_str);
gtk_widget_set_visible (GTK_WIDGET (self->details_trust_combobox),
- SEAHORSE_IS_GPGME_KEY (self->key));
+ SEAHORSE_GPGME_IS_KEY (self->key));
gtk_widget_set_sensitive (GTK_WIDGET (self->details_trust_combobox),
!(seahorse_object_get_flags (SEAHORSE_OBJECT (self->key)) &
SEAHORSE_FLAG_DISABLED));
@@ -1299,7 +1299,7 @@ on_trust_marginal_changed (GSimpleAction *action, GVariant *new_state, gpointer
SeahorseValidity trust;
gpgme_error_t err;
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
trust = g_variant_get_boolean (new_state) ?
SEAHORSE_VALIDITY_MARGINAL : SEAHORSE_VALIDITY_UNKNOWN;
@@ -1411,7 +1411,7 @@ on_sign_key (GSimpleAction *action, GVariant *param, gpointer user_data)
{
SeahorsePgpKeyProperties *self = SEAHORSE_PGP_KEY_PROPERTIES (user_data);
- g_return_if_fail (SEAHORSE_IS_GPGME_KEY (self->key));
+ g_return_if_fail (SEAHORSE_GPGME_IS_KEY (self->key));
seahorse_gpgme_sign_prompt (SEAHORSE_GPGME_KEY (self->key), GTK_WINDOW (self));
}
@@ -1456,7 +1456,7 @@ do_trust (SeahorsePgpKeyProperties *self)
return;
/* Remote keys */
- if (!SEAHORSE_IS_GPGME_KEY (self->key)) {
+ if (!SEAHORSE_GPGME_IS_KEY (self->key)) {
gtk_widget_set_visible (self->manual_trust_area, FALSE);
gtk_widget_set_visible (GTK_WIDGET (self->trust_marginal_switch), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (self->trust_marginal_switch), FALSE);
@@ -1851,7 +1851,7 @@ seahorse_pgp_key_properties_new (SeahorsePgpKey *pkey, GtkWindow *parent)
g_autoptr(SeahorsePgpKeyProperties) dialog = NULL;
/* This causes the key source to get any specific info about the key */
- if (SEAHORSE_IS_GPGME_KEY (pkey)) {
+ if (SEAHORSE_GPGME_IS_KEY (pkey)) {
seahorse_gpgme_key_refresh (SEAHORSE_GPGME_KEY (pkey));
seahorse_gpgme_key_ensure_signatures (SEAHORSE_GPGME_KEY (pkey));
}
diff --git a/pgp/seahorse-pgp-keysets.c b/pgp/seahorse-pgp-keysets.c
index 429d0b4d..53a792d1 100644
--- a/pgp/seahorse-pgp-keysets.c
+++ b/pgp/seahorse-pgp-keysets.c
@@ -47,7 +47,7 @@ pgp_signers_match (GObject *obj,
SeahorseUsage usage;
SeahorseFlags flags;
- if (!SEAHORSE_IS_GPGME_KEY (obj))
+ if (!SEAHORSE_GPGME_IS_KEY (obj))
return FALSE;
g_object_get (obj, "usage", &usage, "object-flags", &flags, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]