static void seahorse_gpgme_uid_object_finalize (GObject *gobject) { SeahorseGpgmeUid *self = SEAHORSE_GPGME_UID (gobject); /* Unref the key */ if (self->pv->pubkey) gpgme_key_unref (self->pv->pubkey); self->pv->pubkey = NULL; self->pv->userid = NULL; G_OBJECT_CLASS (seahorse_gpgme_uid_parent_class)->finalize (gobject); }
static GObject* seahorse_gpgme_uid_constructor (GType type, guint n_props, GObjectConstructParam *props) { GObject *obj = G_OBJECT_CLASS (seahorse_gpgme_uid_parent_class)->constructor (type, n_props, props); SeahorseGpgmeUid *self = NULL; if (obj) { self = SEAHORSE_GPGME_UID (obj); g_object_set (self, "location", SEAHORSE_LOCATION_LOCAL, NULL); } return obj; }
static void seahorse_gpgme_uid_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { SeahorseGpgmeUid *self = SEAHORSE_GPGME_UID (object); switch (prop_id) { case PROP_PUBKEY: g_value_set_boxed (value, seahorse_gpgme_uid_get_pubkey (self)); break; case PROP_USERID: g_value_set_pointer (value, seahorse_gpgme_uid_get_userid (self)); break; case PROP_GPGME_INDEX: g_value_set_uint (value, seahorse_gpgme_uid_get_gpgme_index (self)); break; case PROP_ACTUAL_INDEX: g_value_set_uint (value, seahorse_gpgme_uid_get_actual_index (self)); break; } }
static void seahorse_gpgme_uid_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { SeahorseGpgmeUid *self = SEAHORSE_GPGME_UID (object); gpgme_key_t pubkey; switch (prop_id) { case PROP_PUBKEY: pubkey = g_value_get_boxed (value); g_return_if_fail (pubkey); if (pubkey != self->pv->pubkey) { if (self->pv->pubkey) { /* Should always be set to the same actual key */ g_return_if_fail (compare_pubkeys (pubkey, self->pv->pubkey)); gpgme_key_unref (self->pv->pubkey); } self->pv->pubkey = g_value_get_boxed (value); if (self->pv->pubkey) gpgme_key_ref (self->pv->pubkey); /* This is expected to be set shortly along with pubkey */ self->pv->userid = NULL; } break; case PROP_ACTUAL_INDEX: seahorse_gpgme_uid_set_actual_index (self, g_value_get_uint (value)); break; case PROP_USERID: seahorse_gpgme_uid_set_userid (self, g_value_get_pointer (value)); break; } }