Commit 139052bc authored by Stefan Walter's avatar Stefan Walter

Refactor and add SeahorseObject class as a base class of SeahorseKey, so

	* daemon/seahorse-daemon.c:
	* daemon/seahorse-service.c:
	* daemon/seahorse-service.h:
	* daemon/seahorse-service-crypto.c:
	* daemon/seahorse-service-keyset.c:
	* gkr/libseahorse-gkr-c.vapi:
	* gkr/seahorse-gkeyring-item.c:
	* gkr/seahorse-gkeyring-item.h:
	* gkr/seahorse-gkeyring-item-properties.c:
	* gkr/seahorse-gkeyring-operation.c:
	* gkr/seahorse-gkeyring-source.c:
	* gkr/seahorse-gkeyring-source.h:
	* gkr/seahorse-gkr-commands.vala:
	* libseahorse/libseahorse-c.vapi:
	* libseahorse/Makefile.am:
	* libseahorse/seahorse-combo-keys.c:
	* libseahorse/seahorse-combo-keys.h:
	* libseahorse/seahorse-commands.vala:
	* libseahorse/seahorse-context.c:
	* libseahorse/seahorse-context.h:
	* libseahorse/seahorse-dns-sd.c:
	* libseahorse/seahorse-key.c:
	* libseahorse/seahorse-key.h:
	* libseahorse/seahorse-keyset.c: (moved to seahorse-set.c)
	* libseahorse/seahorse-keyset.h: (moved to seahorse-set.h)
	* libseahorse/seahorse-key-source.c: (moved to seahorse-source.c)
	* libseahorse/seahorse-key-source.h: (moved to seahorse-source.h)
	* libseahorse/seahorse-notification.c:
	* libseahorse/seahorse-object.vala: (added)
	* libseahorse/seahorse-prefs-keyrings.c:
	* libseahorse/seahorse-set.c: (moved from seahorse-keyset.c)
	* libseahorse/seahorse-set.h: (moved from seahorse-keyset.h)
	* libseahorse/seahorse-source.c: (moved from seahorse-key-source.c)
	* libseahorse/seahorse-source.h: (moved from seahorse-key-source.h)
	* libseahorse/seahorse-transfer-operation.c:
	* libseahorse/seahorse-types.vala: (added)
	* libseahorse/seahorse-unknown-key.c:
	* libseahorse/seahorse-unknown-source.c:
	* libseahorse/seahorse-unknown-source.h:
	* libseahorse/seahorse-util.c:
	* libseahorse/seahorse-util.h:
	* libseahorse/seahorse-view.vala:
	* pgp/libseahorse-pgp-c.vala:
	* pgp/seahorse-hkp-source.c:
	* pgp/seahorse-ldap-source.c:
	* pgp/seahorse-pgp-commands.vala:
	* pgp/seahorse-pgp-delete.c:
	* pgp/seahorse-pgp-generator.vala:
	* pgp/seahorse-pgp-key.c:
	* pgp/seahorse-pgp-key.h:
	* pgp/seahorse-pgp-key-op.c:
	* pgp/seahorse-pgp-key-properties.c:
	* pgp/seahorse-pgp-keysets.c:
	* pgp/seahorse-pgp-keysets.h:
	* pgp/seahorse-pgp-sign.c:
	* pgp/seahorse-pgp-source.c:
	* pgp/seahorse-pgp-source.h:
	* pgp/seahorse-server-source.c:
	* pgp/seahorse-server-source.h:
	* pgp/seahorse-signer.c:
	* src/main.c:
	* src/seahorse-key-manager.vala:
	* src/seahorse-key-manager-store.c:
	* src/seahorse-key-manager-store.h:
	* src/seahorse-keyserver-results.vala:
	* src/seahorse-keyserver-search.c:
	* src/seahorse-keyserver-sync.c:
	* src/seahorse-viewer.vala:
	* ssh/libseahorse-ssh-c.vapi:
	* ssh/seahorse-delete.c:
	* ssh/seahorse-ssh-commands.vala:
	* ssh/seahorse-ssh-generator.vala:
	* ssh/seahorse-ssh-key.c:
	* ssh/seahorse-ssh-key.h:
	* ssh/seahorse-ssh-key-properties.c:
	* ssh/seahorse-ssh-operation.c:
	* ssh/seahorse-ssh-source.c:
	* ssh/seahorse-ssh-source.h:
	* ssh/seahorse-ssh-upload.c: Refactor and add SeahorseObject class
	as a base class of SeahorseKey, so that we can have non-key objects
	in the mix.

svn path=/trunk/; revision=2278
parent 19266b84
2008-07-16 Stef Walter <stef@memberwebs.com>
* daemon/seahorse-daemon.c:
* daemon/seahorse-service.c:
* daemon/seahorse-service.h:
* daemon/seahorse-service-crypto.c:
* daemon/seahorse-service-keyset.c:
* gkr/libseahorse-gkr-c.vapi:
* gkr/seahorse-gkeyring-item.c:
* gkr/seahorse-gkeyring-item.h:
* gkr/seahorse-gkeyring-item-properties.c:
* gkr/seahorse-gkeyring-operation.c:
* gkr/seahorse-gkeyring-source.c:
* gkr/seahorse-gkeyring-source.h:
* gkr/seahorse-gkr-commands.vala:
* libseahorse/libseahorse-c.vapi:
* libseahorse/Makefile.am:
* libseahorse/seahorse-combo-keys.c:
* libseahorse/seahorse-combo-keys.h:
* libseahorse/seahorse-commands.vala:
* libseahorse/seahorse-context.c:
* libseahorse/seahorse-context.h:
* libseahorse/seahorse-dns-sd.c:
* libseahorse/seahorse-key.c:
* libseahorse/seahorse-key.h:
* libseahorse/seahorse-keyset.c: (moved to seahorse-set.c)
* libseahorse/seahorse-keyset.h: (moved to seahorse-set.h)
* libseahorse/seahorse-key-source.c: (moved to seahorse-source.c)
* libseahorse/seahorse-key-source.h: (moved to seahorse-source.h)
* libseahorse/seahorse-notification.c:
* libseahorse/seahorse-object.vala: (added)
* libseahorse/seahorse-prefs-keyrings.c:
* libseahorse/seahorse-set.c: (moved from seahorse-keyset.c)
* libseahorse/seahorse-set.h: (moved from seahorse-keyset.h)
* libseahorse/seahorse-source.c: (moved from seahorse-key-source.c)
* libseahorse/seahorse-source.h: (moved from seahorse-key-source.h)
* libseahorse/seahorse-transfer-operation.c:
* libseahorse/seahorse-types.vala: (added)
* libseahorse/seahorse-unknown-key.c:
* libseahorse/seahorse-unknown-source.c:
* libseahorse/seahorse-unknown-source.h:
* libseahorse/seahorse-util.c:
* libseahorse/seahorse-util.h:
* libseahorse/seahorse-view.vala:
* pgp/libseahorse-pgp-c.vala:
* pgp/seahorse-hkp-source.c:
* pgp/seahorse-ldap-source.c:
* pgp/seahorse-pgp-commands.vala:
* pgp/seahorse-pgp-delete.c:
* pgp/seahorse-pgp-generator.vala:
* pgp/seahorse-pgp-key.c:
* pgp/seahorse-pgp-key.h:
* pgp/seahorse-pgp-key-op.c:
* pgp/seahorse-pgp-key-properties.c:
* pgp/seahorse-pgp-keysets.c:
* pgp/seahorse-pgp-keysets.h:
* pgp/seahorse-pgp-sign.c:
* pgp/seahorse-pgp-source.c:
* pgp/seahorse-pgp-source.h:
* pgp/seahorse-server-source.c:
* pgp/seahorse-server-source.h:
* pgp/seahorse-signer.c:
* src/main.c:
* src/seahorse-key-manager.vala:
* src/seahorse-key-manager-store.c:
* src/seahorse-key-manager-store.h:
* src/seahorse-keyserver-results.vala:
* src/seahorse-keyserver-search.c:
* src/seahorse-keyserver-sync.c:
* src/seahorse-viewer.vala:
* ssh/libseahorse-ssh-c.vapi:
* ssh/seahorse-delete.c:
* ssh/seahorse-ssh-commands.vala:
* ssh/seahorse-ssh-generator.vala:
* ssh/seahorse-ssh-key.c:
* ssh/seahorse-ssh-key.h:
* ssh/seahorse-ssh-key-properties.c:
* ssh/seahorse-ssh-operation.c:
* ssh/seahorse-ssh-source.c:
* ssh/seahorse-ssh-source.h:
* ssh/seahorse-ssh-upload.c: Refactor and add SeahorseObject class
as a base class of SeahorseKey, so that we can have non-key objects
in the mix.
2008-07-16 Stef Walter <stef@memberwebs.com>
* pkcs11/*:
......
......@@ -221,7 +221,7 @@ int main(int argc, char* argv[])
/* Make the default SeahorseContext */
seahorse_context_new (SEAHORSE_CONTEXT_APP | SEAHORSE_CONTEXT_DAEMON, 0);
op = seahorse_context_load_local_keys (SCTX_APP ());
op = seahorse_context_load_local_objects (SCTX_APP ());
g_object_unref (op);
/* Initialize the various daemon components */
......
......@@ -128,7 +128,7 @@ notify_signatures (const gchar* data, gpgme_verify_result_t status)
/* Discover the key in question */
rawids = g_slist_append (NULL, status->signatures->fpr);
keys = seahorse_context_discover_keys (SCTX_APP (), SEAHORSE_PGP, rawids);
keys = seahorse_context_discover_objects (SCTX_APP (), SEAHORSE_PGP, rawids);
g_slist_free (rawids);
g_return_if_fail (keys != NULL);
......@@ -186,7 +186,7 @@ notify_signatures (const gchar* data, gpgme_verify_result_t status)
if (sig) {
gchar *date = seahorse_util_get_display_date_string (status->signatures->timestamp);
gchar *id = seahorse_context_keyid_to_dbus (SCTX_APP (), seahorse_key_get_keyid (skey), 0);
gchar *id = seahorse_context_id_to_dbus (SCTX_APP (), seahorse_key_get_keyid (skey), 0);
body = g_markup_printf_escaped (body, id, date);
g_free (date);
g_free (id);
......@@ -219,8 +219,8 @@ seahorse_service_crypto_encrypt_text (SeahorseServiceCrypto *crypto,
{
GList *recipkeys = NULL;
SeahorsePGPOperation *pop;
SeahorseKey *signkey = NULL;
SeahorseKey *skey;
SeahorseObject *signkey = NULL;
SeahorseObject *skey;
gpgme_key_t *recips;
gpgme_data_t plain, cipher;
gpgme_error_t gerr;
......@@ -233,7 +233,7 @@ seahorse_service_crypto_encrypt_text (SeahorseServiceCrypto *crypto,
/* The signer */
if (signer && signer[0]) {
signkey = seahorse_context_key_from_dbus (SCTX_APP (), signer, NULL);
signkey = seahorse_context_object_from_dbus (SCTX_APP (), signer, NULL);
if (!signkey) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Invalid or unrecognized signer: %s"), signer);
......@@ -241,7 +241,7 @@ seahorse_service_crypto_encrypt_text (SeahorseServiceCrypto *crypto,
}
if (!SEAHORSE_IS_PGP_KEY (signkey) ||
!(seahorse_key_get_flags (signkey) & SKEY_FLAG_CAN_SIGN)) {
!(seahorse_object_get_flags (signkey) & SKEY_FLAG_CAN_SIGN)) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Key is not valid for signing: %s"), signer);
return FALSE;
......@@ -251,7 +251,7 @@ seahorse_service_crypto_encrypt_text (SeahorseServiceCrypto *crypto,
/* The recipients */
for( ; recipients[0]; recipients++)
{
skey = seahorse_context_key_from_dbus (SCTX_APP (), recipients[0], NULL);
skey = seahorse_context_object_from_dbus (SCTX_APP (), recipients[0], NULL);
if (!skey) {
g_list_free (recipkeys);
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
......@@ -260,7 +260,7 @@ seahorse_service_crypto_encrypt_text (SeahorseServiceCrypto *crypto,
}
if (!SEAHORSE_IS_PGP_KEY (skey) ||
!(seahorse_key_get_flags (skey) & SKEY_FLAG_CAN_ENCRYPT)) {
!(seahorse_object_get_flags (skey) & SKEY_FLAG_CAN_ENCRYPT)) {
g_list_free (recipkeys);
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Key is not a valid recipient for encryption: %s"), recipients[0]);
......@@ -290,7 +290,7 @@ seahorse_service_crypto_encrypt_text (SeahorseServiceCrypto *crypto,
/* Add the default key if set and necessary */
if (seahorse_gconf_get_boolean (ENCRYPTSELF_KEY)) {
skey = seahorse_context_get_default_key (SCTX_APP ());
skey = SEAHORSE_OBJECT (seahorse_context_get_default_key (SCTX_APP ()));
if (SEAHORSE_IS_PGP_KEY (skey))
recipkeys = g_list_append (recipkeys, skey);
}
......@@ -324,7 +324,7 @@ seahorse_service_crypto_sign_text (SeahorseServiceCrypto *crypto, const char *si
int flags, const char *cleartext, char **crypttext,
GError **error)
{
SeahorseKey *signkey = NULL;
SeahorseObject *signkey = NULL;
gpgme_error_t gerr;
SeahorsePGPOperation *pop;
gpgme_data_t plain, cipher;
......@@ -340,7 +340,7 @@ seahorse_service_crypto_sign_text (SeahorseServiceCrypto *crypto, const char *si
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("No signer specified"));
signkey = seahorse_context_key_from_dbus (SCTX_APP (), signer, NULL);
signkey = seahorse_context_object_from_dbus (SCTX_APP (), signer, NULL);
if (!signkey) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Invalid or unrecognized signer: %s"), signer);
......@@ -348,7 +348,7 @@ seahorse_service_crypto_sign_text (SeahorseServiceCrypto *crypto, const char *si
}
if (!SEAHORSE_IS_PGP_KEY (signkey) ||
!(seahorse_key_get_flags (signkey) & SKEY_FLAG_CAN_SIGN)) {
!(seahorse_object_get_flags (signkey) & SKEY_FLAG_CAN_SIGN)) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Key is not valid for signing: %s"), signer);
return FALSE;
......@@ -431,7 +431,7 @@ seahorse_service_crypto_decrypt_text (SeahorseServiceCrypto *crypto,
status->signatures->summary & GPGME_SIGSUM_VALID ||
status->signatures->summary & GPGME_SIGSUM_KEY_MISSING) {
keyid = seahorse_pgp_key_get_cannonical_id (status->signatures->fpr);
*signer = seahorse_context_keyid_to_dbus (SCTX_APP (), keyid, 0);
*signer = seahorse_context_id_to_dbus (SCTX_APP (), keyid, 0);
}
}
}
......@@ -494,7 +494,7 @@ seahorse_service_crypto_verify_text (SeahorseServiceCrypto *crypto,
status->signatures->summary & GPGME_SIGSUM_VALID ||
status->signatures->summary & GPGME_SIGSUM_KEY_MISSING) {
keyid = seahorse_pgp_key_get_cannonical_id (status->signatures->fpr);
*signer = seahorse_context_keyid_to_dbus (SCTX_APP (), keyid, 0);
*signer = seahorse_context_id_to_dbus (SCTX_APP (), keyid, 0);
}
}
}
......
This diff is collapsed.
......@@ -29,9 +29,10 @@
#include <dbus/dbus-glib-bindings.h>
#include "seahorse-daemon.h"
#include "seahorse-key.h"
#include "seahorse-service.h"
#include "seahorse-context.h"
#include "seahorse-key-source.h"
#include "seahorse-source.h"
#include "seahorse-util.h"
#include "seahorse-libdialogs.h"
......@@ -53,21 +54,21 @@ static void
add_key_source (SeahorseService *svc, GQuark ktype)
{
const gchar *keytype = g_quark_to_string (ktype);
SeahorseKeyset *keyset;
SeahorseSet *keyset;
gchar *dbus_id;
/* Check if we have a keyset for this key type, and add if not */
if (svc->keysets && !g_hash_table_lookup (svc->keysets, keytype)) {
/* Keyset for all keys */
keyset = seahorse_service_keyset_new (ktype, SKEY_LOC_INVALID);
keyset = seahorse_service_keyset_new (ktype, SEAHORSE_LOCATION_INVALID);
dbus_id = g_strdup_printf (KEYSET_PATH, keytype);
dbus_g_connection_register_g_object (seahorse_dbus_server_get_connection (),
dbus_id, G_OBJECT (keyset));
g_free (dbus_id);
/* Keyset for local keys */
keyset = seahorse_service_keyset_new (ktype, SKEY_LOC_LOCAL);
keyset = seahorse_service_keyset_new (ktype, SEAHORSE_LOCATION_LOCAL);
dbus_id = g_strdup_printf (KEYSET_PATH_LOCAL, keytype);
dbus_g_connection_register_g_object (seahorse_dbus_server_get_connection (),
dbus_id, G_OBJECT (keyset));
......@@ -118,7 +119,7 @@ gboolean
seahorse_service_import_keys (SeahorseService *svc, gchar *ktype,
gchar *data, gchar ***keys, GError **error)
{
SeahorseKeySource *sksrc;
SeahorseSource *sksrc;
SeahorseOperation *op;
GInputStream *input;
GArray *a;
......@@ -126,8 +127,8 @@ seahorse_service_import_keys (SeahorseService *svc, gchar *ktype,
gchar *t;
guint keynum = 0;
sksrc = seahorse_context_find_key_source (SCTX_APP (), g_quark_from_string (ktype),
SKEY_LOC_LOCAL);
sksrc = seahorse_context_find_source (SCTX_APP (), g_quark_from_string (ktype),
SEAHORSE_LOCATION_LOCAL);
if (!sksrc) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Invalid or unrecognized key type: %s"), ktype);
......@@ -138,13 +139,13 @@ seahorse_service_import_keys (SeahorseService *svc, gchar *ktype,
input = g_memory_input_stream_new_from_data (data, strlen (data), NULL);
g_return_val_if_fail (input, FALSE);
op = seahorse_key_source_import (sksrc, G_INPUT_STREAM (input));
op = seahorse_source_import (sksrc, G_INPUT_STREAM (input));
seahorse_operation_wait (op);
a = g_array_new (TRUE, TRUE, sizeof (gchar*));
for (l = (GList*)seahorse_operation_get_result (op); l; l = g_list_next (l)) {
t = seahorse_context_keyid_to_dbus (SCTX_APP (),
seahorse_key_get_keyid (SEAHORSE_KEY (l->data)), 0);
t = seahorse_context_id_to_dbus (SCTX_APP (),
seahorse_object_get_id (SEAHORSE_OBJECT (l->data)), 0);
g_array_append_val (a, t);
keynum = keynum + 1;
}
......@@ -164,9 +165,9 @@ gboolean
seahorse_service_export_keys (SeahorseService *svc, gchar *ktype,
gchar **keys, gchar **data, GError **error)
{
SeahorseKeySource *sksrc;
SeahorseSource *sksrc;
SeahorseOperation *op;
SeahorseKey *skey;
SeahorseObject *sobj;
GMemoryOutputStream *output;
GList *next;
GList *l = NULL;
......@@ -175,15 +176,15 @@ seahorse_service_export_keys (SeahorseService *svc, gchar *ktype,
type = g_quark_from_string (ktype);
while (*keys) {
skey = seahorse_context_key_from_dbus (SCTX_APP (), *keys, 0);
sobj = seahorse_context_object_from_dbus (SCTX_APP (), *keys, 0);
if (!skey || seahorse_key_get_ktype (skey) != type) {
if (!sobj || seahorse_object_get_tag (sobj) != type) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Invalid or unrecognized key: %s"), *keys);
return FALSE;
}
l = g_list_prepend (l, skey);
l = g_list_prepend (l, sobj);
keys++;
}
......@@ -191,21 +192,21 @@ seahorse_service_export_keys (SeahorseService *svc, gchar *ktype,
g_return_val_if_fail (output, FALSE);
/* Sort by key source */
l = seahorse_util_keylist_sort (l);
l = seahorse_util_objects_sort (l);
while (l) {
/* Break off one set (same keysource) */
next = seahorse_util_keylist_splice (l);
next = seahorse_util_objects_splice (l);
skey = SEAHORSE_KEY (l->data);
sobj = SEAHORSE_OBJECT (l->data);
/* Export from this key source */
sksrc = seahorse_key_get_source (skey);
sksrc = seahorse_object_get_source (sobj);
g_return_val_if_fail (sksrc != NULL, FALSE);
/* We pass our own data object, to which data is appended */
op = seahorse_key_source_export (sksrc, l, FALSE, G_OUTPUT_STREAM (output));
op = seahorse_source_export (sksrc, l, FALSE, G_OUTPUT_STREAM (output));
g_return_val_if_fail (op != NULL, FALSE);
g_list_free (l);
......@@ -266,18 +267,18 @@ seahorse_service_match_save (SeahorseService *svc, gchar *ktype, gint flags,
*/
static void
seahorse_service_added (SeahorseContext *sctx, SeahorseKey *skey, SeahorseService *svc)
seahorse_service_added (SeahorseContext *sctx, SeahorseObject *sobj, SeahorseService *svc)
{
GQuark ktype = seahorse_key_get_ktype (skey);
GQuark ktype = seahorse_object_get_tag (sobj);
add_key_source (svc, ktype);
}
static void
seahorse_service_changed (SeahorseContext *sctx, SeahorseKey *skey,
SeahorseKeyChange change, SeahorseService *svc)
seahorse_service_changed (SeahorseContext *sctx, SeahorseObject *sobj,
SeahorseObjectChange change, SeahorseService *svc)
{
/* Do the same thing as when a key is added */
GQuark ktype = seahorse_key_get_ktype (skey);
GQuark ktype = seahorse_object_get_tag (sobj);
add_key_source (svc, ktype);
}
......@@ -321,9 +322,9 @@ seahorse_service_init (SeahorseService *svc)
g_free, g_object_unref);
/* Fill in keysets for any keys already in the context */
srcs = seahorse_context_find_key_sources (SCTX_APP (), SKEY_UNKNOWN, SKEY_LOC_LOCAL);
srcs = seahorse_context_find_sources (SCTX_APP (), SKEY_UNKNOWN, SEAHORSE_LOCATION_LOCAL);
for (l = srcs; l; l = g_slist_next (l))
add_key_source (svc, seahorse_key_source_get_ktype (SEAHORSE_KEY_SOURCE (l->data)));
add_key_source (svc, seahorse_source_get_ktype (SEAHORSE_SOURCE (l->data)));
g_slist_free (srcs);
/* And now listen for new key types */
......
......@@ -25,7 +25,7 @@
#include <glib/gerror.h>
#include <glib-object.h>
#include "seahorse-keyset.h"
#include "seahorse-set.h"
G_BEGIN_DECLS
......@@ -98,14 +98,14 @@ typedef struct _SeahorseServiceKeysetClass SeahorseServiceKeysetClass;
#define SEAHORSE_SERVICE_KEYSET_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), SEAHORSE_TYPE_SERVICE_KEYSET, SeahorseServiceKeysetClass))
struct _SeahorseServiceKeyset {
SeahorseKeyset base;
SeahorseSet base;
/* <public> */
GQuark ktype;
};
struct _SeahorseServiceKeysetClass {
SeahorseKeysetClass base;
SeahorseSetClass base;
/* signals --------------------------------------------------------- */
......@@ -121,8 +121,8 @@ struct _SeahorseServiceKeysetClass {
GType seahorse_service_keyset_get_type (void);
SeahorseKeyset* seahorse_service_keyset_new (GQuark keytype,
SeahorseKeyLoc location);
SeahorseSet* seahorse_service_keyset_new (GQuark keytype,
SeahorseLocation location);
gboolean seahorse_service_keyset_list_keys (SeahorseServiceKeyset *keyset,
gchar ***keys, GError **error);
......
......@@ -27,7 +27,7 @@ namespace Seahorse.Gkr {
}
[CCode (cheader_filename = "seahorse-gkeyring-source.h")]
public class Source : Seahorse.KeySource {
public class Source : Seahorse.Source {
}
......
......@@ -614,7 +614,7 @@ void
seahorse_gkeyring_item_properties_show (SeahorseGKeyringItem *git, GtkWindow *parent)
{
SeahorseKey *key = SEAHORSE_KEY (git);
SeahorseKeySource *sksrc;
SeahorseSource *sksrc;
SeahorseWidget *swidget = NULL;
GtkWidget *widget;
......@@ -629,12 +629,12 @@ seahorse_gkeyring_item_properties_show (SeahorseGKeyringItem *git, GtkWindow *pa
/* This causes the key source to get any specific info about the key */
if (seahorse_key_get_loaded (key) < SKEY_INFO_COMPLETE) {
sksrc = seahorse_key_get_source (key);
seahorse_key_source_load_async (sksrc, seahorse_key_get_keyid (key));
seahorse_source_load_async (sksrc, seahorse_key_get_keyid (key));
}
widget = glade_xml_get_widget (swidget->xml, swidget->name);
g_signal_connect (widget, "response", G_CALLBACK (properties_response), swidget);
g_signal_connect (GTK_OBJECT (widget), "destroy", G_CALLBACK (properties_destroyed), swidget);
g_signal_connect (widget, "destroy", G_CALLBACK (properties_destroyed), swidget);
g_signal_connect_after (git, "changed", G_CALLBACK (key_changed), swidget);
g_signal_connect_after (git, "destroy", G_CALLBACK (key_destroyed), swidget);
......
......@@ -26,7 +26,7 @@
#include <glib/gi18n.h>
#include "seahorse-context.h"
#include "seahorse-key-source.h"
#include "seahorse-source.h"
#include "seahorse-gkeyring-item.h"
#include "seahorse-gtkstock.h"
#include "seahorse-util.h"
......@@ -231,17 +231,18 @@ static void
changed_key (SeahorseGKeyringItem *git)
{
SeahorseKey *skey = SEAHORSE_KEY (git);
SeahorseObject *obj = SEAHORSE_OBJECT (git);
gchar *secret;
if (!git->info) {
skey->location = SKEY_LOC_INVALID;
skey->etype = SKEY_ETYPE_NONE;
obj->_location = SEAHORSE_LOCATION_INVALID;
obj->_usage = SEAHORSE_USAGE_NONE;
skey->loaded = SKEY_INFO_NONE;
skey->flags = SKEY_FLAG_DISABLED;
obj->_flags = SKEY_FLAG_DISABLED;
skey->keydesc = _("Invalid");
skey->rawid = NULL;
skey->keyid = 0;
obj->_id = 0;
return;
}
......@@ -249,11 +250,11 @@ changed_key (SeahorseGKeyringItem *git)
skey->loaded = (secret == NULL) ? SKEY_INFO_BASIC : SKEY_INFO_COMPLETE;
g_free (secret);
skey->ktype = SEAHORSE_GKR;
skey->location = SKEY_LOC_LOCAL;
skey->etype = SKEY_CREDENTIALS;
skey->flags = 0;
skey->keyid = seahorse_gkeyring_item_get_cannonical (git->item_id);
obj->_tag = SEAHORSE_GKR;
obj->_location = SEAHORSE_LOCATION_LOCAL;
obj->_usage = SEAHORSE_USAGE_CREDENTIALS;
obj->_flags = 0;
obj->_id = seahorse_gkeyring_item_get_cannonical (git->item_id);
if (is_network_item (git, "http"))
skey->keydesc = _("Web Password");
......@@ -262,7 +263,7 @@ changed_key (SeahorseGKeyringItem *git)
else
skey->keydesc = _("Password");
seahorse_key_changed (skey, SKEY_CHANGE_ALL);
seahorse_object_fire_changed (SEAHORSE_OBJECT (skey), SEAHORSE_OBJECT_CHANGE_ALL);
}
/* -----------------------------------------------------------------------------
......@@ -529,7 +530,7 @@ seahorse_gkeyring_item_class_init (SeahorseGKeyringItemClass *klass)
*/
SeahorseGKeyringItem*
seahorse_gkeyring_item_new (SeahorseKeySource *sksrc, guint32 item_id,
seahorse_gkeyring_item_new (SeahorseSource *sksrc, guint32 item_id,
GnomeKeyringItemInfo *info, GnomeKeyringAttributeList *attributes,
GList *acl)
{
......@@ -537,10 +538,6 @@ seahorse_gkeyring_item_new (SeahorseKeySource *sksrc, guint32 item_id,
git = g_object_new (SEAHORSE_TYPE_GKEYRING_ITEM, "key-source", sksrc,
"item-id", item_id, "item-info", info,
"item-attributes", attributes, "item-acl", acl, NULL);
/* We don't care about this floating business */
g_object_ref (GTK_OBJECT (git));
gtk_object_sink (GTK_OBJECT (git));
return git;
}
......
......@@ -45,7 +45,7 @@
#include "seahorse-gkr-module.h"
#include "seahorse-key.h"
#include "seahorse-key-source.h"
#include "seahorse-source.h"
typedef enum {
SEAHORSE_GKEYRING_USE_OTHER,
......@@ -82,7 +82,7 @@ struct _SeahorseGKeyringItemClass {
};
// TODO: arguments specific to GKeyring Item
SeahorseGKeyringItem* seahorse_gkeyring_item_new (SeahorseKeySource *sksrc,
SeahorseGKeyringItem* seahorse_gkeyring_item_new (SeahorseSource *sksrc,
guint32 item_id,
GnomeKeyringItemInfo *info,
GnomeKeyringAttributeList *attributes,
......
......@@ -250,13 +250,13 @@ basic_operation_done (GnomeKeyringResult result, SeahorseGKeyringOperation *gop)
/* When operation is successful reload the key */
g_return_if_fail (pv->keyid != 0);
seahorse_key_source_load_async (SEAHORSE_KEY_SOURCE (gop->gsrc), pv->keyid);
seahorse_source_load_async (SEAHORSE_SOURCE (gop->gsrc), pv->keyid);
}
SeahorseOperation*
seahorse_gkeyring_operation_update_info (SeahorseGKeyringItem *git, GnomeKeyringItemInfo *info)
{
SeahorseKeySource *sksrc;
SeahorseSource *sksrc;
SeahorseGKeyringOperation *gop;
SeahorseGKeyringOperationPrivate *pv;
const gchar *keyring_name;
......@@ -288,7 +288,7 @@ seahorse_gkeyring_operation_update_info (SeahorseGKeyringItem *git, GnomeKeyring
SeahorseOperation*
seahorse_gkeyring_operation_update_acl (SeahorseGKeyringItem *git, GList *acl)
{
SeahorseKeySource *sksrc;
SeahorseSource *sksrc;
SeahorseGKeyringOperation *gop;
SeahorseGKeyringOperationPrivate *pv;
const gchar *keyring_name;
......
......@@ -69,14 +69,14 @@ struct _SeahorseGKeyringSourcePrivate {
gchar *keyring_name; /* The key ring name */
};
G_DEFINE_TYPE (SeahorseGKeyringSource, seahorse_gkeyring_source, SEAHORSE_TYPE_KEY_SOURCE);
G_DEFINE_TYPE (SeahorseGKeyringSource, seahorse_gkeyring_source, SEAHORSE_TYPE_SOURCE);
/* Forward decls */
static void key_changed (SeahorseKey *skey, SeahorseKeyChange change,
SeahorseKeySource *sksrc);
SeahorseSource *sksrc);
static void key_destroyed (SeahorseKey *skey, SeahorseKeySource *sksrc);
static void key_destroyed (SeahorseKey *skey, SeahorseSource *sksrc);
/* -----------------------------------------------------------------------------
* LIST OPERATION
......@@ -197,8 +197,8 @@ have_complete_item (SeahorseListOperation *lop)
g_hash_table_remove (lop->checks, GUINT_TO_POINTER (keyid));
g_assert (SEAHORSE_IS_GKEYRING_SOURCE (lop->gsrc));
prev = SEAHORSE_GKEYRING_ITEM (seahorse_context_get_key (SCTX_APP (),
SEAHORSE_KEY_SOURCE (lop->gsrc), keyid));
prev = SEAHORSE_GKEYRING_ITEM (seahorse_context_get_object (SCTX_APP (),
SEAHORSE_SOURCE (lop->gsrc), keyid));
/* Check if we can just replace the key on the object */
if (prev != NULL) {
......@@ -213,15 +213,15 @@ have_complete_item (SeahorseListOperation *lop)
return TRUE;
}
git = seahorse_gkeyring_item_new (SEAHORSE_KEY_SOURCE (lop->gsrc), lop->current_id,
git = seahorse_gkeyring_item_new (SEAHORSE_SOURCE (lop->gsrc), lop->current_id,
lop->current_info, lop->current_attrs, lop->current_acl);
/* We listen in to get notified of changes on this key */
g_signal_connect (git, "changed", G_CALLBACK (key_changed), SEAHORSE_KEY_SOURCE (lop->gsrc));
g_signal_connect (git, "destroy", G_CALLBACK (key_destroyed), SEAHORSE_KEY_SOURCE (lop->gsrc));
g_signal_connect (git, "changed", G_CALLBACK (key_changed), SEAHORSE_SOURCE (lop->gsrc));
g_signal_connect (git, "destroy", G_CALLBACK (key_destroyed), SEAHORSE_SOURCE (lop->gsrc));
/* Add to context */
seahorse_context_take_key (SCTX_APP (), SEAHORSE_KEY (git));
seahorse_context_take_object (SCTX_APP (), SEAHORSE_OBJECT (git));
lop->current_info = NULL;
lop->current_acl = NULL;
......@@ -302,15 +302,15 @@ item_acl_ready (GnomeKeyringResult result, GList *acl, SeahorseListOperation *lo
/* Remove the given key from the context */
static void
remove_key_from_context (gpointer kt, SeahorseKey *dummy, SeahorseKeySource *sksrc)
remove_key_from_context (gpointer kt, SeahorseKey *dummy, SeahorseSource *sksrc)
{
/* This function gets called as a GHFunc on the lop->checks hashtable. */
GQuark keyid = GPOINTER_TO_UINT (kt);
SeahorseKey *skey;
SeahorseObject *sobj;
skey = seahorse_context_get_key (SCTX_APP (), sksrc, keyid);
if (skey != NULL)
seahorse_context_remove_key (SCTX_APP (), skey);
sobj = seahorse_context_get_object (SCTX_APP (), sksrc, keyid);
if (sobj != NULL)
seahorse_context_remove_object (SCTX_APP (), sobj);
}
static void
......@@ -334,7 +334,7 @@ process_next_item (SeahorseListOperation *lop)
if (lop->checks)
g_hash_table_foreach (lop->checks, (GHFunc)remove_key_from_context,
SEAHORSE_KEY_SOURCE (lop->gsrc));
SEAHORSE_SOURCE (lop->gsrc));
seahorse_operation_mark_done (SEAHORSE_OPERATION (lop), FALSE, NULL);
return;
......@@ -412,9 +412,9 @@ start_list_operation (SeahorseGKeyringSource *gsrc, GQuark keyid)
/* When loading new keys prepare a list of current */
lop->checks = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
keys = seahorse_context_get_keys (SCTX_APP (), SEAHORSE_KEY_SOURCE (gsrc));
keys = seahorse_context_get_objects (SCTX_APP (), SEAHORSE_SOURCE (gsrc));
for (l = keys; l; l = g_list_next (l))
g_hash_table_insert (lop->checks, GUINT_TO_POINTER (seahorse_key_get_keyid (l->data)),
g_hash_table_insert (lop->checks, GUINT_TO_POINTER (seahorse_object_get_id (l->data)),
GUINT_TO_POINTER (TRUE));
g_list_free (keys);
......@@ -496,7 +496,7 @@ seahorse_list_operation_cancel (SeahorseOperation *operation)
*/
static void
key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseKeySource *sksrc)
key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseSource *sksrc)
{
/* TODO: We need to fix these key change flags. Currently the only thing
* that sets 'ALL' is when we replace a key in an skey. We don't
......@@ -505,11 +505,11 @@ key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseKeySource *sks
if (change == SKEY_CHANGE_ALL)
return;
seahorse_key_source_load_async (sksrc, seahorse_key_get_keyid (skey));
seahorse_source_load_async (sksrc, seahorse_key_get_keyid (skey));
}
static void
key_destroyed (SeahorseKey *skey, SeahorseKeySource *sksrc)
key_destroyed (SeahorseKey *skey, SeahorseSource *sksrc)
{
g_signal_handlers_disconnect_by_func (skey, key_changed, sksrc);
g_signal_handlers_disconnect_by_func (skey, key_destroyed, sksrc);
......@@ -551,7 +551,7 @@ seahorse_gkeyring_source_get_property (GObject *object, guint prop_id, GValue *v
g_value_set_string (value, _("Password"));
break;
case PROP_LOCATION:
g_value_set_uint (value, SKEY_LOC_LOCAL);
g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
break;
}
}
......@@ -573,12 +573,12 @@ seahorse_gkeyring_source_set_property (GObject *object, guint prop_id, const GVa
}