[seahorse] Remove the SeahorseObject realize and refresh virtual methods.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Remove the SeahorseObject realize and refresh virtual methods.
- Date: Fri, 2 Sep 2011 10:17:23 +0000 (UTC)
commit 3d2130f23c5d9afa15ebfc40eec5a5449558671b
Author: Stef Walter <stefw collabora co uk>
Date: Mon Aug 29 12:54:32 2011 +0200
Remove the SeahorseObject realize and refresh virtual methods.
* These are almost always generally called from within their
own component, so these don't need to be virtual.
gkr/seahorse-gkr-item-properties.c | 2 +-
gkr/seahorse-gkr-item.c | 55 ++++++-----------
gkr/seahorse-gkr-item.h | 4 +
gkr/seahorse-gkr-keyring.c | 24 ++------
gkr/seahorse-gkr-keyring.h | 4 +
libseahorse/seahorse-object.c | 106 +--------------------------------
libseahorse/seahorse-object.h | 10 ---
pgp/seahorse-gpgme-key.c | 54 +++++++++---------
pgp/seahorse-gpgme-key.h | 4 +
pgp/seahorse-pgp-key-properties.c | 7 +--
pgp/seahorse-pgp-key.c | 31 ++++------
pgp/seahorse-pgp-key.h | 2 +
pgp/seahorse-pgp-uid.c | 30 ++++++----
pgp/seahorse-pgp-uid.h | 2 +
pkcs11/seahorse-pkcs11-certificate.c | 18 ++----
pkcs11/seahorse-pkcs11-object.c | 24 ++------
pkcs11/seahorse-pkcs11-object.h | 4 +
pkcs11/seahorse-pkcs11-source.c | 2 +-
ssh/seahorse-ssh-key.c | 10 +--
ssh/seahorse-ssh-key.h | 2 +
ssh/seahorse-ssh-operation.c | 4 +-
21 files changed, 130 insertions(+), 269 deletions(-)
---
diff --git a/gkr/seahorse-gkr-item-properties.c b/gkr/seahorse-gkr-item-properties.c
index 8376768..b06f72d 100644
--- a/gkr/seahorse-gkr-item-properties.c
+++ b/gkr/seahorse-gkr-item-properties.c
@@ -537,7 +537,7 @@ seahorse_gkr_item_properties_show (SeahorseGkrItem *git, GtkWindow *parent)
if (swidget == NULL)
return;
- seahorse_object_refresh (object);
+ seahorse_gkr_item_refresh (git);
widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, swidget->name));
g_signal_connect (widget, "response", G_CALLBACK (properties_response), swidget);
diff --git a/gkr/seahorse-gkr-item.c b/gkr/seahorse-gkr-item.c
index 28fffc3..d1cbd97 100644
--- a/gkr/seahorse-gkr-item.c
+++ b/gkr/seahorse-gkr-item.c
@@ -423,10 +423,9 @@ calc_item_type (SeahorseGkrItem *self)
* OBJECT
*/
-static void
-seahorse_gkr_item_realize (SeahorseObject *obj)
+void
+seahorse_gkr_item_realize (SeahorseGkrItem *self)
{
- SeahorseGkrItem *self = SEAHORSE_GKR_ITEM (obj);
const gchar *description;
gchar *display;
gchar *markup;
@@ -476,23 +475,17 @@ seahorse_gkr_item_realize (SeahorseObject *obj)
g_object_notify (G_OBJECT (self), "has-secret");
g_object_notify (G_OBJECT (self), "use");
-
- SEAHORSE_OBJECT_CLASS (seahorse_gkr_item_parent_class)->realize (obj);
}
-static void
-seahorse_gkr_item_refresh (SeahorseObject *obj)
+void
+seahorse_gkr_item_refresh (SeahorseGkrItem *self)
{
- SeahorseGkrItem *self = SEAHORSE_GKR_ITEM (obj);
-
if (self->pv->item_info)
load_item_info (self);
if (self->pv->item_attrs)
load_item_attrs (self);
if (self->pv->item_secret)
load_item_secret (self);
-
- SEAHORSE_OBJECT_CLASS (seahorse_gkr_item_parent_class)->refresh (obj);
}
static void
@@ -502,23 +495,20 @@ seahorse_gkr_item_init (SeahorseGkrItem *self)
g_object_set (self, "usage", SEAHORSE_USAGE_CREDENTIALS, "tag", SEAHORSE_GKR_TYPE, "location", SEAHORSE_LOCATION_LOCAL, NULL);
}
-static GObject*
-seahorse_gkr_item_constructor (GType type, guint n_props, GObjectConstructParam *props)
+static void
+seahorse_gkr_item_constructed (GObject *object)
{
- GObject *obj = G_OBJECT_CLASS (seahorse_gkr_item_parent_class)->constructor (type, n_props, props);
- SeahorseGkrItem *self = NULL;
+ SeahorseGkrItem *self = SEAHORSE_GKR_ITEM (object);
GQuark id;
-
- if (obj) {
- self = SEAHORSE_GKR_ITEM (obj);
-
- id = seahorse_gkr_item_get_cannonical (self->pv->keyring_name,
- self->pv->item_id);
- g_object_set (self, "id", id,
- "usage", SEAHORSE_USAGE_CREDENTIALS, NULL);
- }
-
- return obj;
+
+ G_OBJECT_CLASS (seahorse_gkr_item_parent_class)->constructed (object);
+
+ id = seahorse_gkr_item_get_cannonical (self->pv->keyring_name,
+ self->pv->item_id);
+ g_object_set (self, "id", id,
+ "usage", SEAHORSE_USAGE_CREDENTIALS, NULL);
+
+ seahorse_gkr_item_realize (self);
}
static void
@@ -608,19 +598,14 @@ static void
seahorse_gkr_item_class_init (SeahorseGkrItemClass *klass)
{
GObjectClass *gobject_class;
- SeahorseObjectClass *seahorse_class;
-
+
seahorse_gkr_item_parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->constructor = seahorse_gkr_item_constructor;
+ gobject_class->constructed = seahorse_gkr_item_constructed;
gobject_class->finalize = seahorse_gkr_item_finalize;
gobject_class->set_property = seahorse_gkr_item_set_property;
gobject_class->get_property = seahorse_gkr_item_get_property;
-
- seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
- seahorse_class->realize = seahorse_gkr_item_realize;
- seahorse_class->refresh = seahorse_gkr_item_refresh;
g_type_class_add_private (klass, sizeof (SeahorseGkrItemPrivate));
@@ -699,7 +684,7 @@ seahorse_gkr_item_set_info (SeahorseGkrItem *self, GnomeKeyringItemInfo* info)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- seahorse_gkr_item_realize (SEAHORSE_OBJECT (self));
+ seahorse_gkr_item_realize (self);
g_object_notify (obj, "item-info");
g_object_notify (obj, "use");
@@ -753,7 +738,7 @@ seahorse_gkr_item_set_attributes (SeahorseGkrItem *self, GnomeKeyringAttributeLi
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- seahorse_gkr_item_realize (SEAHORSE_OBJECT (self));
+ seahorse_gkr_item_realize (self);
g_object_notify (obj, "item-attributes");
g_object_notify (obj, "use");
g_object_thaw_notify (obj);
diff --git a/gkr/seahorse-gkr-item.h b/gkr/seahorse-gkr-item.h
index 45016e2..aa96504 100644
--- a/gkr/seahorse-gkr-item.h
+++ b/gkr/seahorse-gkr-item.h
@@ -67,6 +67,10 @@ SeahorseGkrItem* seahorse_gkr_item_new (SeahorseSourc
const gchar *keyring_name,
guint32 item_id);
+void seahorse_gkr_item_refresh (SeahorseGkrItem *self);
+
+void seahorse_gkr_item_realize (SeahorseGkrItem *self);
+
guint32 seahorse_gkr_item_get_item_id (SeahorseGkrItem *self);
const gchar* seahorse_gkr_item_get_keyring_name (SeahorseGkrItem *self);
diff --git a/gkr/seahorse-gkr-keyring.c b/gkr/seahorse-gkr-keyring.c
index 32ac870..5e15cb0 100644
--- a/gkr/seahorse-gkr-keyring.c
+++ b/gkr/seahorse-gkr-keyring.c
@@ -112,10 +112,9 @@ require_keyring_info (SeahorseGkrKeyring *self)
* OBJECT
*/
-static void
-seahorse_gkr_keyring_realize (SeahorseObject *obj)
+void
+seahorse_gkr_keyring_realize (SeahorseGkrKeyring *self)
{
- SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (obj);
gchar *name, *markup;
name = g_strdup_printf (_("Passwords: %s"), self->pv->keyring_name);
@@ -134,19 +133,13 @@ seahorse_gkr_keyring_realize (SeahorseObject *obj)
g_free (name);
g_free (markup);
-
- SEAHORSE_OBJECT_CLASS (seahorse_gkr_keyring_parent_class)->realize (obj);
}
-static void
-seahorse_gkr_keyring_refresh (SeahorseObject *obj)
+void
+seahorse_gkr_keyring_refresh (SeahorseGkrKeyring *self)
{
- SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (obj);
-
if (self->pv->keyring_info)
load_keyring_info (self);
-
- SEAHORSE_OBJECT_CLASS (seahorse_gkr_keyring_parent_class)->refresh (obj);
}
typedef struct {
@@ -447,8 +440,7 @@ static void
seahorse_gkr_keyring_class_init (SeahorseGkrKeyringClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseObjectClass *seahorse_class;
-
+
seahorse_gkr_keyring_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (SeahorseGkrKeyringPrivate));
@@ -457,10 +449,6 @@ seahorse_gkr_keyring_class_init (SeahorseGkrKeyringClass *klass)
gobject_class->set_property = seahorse_gkr_keyring_set_property;
gobject_class->get_property = seahorse_gkr_keyring_get_property;
- seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
- seahorse_class->realize = seahorse_gkr_keyring_realize;
- seahorse_class->refresh = seahorse_gkr_keyring_refresh;
-
g_object_class_override_property (gobject_class, PROP_SOURCE_TAG, "source-tag");
g_object_class_override_property (gobject_class, PROP_SOURCE_LOCATION, "source-location");
@@ -525,7 +513,7 @@ seahorse_gkr_keyring_set_info (SeahorseGkrKeyring *self, GnomeKeyringInfo *info)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- seahorse_gkr_keyring_realize (SEAHORSE_OBJECT (self));
+ seahorse_gkr_keyring_realize (self);
g_object_notify (obj, "keyring-info");
g_object_thaw_notify (obj);
}
diff --git a/gkr/seahorse-gkr-keyring.h b/gkr/seahorse-gkr-keyring.h
index d0e455b..a99eaf9 100644
--- a/gkr/seahorse-gkr-keyring.h
+++ b/gkr/seahorse-gkr-keyring.h
@@ -52,6 +52,10 @@ GType seahorse_gkr_keyring_get_type (void);
SeahorseGkrKeyring* seahorse_gkr_keyring_new (const gchar *keyring_name);
+void seahorse_gkr_keyring_refresh (SeahorseGkrKeyring *self);
+
+void seahorse_gkr_keyring_realize (SeahorseGkrKeyring *self);
+
const gchar* seahorse_gkr_keyring_get_name (SeahorseGkrKeyring *self);
GnomeKeyringInfo* seahorse_gkr_keyring_get_info (SeahorseGkrKeyring *self);
diff --git a/libseahorse/seahorse-object.c b/libseahorse/seahorse-object.c
index 25898ef..6de1e79 100644
--- a/libseahorse/seahorse-object.c
+++ b/libseahorse/seahorse-object.c
@@ -92,8 +92,6 @@ enum _SeahorseObjectProps {
* @location: describes the loaction of the object (local, remte, invalid...)
* @usage: DBUS: "etype"
* @flags:
- * @realizing: set while the object is realizing
- * @realized: set as soon as the object is realized
*/
struct _SeahorseObjectPrivate {
GQuark id;
@@ -120,9 +118,6 @@ struct _SeahorseObjectPrivate {
SeahorseLocation location;
SeahorseUsage usage;
guint flags;
-
- gboolean realized;
- gboolean realizing;
};
G_DEFINE_TYPE (SeahorseObject, seahorse_object, G_TYPE_OBJECT);
@@ -656,40 +651,6 @@ seahorse_object_set_property (GObject *obj, guint prop_id, const GValue *value,
}
/**
- * seahorse_object_real_realize:
- * @self: The object
- *
- * To be overridden
- *
- */
-static void
-seahorse_object_real_realize (SeahorseObject *self)
-{
- /*
- * We do nothing by default. It's up to the derived class
- * to override this and realize themselves when called.
- */
-
- self->pv->realized = TRUE;
-}
-
-/**
- * seahorse_object_real_refresh:
- * @self: The object
- *
- * To be overridden
- *
- */
-static void
-seahorse_object_real_refresh (SeahorseObject *self)
-{
- /*
- * We do nothing by default. It's up to the derived class
- * to override this and refresh themselves when called.
- */
-}
-
-/**
* seahorse_object_class_init:
* @klass: the object class
*
@@ -708,10 +669,7 @@ seahorse_object_class_init (SeahorseObjectClass *klass)
gobject_class->finalize = seahorse_object_finalize;
gobject_class->set_property = seahorse_object_set_property;
gobject_class->get_property = seahorse_object_get_property;
-
- klass->realize = seahorse_object_real_realize;
- klass->refresh = seahorse_object_real_refresh;
-
+
g_object_class_install_property (gobject_class, PROP_SOURCE,
g_param_spec_object ("source", "Object Source", "Source the Object came from",
SEAHORSE_TYPE_SOURCE, G_PARAM_READWRITE));
@@ -800,9 +758,7 @@ GQuark
seahorse_object_get_tag (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0);
- if (!self->pv->tag)
- seahorse_object_realize (self);
- return self->pv->tag;
+ return self->pv->tag;
}
/**
@@ -947,7 +903,6 @@ GList*
seahorse_object_get_children (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
return g_list_copy (self->pv->children);
}
@@ -975,7 +930,6 @@ const gchar*
seahorse_object_get_label (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
return self->pv->label;
}
@@ -989,7 +943,6 @@ const gchar*
seahorse_object_get_markup (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
return self->pv->markup;
}
@@ -1003,7 +956,6 @@ const gchar*
seahorse_object_get_nickname (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
return self->pv->nickname;
}
@@ -1017,7 +969,6 @@ const gchar*
seahorse_object_get_description (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
return self->pv->description;
}
@@ -1031,7 +982,6 @@ const gchar*
seahorse_object_get_icon (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
return self->pv->icon;
}
@@ -1045,8 +995,7 @@ const gchar*
seahorse_object_get_identifier (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
- seahorse_object_realize (self);
- return self->pv->identifier;
+ return self->pv->identifier;
}
/**
@@ -1059,8 +1008,6 @@ SeahorseLocation
seahorse_object_get_location (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), SEAHORSE_LOCATION_INVALID);
- if (self->pv->location == SEAHORSE_LOCATION_INVALID)
- seahorse_object_realize (self);
return self->pv->location;
}
@@ -1074,8 +1021,6 @@ SeahorseUsage
seahorse_object_get_usage (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), SEAHORSE_USAGE_NONE);
- if (self->pv->usage == SEAHORSE_USAGE_NONE)
- seahorse_object_realize (self);
return self->pv->usage;
}
@@ -1089,7 +1034,6 @@ guint
seahorse_object_get_flags (SeahorseObject *self)
{
g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0);
- seahorse_object_realize (self);
return self->pv->flags;
}
@@ -1148,46 +1092,6 @@ seahorse_object_lookup_property (SeahorseObject *self, const gchar *field, GValu
}
/**
- * seahorse_object_realize:
- * @self: the object to realize
- *
- *
- * Realizes an object. Calls the klass method
- */
-void
-seahorse_object_realize (SeahorseObject *self)
-{
- SeahorseObjectClass *klass;
- g_return_if_fail (SEAHORSE_IS_OBJECT (self));
- if (self->pv->realized)
- return;
- if (self->pv->realizing)
- return;
- klass = SEAHORSE_OBJECT_GET_CLASS (self);
- g_return_if_fail (klass->realize);
- self->pv->realizing = TRUE;
- (klass->realize) (self);
- self->pv->realizing = FALSE;
-}
-
-/**
- * seahorse_object_refresh:
- * @self: object to refresh
- *
- * calls the class refresh function
- *
- */
-void
-seahorse_object_refresh (SeahorseObject *self)
-{
- SeahorseObjectClass *klass;
- g_return_if_fail (SEAHORSE_IS_OBJECT (self));
- klass = SEAHORSE_OBJECT_GET_CLASS (self);
- g_return_if_fail (klass->refresh);
- (klass->refresh) (self);
-}
-
-/**
* seahorse_object_predicate_match:
* @self: the object to test
* @obj: The predicate to match
@@ -1203,9 +1107,7 @@ seahorse_object_predicate_match (SeahorseObjectPredicate *self, SeahorseObject*
g_return_val_if_fail (SEAHORSE_IS_OBJECT (obj), FALSE);
pv = obj->pv;
-
- seahorse_object_realize (obj);
-
+
/* Check all the fields */
if (self->tag != 0 && self->tag != pv->tag)
return FALSE;
diff --git a/libseahorse/seahorse-object.h b/libseahorse/seahorse-object.h
index 7701187..178f8e2 100644
--- a/libseahorse/seahorse-object.h
+++ b/libseahorse/seahorse-object.h
@@ -68,22 +68,12 @@ struct _SeahorseObject {
struct _SeahorseObjectClass {
GObjectClass parent_class;
-
- /* virtual methods ------------------------------------------------- */
-
- void (*realize) (SeahorseObject *self);
-
- void (*refresh) (SeahorseObject *self);
};
GType seahorse_object_get_type (void);
SeahorseObject* seahorse_object_new (void);
-void seahorse_object_realize (SeahorseObject *self);
-
-void seahorse_object_refresh (SeahorseObject *self);
-
GQuark seahorse_object_get_id (SeahorseObject *self);
GQuark seahorse_object_get_tag (SeahorseObject *self);
diff --git a/pgp/seahorse-gpgme-key.c b/pgp/seahorse-gpgme-key.c
index dc4a06e..e5d7697 100644
--- a/pgp/seahorse-gpgme-key.c
+++ b/pgp/seahorse-gpgme-key.c
@@ -294,22 +294,21 @@ realize_subkeys (SeahorseGpgmeKey *self)
}
static void
-refresh_each_object (SeahorseObject *object, gpointer data)
+refresh_each_gpgme_key (SeahorseObject *object, gpointer data)
{
- seahorse_object_refresh (object);
+ seahorse_gpgme_key_refresh (SEAHORSE_GPGME_KEY (object));
}
/* -----------------------------------------------------------------------------
* OBJECT
*/
-static void
-seahorse_gpgme_key_realize (SeahorseObject *obj)
+void
+seahorse_gpgme_key_realize (SeahorseGpgmeKey *self)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
SeahorseUsage usage;
guint flags;
-
+
if (!self->pv->pubkey)
return;
@@ -350,34 +349,28 @@ seahorse_gpgme_key_realize (SeahorseObject *obj)
!self->pv->pubkey->expired)
flags |= SEAHORSE_FLAG_TRUSTED;
- g_object_set (obj, "flags", flags, NULL);
-
+ g_object_set (self, "flags", flags, NULL);
+
/* The type */
if (self->pv->seckey)
usage = SEAHORSE_USAGE_PRIVATE_KEY;
else
usage = SEAHORSE_USAGE_PUBLIC_KEY;
- g_object_set (obj, "usage", usage, NULL);
-
- ++self->pv->block_loading;
- SEAHORSE_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->realize (obj);
- --self->pv->block_loading;
+ g_object_set (self, "usage", usage, NULL);
+
+ seahorse_pgp_key_realize (SEAHORSE_PGP_KEY (self));
}
-static void
-seahorse_gpgme_key_refresh (SeahorseObject *obj)
+void
+seahorse_gpgme_key_refresh (SeahorseGpgmeKey *self)
{
- SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (obj);
-
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);
-
- SEAHORSE_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->refresh (obj);
}
static GList*
@@ -444,6 +437,16 @@ seahorse_gpgme_key_init (SeahorseGpgmeKey *self)
}
static void
+seahorse_gpgme_key_object_constructed (GObject *object)
+{
+ SeahorseGpgmeKey *self = SEAHORSE_GPGME_KEY (object);
+
+ G_OBJECT_CLASS (seahorse_gpgme_key_parent_class)->constructed (object);
+
+ seahorse_gpgme_key_realize (self);
+}
+
+static void
seahorse_gpgme_key_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
@@ -519,19 +522,16 @@ static void
seahorse_gpgme_key_class_init (SeahorseGpgmeKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseObjectClass *seahorse_class = SEAHORSE_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_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;
-
- seahorse_class->refresh = seahorse_gpgme_key_refresh;
- seahorse_class->realize = seahorse_gpgme_key_realize;
pgp_class->get_uids = seahorse_gpgme_key_get_uids;
pgp_class->set_uids = seahorse_gpgme_key_set_uids;
@@ -602,7 +602,7 @@ seahorse_gpgme_key_set_public (SeahorseGpgmeKey *self, gpgme_key_t key)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- seahorse_gpgme_key_realize (SEAHORSE_OBJECT (self));
+ seahorse_gpgme_key_realize (self);
g_object_notify (obj, "fingerprint");
g_object_notify (obj, "validity");
g_object_notify (obj, "validity-str");
@@ -639,7 +639,7 @@ seahorse_gpgme_key_set_private (SeahorseGpgmeKey *self, gpgme_key_t key)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- seahorse_gpgme_key_realize (SEAHORSE_OBJECT (self));
+ seahorse_gpgme_key_realize (self);
g_object_thaw_notify (obj);
}
@@ -681,6 +681,6 @@ seahorse_gpgme_key_refresh_matching (gpgme_key_t key)
memset (&pred, 0, sizeof (pred));
pred.type = SEAHORSE_TYPE_GPGME_KEY;
pred.id = seahorse_pgp_key_canonize_id (key->subkeys->keyid);
-
- seahorse_context_for_objects_full (NULL, &pred, refresh_each_object, NULL);
+
+ seahorse_context_for_objects_full (NULL, &pred, refresh_each_gpgme_key, NULL);
}
diff --git a/pgp/seahorse-gpgme-key.h b/pgp/seahorse-gpgme-key.h
index 542a5f7..2931b41 100644
--- a/pgp/seahorse-gpgme-key.h
+++ b/pgp/seahorse-gpgme-key.h
@@ -53,6 +53,10 @@ SeahorseGpgmeKey* seahorse_gpgme_key_new (SeahorseSource *sksrc,
gpgme_key_t pubkey,
gpgme_key_t seckey);
+void seahorse_gpgme_key_refresh (SeahorseGpgmeKey *self);
+
+void seahorse_gpgme_key_realize (SeahorseGpgmeKey *self);
+
GType seahorse_gpgme_key_get_type (void);
gpgme_key_t seahorse_gpgme_key_get_public (SeahorseGpgmeKey *self);
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 1e63b03..eabf62d 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -1864,18 +1864,15 @@ seahorse_pgp_key_properties_show (SeahorsePgpKey *pkey, GtkWindow *parent)
SeahorseObject *sobj = SEAHORSE_OBJECT (pkey);
SeahorseSource *sksrc;
SeahorseWidget *swidget;
- gboolean remote;
-
- remote = seahorse_object_get_location (sobj) == SEAHORSE_LOCATION_REMOTE;
/* Reload the key to make sure to get all the props */
sksrc = seahorse_object_get_source (sobj);
g_return_if_fail (sksrc != NULL);
/* Don't trigger the import of remote keys if possible */
- if (!remote) {
+ if (SEAHORSE_IS_GPGME_KEY (pkey)) {
/* This causes the key source to get any specific info about the key */
- seahorse_object_refresh (SEAHORSE_OBJECT (pkey));
+ seahorse_gpgme_key_refresh (SEAHORSE_GPGME_KEY (pkey));
sobj = seahorse_context_get_object (SCTX_APP(), sksrc, seahorse_object_get_id (sobj));
g_return_if_fail (sobj != NULL);
}
diff --git a/pgp/seahorse-pgp-key.c b/pgp/seahorse-pgp-key.c
index 1771dcf..530957b 100644
--- a/pgp/seahorse-pgp-key.c
+++ b/pgp/seahorse-pgp-key.c
@@ -168,19 +168,15 @@ _seahorse_pgp_key_set_photos (SeahorsePgpKey *self, GList *photos)
g_object_notify (G_OBJECT (self), "photos");
}
-static void
-seahorse_pgp_key_realize (SeahorseObject *obj)
+void
+seahorse_pgp_key_realize (SeahorsePgpKey *self)
{
- SeahorsePgpKey *self = SEAHORSE_PGP_KEY (obj);
const gchar *nickname, *keyid;
const gchar *description, *icon;
gchar *markup, *name, *identifier;
SeahorseUsage usage;
GList *subkeys;
-
-
- SEAHORSE_OBJECT_CLASS (seahorse_pgp_key_parent_class)->realize (obj);
-
+
subkeys = seahorse_pgp_key_get_subkeys (self);
if (subkeys) {
keyid = seahorse_pgp_subkey_get_keyid (subkeys->data);
@@ -190,11 +186,11 @@ seahorse_pgp_key_realize (SeahorseObject *obj)
}
name = calc_name (self);
- markup = calc_markup (self, seahorse_object_get_flags (obj));
+ markup = calc_markup (self, seahorse_object_get_flags (SEAHORSE_OBJECT (self)));
nickname = calc_short_name (self);
-
- g_object_get (obj, "usage", &usage, NULL);
-
+
+ g_object_get (self, "usage", &usage, NULL);
+
/* The type */
if (usage == SEAHORSE_USAGE_PRIVATE_KEY) {
description = _("Private PGP Key");
@@ -203,10 +199,10 @@ seahorse_pgp_key_realize (SeahorseObject *obj)
description = _("Public PGP Key");
icon = SEAHORSE_STOCK_KEY;
if (usage == SEAHORSE_USAGE_NONE)
- g_object_set (obj, "usage", SEAHORSE_USAGE_PUBLIC_KEY, NULL);
+ g_object_set (self, "usage", SEAHORSE_USAGE_PUBLIC_KEY, NULL);
}
-
- g_object_set (obj,
+
+ g_object_set (self,
"label", name,
"markup", markup,
"nickname", nickname,
@@ -332,8 +328,7 @@ static void
seahorse_pgp_key_class_init (SeahorsePgpKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
-
+
seahorse_pgp_key_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (SeahorsePgpKeyPrivate));
@@ -341,9 +336,7 @@ seahorse_pgp_key_class_init (SeahorsePgpKeyClass *klass)
gobject_class->finalize = seahorse_pgp_key_object_finalize;
gobject_class->set_property = seahorse_pgp_key_set_property;
gobject_class->get_property = seahorse_pgp_key_get_property;
-
- seahorse_class->realize = seahorse_pgp_key_realize;
-
+
klass->get_uids = _seahorse_pgp_key_get_uids;
klass->set_uids = _seahorse_pgp_key_set_uids;
klass->get_subkeys = _seahorse_pgp_key_get_subkeys;
diff --git a/pgp/seahorse-pgp-key.h b/pgp/seahorse-pgp-key.h
index 4a3181e..a7cbd6b 100644
--- a/pgp/seahorse-pgp-key.h
+++ b/pgp/seahorse-pgp-key.h
@@ -69,6 +69,8 @@ GType seahorse_pgp_key_get_type (void);
SeahorsePgpKey* seahorse_pgp_key_new (void);
+void seahorse_pgp_key_realize (SeahorsePgpKey *self);
+
GList* seahorse_pgp_key_get_subkeys (SeahorsePgpKey *self);
void seahorse_pgp_key_set_subkeys (SeahorsePgpKey *self,
diff --git a/pgp/seahorse-pgp-uid.c b/pgp/seahorse-pgp-uid.c
index dbf6871..de32ccd 100644
--- a/pgp/seahorse-pgp-uid.c
+++ b/pgp/seahorse-pgp-uid.c
@@ -199,10 +199,9 @@ parse_user_id (const gchar *uid, gchar **name, gchar **email, gchar **comment)
* OBJECT
*/
-static void
-seahorse_pgp_uid_realize (SeahorseObject *obj)
+void
+seahorse_pgp_uid_realize (SeahorsePgpUid *self)
{
- SeahorsePgpUid *self = SEAHORSE_PGP_UID (obj);
gchar *markup;
/* Don't realize if no name present */
@@ -210,7 +209,6 @@ seahorse_pgp_uid_realize (SeahorseObject *obj)
return;
self->pv->realized = TRUE;
- SEAHORSE_OBJECT_CLASS (seahorse_pgp_uid_parent_class)->realize (obj);
g_object_set (self, "label", self->pv->name ? self->pv->name : "", NULL);
markup = seahorse_pgp_uid_calc_markup (self->pv->name, self->pv->email, self->pv->comment, 0);
@@ -227,6 +225,13 @@ seahorse_pgp_uid_init (SeahorsePgpUid *self)
}
static void
+seahorse_pgp_uid_constructed (GObject *object)
+{
+ G_OBJECT_CLASS (seahorse_pgp_uid_parent_class)->constructed (object);
+ seahorse_pgp_uid_realize (SEAHORSE_PGP_UID (object));
+}
+
+static void
seahorse_pgp_uid_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
@@ -307,12 +312,11 @@ seahorse_pgp_uid_class_init (SeahorsePgpUidClass *klass)
seahorse_pgp_uid_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (SeahorsePgpUidPrivate));
+ gobject_class->constructed = seahorse_pgp_uid_constructed;
gobject_class->finalize = seahorse_pgp_uid_object_finalize;
gobject_class->set_property = seahorse_pgp_uid_set_property;
gobject_class->get_property = seahorse_pgp_uid_get_property;
-
- SEAHORSE_OBJECT_CLASS (klass)->realize = seahorse_pgp_uid_realize;
-
+
g_object_class_install_property (gobject_class, PROP_VALIDITY,
g_param_spec_uint ("validity", "Validity", "Validity of this identity",
0, G_MAXUINT, 0, G_PARAM_READWRITE));
@@ -423,8 +427,8 @@ seahorse_pgp_uid_set_name (SeahorsePgpUid *self, const gchar *name)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- if (self->pv->realized)
- seahorse_pgp_uid_realize (SEAHORSE_OBJECT (self));
+ if (!self->pv->realized)
+ seahorse_pgp_uid_realize (self);
g_object_notify (obj, "name");
g_object_thaw_notify (obj);
}
@@ -450,8 +454,8 @@ seahorse_pgp_uid_set_email (SeahorsePgpUid *self, const gchar *email)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- if (self->pv->realized)
- seahorse_pgp_uid_realize (SEAHORSE_OBJECT (self));
+ if (!self->pv->realized)
+ seahorse_pgp_uid_realize (self);
g_object_notify (obj, "email");
g_object_thaw_notify (obj);
}
@@ -477,8 +481,8 @@ seahorse_pgp_uid_set_comment (SeahorsePgpUid *self, const gchar *comment)
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- if (self->pv->realized)
- seahorse_pgp_uid_realize (SEAHORSE_OBJECT (self));
+ if (!self->pv->realized)
+ seahorse_pgp_uid_realize (self);
g_object_notify (obj, "comment");
g_object_thaw_notify (obj);
}
diff --git a/pgp/seahorse-pgp-uid.h b/pgp/seahorse-pgp-uid.h
index 7bd6c7b..e5a5d2d 100644
--- a/pgp/seahorse-pgp-uid.h
+++ b/pgp/seahorse-pgp-uid.h
@@ -52,6 +52,8 @@ GType seahorse_pgp_uid_get_type (void);
SeahorsePgpUid* seahorse_pgp_uid_new (const gchar *uid_string);
+void seahorse_pgp_uid_realize (SeahorsePgpUid *self);
+
GList* seahorse_pgp_uid_get_signatures (SeahorsePgpUid *self);
void seahorse_pgp_uid_set_signatures (SeahorsePgpUid *self,
diff --git a/pkcs11/seahorse-pkcs11-certificate.c b/pkcs11/seahorse-pkcs11-certificate.c
index a7e48bd..3c25316 100644
--- a/pkcs11/seahorse-pkcs11-certificate.c
+++ b/pkcs11/seahorse-pkcs11-certificate.c
@@ -93,22 +93,19 @@ calc_display_id (SeahorsePkcs11Certificate* self)
* OBJECT
*/
-static void
-seahorse_pkcs11_certificate_realize (SeahorseObject *obj)
+void
+seahorse_pkcs11_certificate_realize (SeahorsePkcs11Certificate *self)
{
- SeahorsePkcs11Certificate *self = SEAHORSE_PKCS11_CERTIFICATE (obj);
gchar *identifier = NULL;
guint flags;
- SEAHORSE_OBJECT_CLASS (seahorse_pkcs11_certificate_parent_class)->realize (obj);
-
seahorse_pkcs11_object_require_attributes (SEAHORSE_PKCS11_OBJECT (self),
REQUIRED_ATTRS, G_N_ELEMENTS (REQUIRED_ATTRS));
-
- if (!seahorse_object_get_label (obj))
+
+ if (!seahorse_object_get_label (SEAHORSE_OBJECT (self)))
g_object_set (self, "label", _("Certificate"), NULL);
- flags = seahorse_object_get_flags (obj) | SEAHORSE_FLAG_DELETABLE;
+ flags = seahorse_object_get_flags (SEAHORSE_OBJECT (self)) | SEAHORSE_FLAG_DELETABLE;
/* TODO: Expiry, revoked, disabled etc... */
if (seahorse_pkcs11_certificate_get_trust (self) >= SEAHORSE_VALIDITY_MARGINAL)
@@ -221,8 +218,7 @@ static void
seahorse_pkcs11_certificate_class_init (SeahorsePkcs11CertificateClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
-
+
seahorse_pkcs11_certificate_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (SeahorsePkcs11CertificatePrivate));
@@ -232,8 +228,6 @@ seahorse_pkcs11_certificate_class_init (SeahorsePkcs11CertificateClass *klass)
gobject_class->get_property = seahorse_pkcs11_certificate_get_property;
gobject_class->notify = seahorse_pkcs11_certificate_notify;
- seahorse_class->realize = seahorse_pkcs11_certificate_realize;
-
g_object_class_install_property (gobject_class, PROP_FINGERPRINT,
g_param_spec_string ("fingerprint", "fingerprint", "fingerprint", NULL,
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
diff --git a/pkcs11/seahorse-pkcs11-object.c b/pkcs11/seahorse-pkcs11-object.c
index 2f6fd8f..da8bd14 100644
--- a/pkcs11/seahorse-pkcs11-object.c
+++ b/pkcs11/seahorse-pkcs11-object.c
@@ -140,19 +140,14 @@ load_object_attributes (SeahorsePkcs11Object *self, const gulong *attr_types,
* OBJECT
*/
-static void
-seahorse_pkcs11_object_realize (SeahorseObject *obj)
+void
+seahorse_pkcs11_object_realize (SeahorsePkcs11Object *self)
{
- SeahorsePkcs11Object *self = SEAHORSE_PKCS11_OBJECT (obj);
gboolean exportable;
gchar *label = NULL;
guint flags;
- SEAHORSE_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->realize (obj);
-
seahorse_pkcs11_object_require_attributes (self, REQUIRED_ATTRS, G_N_ELEMENTS (REQUIRED_ATTRS));
-
- g_assert (SEAHORSE_PKCS11_IS_OBJECT (obj));
flags = SEAHORSE_FLAG_DELETABLE;
if (gck_attributes_find_boolean (self->pv->pkcs11_attributes, CKA_EXTRACTABLE, &exportable) && exportable)
@@ -168,12 +163,11 @@ seahorse_pkcs11_object_realize (SeahorseObject *obj)
g_free (label);
}
-static void
-seahorse_pkcs11_object_refresh (SeahorseObject *obj)
+void
+seahorse_pkcs11_object_refresh (SeahorsePkcs11Object *self)
{
/* Reload the same attributes */
- load_object_attributes (SEAHORSE_PKCS11_OBJECT (obj), NULL, 0);
- SEAHORSE_OBJECT_CLASS (seahorse_pkcs11_object_parent_class)->refresh (obj);
+ load_object_attributes (self, NULL, 0);
}
static GObject*
@@ -270,8 +264,7 @@ static void
seahorse_pkcs11_object_class_init (SeahorsePkcs11ObjectClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
-
+
seahorse_pkcs11_object_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (SeahorsePkcs11ObjectPrivate));
@@ -281,9 +274,6 @@ seahorse_pkcs11_object_class_init (SeahorsePkcs11ObjectClass *klass)
gobject_class->set_property = seahorse_pkcs11_object_set_property;
gobject_class->get_property = seahorse_pkcs11_object_get_property;
- seahorse_class->realize = seahorse_pkcs11_object_realize;
- seahorse_class->refresh = seahorse_pkcs11_object_refresh;
-
g_object_class_install_property (gobject_class, PROP_PKCS11_OBJECT,
g_param_spec_object ("pkcs11-object", "pkcs11-object", "pkcs11-object", GCK_TYPE_OBJECT,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
@@ -339,7 +329,7 @@ seahorse_pkcs11_object_set_pkcs11_attributes (SeahorsePkcs11Object* self, GckAtt
obj = G_OBJECT (self);
g_object_freeze_notify (obj);
- seahorse_pkcs11_object_realize (SEAHORSE_OBJECT (obj));
+ seahorse_pkcs11_object_realize (self);
g_object_notify (obj, "pkcs11-attributes");
g_object_thaw_notify (obj);
diff --git a/pkcs11/seahorse-pkcs11-object.h b/pkcs11/seahorse-pkcs11-object.h
index 4b8cac9..b3612a8 100644
--- a/pkcs11/seahorse-pkcs11-object.h
+++ b/pkcs11/seahorse-pkcs11-object.h
@@ -52,6 +52,10 @@ GType seahorse_pkcs11_object_get_type (void)
SeahorsePkcs11Object* seahorse_pkcs11_object_new (GckObject* object);
+void seahorse_pkcs11_object_refresh (SeahorsePkcs11Object *self);
+
+void seahorse_pkcs11_object_realize (SeahorsePkcs11Object *self);
+
gulong seahorse_pkcs11_object_get_pkcs11_handle (SeahorsePkcs11Object* self);
GckObject* seahorse_pkcs11_object_get_pkcs11_object (SeahorsePkcs11Object* self);
diff --git a/pkcs11/seahorse-pkcs11-source.c b/pkcs11/seahorse-pkcs11-source.c
index 4eac5d5..4320d4d 100644
--- a/pkcs11/seahorse-pkcs11-source.c
+++ b/pkcs11/seahorse-pkcs11-source.c
@@ -227,7 +227,7 @@ seahorse_pkcs11_source_receive_object (SeahorsePkcs11Source *self, GckObject *ob
prev = seahorse_context_get_object (NULL, SEAHORSE_SOURCE (self), id);
if (prev) {
- seahorse_object_refresh (prev);
+ seahorse_pkcs11_object_refresh (SEAHORSE_PKCS11_OBJECT (prev));
g_object_unref (obj);
return;
}
diff --git a/ssh/seahorse-ssh-key.c b/ssh/seahorse-ssh-key.c
index 3e1c8d7..2bc7222 100644
--- a/ssh/seahorse-ssh-key.c
+++ b/ssh/seahorse-ssh-key.c
@@ -157,11 +157,10 @@ calc_trust (SeahorseSSHKey *skey)
* OBJECT
*/
-static void
-seahorse_ssh_key_refresh (SeahorseObject *sobj)
+void
+seahorse_ssh_key_refresh (SeahorseSSHKey *self)
{
/* TODO: Need to work on key refreshing */
- SEAHORSE_OBJECT_CLASS (seahorse_ssh_key_parent_class)->refresh (sobj);
}
static void
@@ -232,16 +231,13 @@ static void
seahorse_ssh_key_class_init (SeahorseSSHKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseObjectClass *seahorse_class = SEAHORSE_OBJECT_CLASS (klass);
-
+
seahorse_ssh_key_parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = seahorse_ssh_key_finalize;
gobject_class->set_property = seahorse_ssh_key_set_property;
gobject_class->get_property = seahorse_ssh_key_get_property;
- seahorse_class->refresh = seahorse_ssh_key_refresh;
-
g_object_class_install_property (gobject_class, PROP_KEY_DATA,
g_param_spec_pointer ("key-data", "SSH Key Data", "SSH key data pointer",
G_PARAM_READWRITE));
diff --git a/ssh/seahorse-ssh-key.h b/ssh/seahorse-ssh-key.h
index 2e0df23..3cfd01e 100644
--- a/ssh/seahorse-ssh-key.h
+++ b/ssh/seahorse-ssh-key.h
@@ -64,6 +64,8 @@ struct _SeahorseSSHKeyClass {
SeahorseSSHKey* seahorse_ssh_key_new (SeahorseSource *sksrc,
SeahorseSSHKeyData *data);
+void seahorse_ssh_key_refresh (SeahorseSSHKey *self);
+
GType seahorse_ssh_key_get_type (void);
guint seahorse_ssh_key_get_algo (SeahorseSSHKey *skey);
diff --git a/ssh/seahorse-ssh-operation.c b/ssh/seahorse-ssh-operation.c
index 9b7a13e..a065260 100644
--- a/ssh/seahorse-ssh-operation.c
+++ b/ssh/seahorse-ssh-operation.c
@@ -836,7 +836,7 @@ on_change_passphrase_complete (GObject *source,
GError *error = NULL;
if (seahorse_ssh_operation_finish (SEAHORSE_SSH_SOURCE (source), result, &error))
- seahorse_object_refresh (SEAHORSE_OBJECT (key));
+ seahorse_ssh_key_refresh (key);
else
g_simple_async_result_take_error (res, error);
@@ -1248,7 +1248,7 @@ seahorse_ssh_op_authorize_async (SeahorseSSHSource *source,
/* Just reload that one key */
if (!error)
- seahorse_object_refresh (SEAHORSE_OBJECT (key));
+ seahorse_ssh_key_refresh (key);
res = g_simple_async_result_new (G_OBJECT (source), callback, user_data,
seahorse_ssh_op_authorize_async);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]