seahorse r2278 - in trunk: . daemon gkr libseahorse pgp src ssh
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2278 - in trunk: . daemon gkr libseahorse pgp src ssh
- Date: Thu, 17 Jul 2008 01:41:51 +0000 (UTC)
Author: nnielsen
Date: Thu Jul 17 01:41:51 2008
New Revision: 2278
URL: http://svn.gnome.org/viewvc/seahorse?rev=2278&view=rev
Log:
* 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.
Added:
trunk/libseahorse/seahorse-object.c
trunk/libseahorse/seahorse-object.h
trunk/libseahorse/seahorse-object.vala
trunk/libseahorse/seahorse-set.c
- copied, changed from r2271, /trunk/libseahorse/seahorse-keyset.c
trunk/libseahorse/seahorse-set.h
- copied, changed from r2271, /trunk/libseahorse/seahorse-keyset.h
trunk/libseahorse/seahorse-source.c
- copied, changed from r2276, /trunk/libseahorse/seahorse-key-source.c
trunk/libseahorse/seahorse-source.h
- copied, changed from r2276, /trunk/libseahorse/seahorse-key-source.h
trunk/libseahorse/seahorse-types.c
trunk/libseahorse/seahorse-types.h
trunk/libseahorse/seahorse-types.vala
Removed:
trunk/libseahorse/seahorse-key-source.c
trunk/libseahorse/seahorse-key-source.h
trunk/libseahorse/seahorse-keyset.c
trunk/libseahorse/seahorse-keyset.h
Modified:
trunk/ChangeLog
trunk/daemon/seahorse-daemon.c
trunk/daemon/seahorse-service-crypto.c
trunk/daemon/seahorse-service-keyset.c
trunk/daemon/seahorse-service.c
trunk/daemon/seahorse-service.h
trunk/gkr/libseahorse-gkr-c.vapi
trunk/gkr/seahorse-gkeyring-item-properties.c
trunk/gkr/seahorse-gkeyring-item.c
trunk/gkr/seahorse-gkeyring-item.h
trunk/gkr/seahorse-gkeyring-operation.c
trunk/gkr/seahorse-gkeyring-source.c
trunk/gkr/seahorse-gkeyring-source.h
trunk/gkr/seahorse-gkr-commands.c
trunk/gkr/seahorse-gkr-commands.h
trunk/gkr/seahorse-gkr-commands.vala
trunk/gkr/vala-build.stamp
trunk/libseahorse/Makefile.am
trunk/libseahorse/libseahorse-c.vapi
trunk/libseahorse/libseahorse.gidl
trunk/libseahorse/libseahorse.vapi
trunk/libseahorse/seahorse-combo-keys.c
trunk/libseahorse/seahorse-combo-keys.h
trunk/libseahorse/seahorse-commands.c
trunk/libseahorse/seahorse-commands.h
trunk/libseahorse/seahorse-commands.vala
trunk/libseahorse/seahorse-context.c
trunk/libseahorse/seahorse-context.h
trunk/libseahorse/seahorse-dns-sd.c
trunk/libseahorse/seahorse-key-widget.c
trunk/libseahorse/seahorse-key.c
trunk/libseahorse/seahorse-key.h
trunk/libseahorse/seahorse-notification.c
trunk/libseahorse/seahorse-prefs-keyrings.c
trunk/libseahorse/seahorse-transfer-operation.c
trunk/libseahorse/seahorse-transfer-operation.h
trunk/libseahorse/seahorse-unknown-key.c
trunk/libseahorse/seahorse-unknown-source.c
trunk/libseahorse/seahorse-unknown-source.h
trunk/libseahorse/seahorse-util.c
trunk/libseahorse/seahorse-util.h
trunk/libseahorse/seahorse-view.c
trunk/libseahorse/seahorse-view.h
trunk/libseahorse/seahorse-view.vala
trunk/libseahorse/vala-build.stamp
trunk/pgp/libseahorse-pgp-c.vapi
trunk/pgp/seahorse-hkp-source.c
trunk/pgp/seahorse-ldap-source.c
trunk/pgp/seahorse-pgp-commands.c
trunk/pgp/seahorse-pgp-commands.h
trunk/pgp/seahorse-pgp-commands.vala
trunk/pgp/seahorse-pgp-delete.c
trunk/pgp/seahorse-pgp-generator.c
trunk/pgp/seahorse-pgp-generator.vala
trunk/pgp/seahorse-pgp-key-op.c
trunk/pgp/seahorse-pgp-key-properties.c
trunk/pgp/seahorse-pgp-key.c
trunk/pgp/seahorse-pgp-key.h
trunk/pgp/seahorse-pgp-keysets.c
trunk/pgp/seahorse-pgp-keysets.h
trunk/pgp/seahorse-pgp-sign.c
trunk/pgp/seahorse-pgp-source.c
trunk/pgp/seahorse-pgp-source.h
trunk/pgp/seahorse-server-source.c
trunk/pgp/seahorse-server-source.h
trunk/pgp/seahorse-signer.c
trunk/pgp/vala-build.stamp
trunk/src/main.c
trunk/src/seahorse-key-manager-store.c
trunk/src/seahorse-key-manager-store.h
trunk/src/seahorse-key-manager.c
trunk/src/seahorse-key-manager.h
trunk/src/seahorse-key-manager.vala
trunk/src/seahorse-keyserver-results.c
trunk/src/seahorse-keyserver-results.h
trunk/src/seahorse-keyserver-results.vala
trunk/src/seahorse-keyserver-search.c
trunk/src/seahorse-keyserver-sync.c
trunk/src/seahorse-viewer.c
trunk/src/seahorse-viewer.h
trunk/src/seahorse-viewer.vala
trunk/src/vala-build.stamp
trunk/ssh/libseahorse-ssh-c.vapi
trunk/ssh/seahorse-delete.c
trunk/ssh/seahorse-ssh-commands.c
trunk/ssh/seahorse-ssh-commands.h
trunk/ssh/seahorse-ssh-commands.vala
trunk/ssh/seahorse-ssh-generator.c
trunk/ssh/seahorse-ssh-generator.vala
trunk/ssh/seahorse-ssh-key-properties.c
trunk/ssh/seahorse-ssh-key.c
trunk/ssh/seahorse-ssh-key.h
trunk/ssh/seahorse-ssh-operation.c
trunk/ssh/seahorse-ssh-source.c
trunk/ssh/seahorse-ssh-source.h
trunk/ssh/seahorse-ssh-upload.c
trunk/ssh/vala-build.stamp
Modified: trunk/daemon/seahorse-daemon.c
==============================================================================
--- trunk/daemon/seahorse-daemon.c (original)
+++ trunk/daemon/seahorse-daemon.c Thu Jul 17 01:41:51 2008
@@ -221,7 +221,7 @@
/* 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 */
Modified: trunk/daemon/seahorse-service-crypto.c
==============================================================================
--- trunk/daemon/seahorse-service-crypto.c (original)
+++ trunk/daemon/seahorse-service-crypto.c Thu Jul 17 01:41:51 2008
@@ -128,7 +128,7 @@
/* 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 @@
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 @@
{
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 @@
/* 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 @@
}
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 @@
/* 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 @@
}
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 @@
/* 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 @@
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 @@
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 @@
}
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 @@
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 @@
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);
}
}
}
Modified: trunk/daemon/seahorse-service-keyset.c
==============================================================================
--- trunk/daemon/seahorse-service-keyset.c (original)
+++ trunk/daemon/seahorse-service-keyset.c Thu Jul 17 01:41:51 2008
@@ -26,6 +26,7 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include "seahorse-key.h"
#include "seahorse-service.h"
#include "seahorse-util.h"
@@ -39,7 +40,7 @@
LAST_SIGNAL
};
-G_DEFINE_TYPE (SeahorseServiceKeyset, seahorse_service_keyset, SEAHORSE_TYPE_KEYSET);
+G_DEFINE_TYPE (SeahorseServiceKeyset, seahorse_service_keyset, SEAHORSE_TYPE_SET);
static guint signals[LAST_SIGNAL] = { 0 };
/* -----------------------------------------------------------------------------
@@ -91,24 +92,26 @@
seahorse_service_keyset_list_keys (SeahorseServiceKeyset *keyset, gchar ***keys,
GError **error)
{
- GList *k, *l;
- GArray *a;
- gchar *id;
- guint nuids, i;
-
- k = seahorse_keyset_get_keys (SEAHORSE_KEYSET (keyset));
- a = g_array_new (TRUE, TRUE, sizeof (gchar*));
-
- for (l = k; l; l = g_list_next (l)) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), SEAHORSE_KEY (l->data), 0);
- g_array_append_val (a, id);
+ GList *k, *l;
+ GArray *a;
+ gchar *id;
+ guint nuids, i;
+
+ k = seahorse_set_get_objects (SEAHORSE_SET (keyset));
+ a = g_array_new (TRUE, TRUE, sizeof (gchar*));
+
+ for (l = k; l; l = g_list_next (l)) {
+ id = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (l->data), 0);
+ g_array_append_val (a, id);
- nuids = seahorse_key_get_num_names (SEAHORSE_KEY (l->data));
- for (i = 1; i < nuids; i++) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), SEAHORSE_KEY (l->data), i);
- g_array_append_val (a, id);
- }
- }
+ if (SEAHORSE_IS_KEY (l->data)) {
+ nuids = seahorse_key_get_num_names (SEAHORSE_KEY (l->data));
+ for (i = 1; i < nuids; i++) {
+ id = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (l->data), i);
+ g_array_append_val (a, id);
+ }
+ }
+ }
*keys = (gchar**)g_array_free (a, FALSE);
return TRUE;
@@ -118,17 +121,18 @@
seahorse_service_keyset_get_key_field (SeahorseService *svc, gchar *key, gchar *field,
gboolean *has, GValue *value, GError **error)
{
- SeahorseKey *skey;
+ SeahorseObject *sobj;
guint uid;
- skey = seahorse_context_key_from_dbus (SCTX_APP(), key, &uid);
- if (!skey) {
+ sobj = seahorse_context_object_from_dbus (SCTX_APP(), key, &uid);
+ if (!sobj) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Invalid or unrecognized key: %s"), key);
return FALSE;
}
- if (seahorse_key_lookup_property (skey, uid, field, value)) {
+ if (SEAHORSE_IS_KEY (sobj) &&
+ seahorse_key_lookup_property (SEAHORSE_KEY (sobj), uid, field, value)) {
*has = TRUE;
} else {
@@ -146,29 +150,31 @@
seahorse_service_keyset_get_key_fields (SeahorseService *svc, gchar *key, gchar **fields,
GHashTable **values, GError **error)
{
- SeahorseKey *skey;
- GValue *value;
- guint uid;
-
- skey = seahorse_context_key_from_dbus (SCTX_APP(), key, &uid);
- if (!skey) {
- g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
- _("Invalid or unrecognized key: %s"), key);
- return FALSE;
- }
-
- *values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, value_free);
-
- while (*fields) {
- value = g_new0 (GValue, 1);
- if (seahorse_key_lookup_property (skey, uid, *fields, value))
- g_hash_table_insert (*values, g_strdup (*fields), value);
- else
- g_free (value);
- fields++;
- }
-
- return TRUE;
+ SeahorseObject *sobj;
+ GValue *value;
+ guint uid;
+
+ sobj = seahorse_context_object_from_dbus (SCTX_APP(), key, &uid);
+ if (!sobj) {
+ g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
+ _("Invalid or unrecognized key: %s"), key);
+ return FALSE;
+ }
+
+ *values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, value_free);
+
+ if (SEAHORSE_IS_KEY (sobj)) {
+ while (*fields) {
+ value = g_new0 (GValue, 1);
+ if (seahorse_key_lookup_property (SEAHORSE_KEY (sobj), uid, *fields, value))
+ g_hash_table_insert (*values, g_strdup (*fields), value);
+ else
+ g_free (value);
+ fields++;
+ }
+ }
+
+ return TRUE;
}
gboolean
@@ -184,7 +190,7 @@
/* Check to make sure the key ids are valid */
for (k = keyids; *k; k++) {
- keyid = seahorse_key_source_canonize_keyid (keyset->ktype, *k);
+ keyid = seahorse_source_canonize_id (keyset->ktype, *k);
if (!keyid) {
g_set_error (error, SEAHORSE_DBUS_ERROR, SEAHORSE_DBUS_ERROR_INVALID,
_("Invalid key id: %s"), *k);
@@ -194,13 +200,13 @@
}
/* Pass it on to do the work */
- lkeys = seahorse_context_discover_keys (SCTX_APP (), keyset->ktype, rawids);
+ lkeys = seahorse_context_discover_objects (SCTX_APP (), keyset->ktype, rawids);
g_slist_free (rawids);
/* Prepare return value */
akeys = g_array_new (TRUE, TRUE, sizeof (gchar*));
for (l = lkeys; l; l = g_list_next (l)) {
- id = seahorse_context_key_to_dbus (SCTX_APP(), SEAHORSE_KEY (l->data), 0);
+ id = seahorse_context_object_to_dbus (SCTX_APP(), SEAHORSE_OBJECT (l->data), 0);
akeys = g_array_append_val (akeys, id);
}
*keys = (gchar**)g_array_free (akeys, FALSE);
@@ -232,13 +238,15 @@
results = g_array_new (TRUE, TRUE, sizeof (gchar*));
- lkeys = seahorse_context_find_keys (SCTX_APP (), keyset->ktype, SKEY_ETYPE_NONE,
- (flags & MATCH_KEYS_LOCAL_ONLY) ? SKEY_LOC_LOCAL : SKEY_LOC_INVALID);
+ lkeys = seahorse_context_find_objects (SCTX_APP (), keyset->ktype, SEAHORSE_USAGE_NONE,
+ (flags & MATCH_KEYS_LOCAL_ONLY) ? SEAHORSE_LOCATION_LOCAL : SEAHORSE_LOCATION_INVALID);
for (l = lkeys; l; l = g_list_next(l)) {
if (remaining->len <= 0)
break;
+ if (!SEAHORSE_IS_KEY (l->data))
+ continue;
skey = SEAHORSE_KEY (l->data);
/* Note that match_remove_patterns frees value */
@@ -246,14 +254,14 @@
/* Main name */
value = seahorse_key_get_display_name (skey);
if (match_remove_patterns (remaining, value)) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, 0);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (skey), 0);
g_array_append_val (results, id);
}
/* Key ID */
value = g_strdup (seahorse_key_get_rawid (seahorse_key_get_keyid (skey)));
if (match_remove_patterns (remaining, value)) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, 0);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (skey), 0);
g_array_append_val (results, id);
}
@@ -264,7 +272,7 @@
/* UID name */
value = seahorse_key_get_name (skey, i);
if (match_remove_patterns (remaining, value)) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (skey), i);
g_array_append_val (results, id);
break;
}
@@ -272,7 +280,7 @@
/* UID email */
value = seahorse_key_get_name_cn (skey, i);
if (match_remove_patterns (remaining, value)) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (skey), i);
g_array_append_val (results, id);
break;
}
@@ -303,26 +311,27 @@
*/
static void
-seahorse_service_keyset_added (SeahorseKeyset *skset, SeahorseKey *skey,
+seahorse_service_keyset_added (SeahorseSet *skset, SeahorseObject *sobj,
gpointer userdata)
{
- gchar *id;
- guint uids, i;
+ gchar *id;
+ guint uids = 0, i;
- uids = seahorse_key_get_num_names (skey);
- uids = (uids == 0) ? 1 : uids;
-
- for (i = 0; i < uids; i++) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
- g_signal_emit (SEAHORSE_SERVICE_KEYSET (skset), signals[KEY_ADDED], 0, id);
- g_free (id);
- }
+ if (SEAHORSE_IS_KEY (sobj))
+ uids = seahorse_key_get_num_names (SEAHORSE_KEY (sobj));
+ uids = (uids == 0) ? 1 : uids;
+
+ for (i = 0; i < uids; i++) {
+ id = seahorse_context_object_to_dbus (SCTX_APP (), sobj, i);
+ g_signal_emit (SEAHORSE_SERVICE_KEYSET (skset), signals[KEY_ADDED], 0, id);
+ g_free (id);
+ }
- seahorse_keyset_set_closure (skset, skey, GUINT_TO_POINTER (uids));
+ seahorse_set_set_closure (skset, sobj, GUINT_TO_POINTER (uids));
}
static void
-seahorse_service_keyset_removed (SeahorseKeyset *skset, SeahorseKey *skey,
+seahorse_service_keyset_removed (SeahorseSet *skset, SeahorseObject *sobj,
gpointer closure, gpointer userdata)
{
gchar *id;
@@ -332,44 +341,45 @@
uids = (uids == 0) ? 1 : uids;
for (i = 0; i < uids; i++) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), sobj, i);
g_signal_emit (SEAHORSE_SERVICE_KEYSET (skset), signals[KEY_REMOVED], 0, id);
g_free (id);
}
}
static void
-seahorse_service_keyset_changed (SeahorseKeyset *skset, SeahorseKey *skey,
- SeahorseKeyChange change, gpointer closure,
+seahorse_service_keyset_changed (SeahorseSet *skset, SeahorseObject *sobj,
+ SeahorseObjectChange change, gpointer closure,
gpointer userdata)
{
gchar *id;
- guint uids, euids, i;
+ guint uids = 0, euids, i;
/* Adding or removing uids means we do a add/remove */
- uids = seahorse_key_get_num_names (skey);
+ if (SEAHORSE_IS_KEY (sobj))
+ uids = seahorse_key_get_num_names (SEAHORSE_KEY (sobj));
uids = (uids == 0) ? 1 : uids;
euids = GPOINTER_TO_UINT (closure);
if (euids != uids)
- seahorse_keyset_set_closure (skset, skey, GUINT_TO_POINTER (uids));
+ seahorse_set_set_closure (skset, sobj, GUINT_TO_POINTER (uids));
if (euids < uids) {
for (i = euids; i < uids; i++) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), sobj, i);
g_signal_emit (SEAHORSE_SERVICE_KEYSET (skset), signals[KEY_ADDED], 0, id);
g_free (id);
}
} else if (euids > uids) {
for (i = uids; i < euids; i++) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), sobj, i);
g_signal_emit (SEAHORSE_SERVICE_KEYSET (skset), signals[KEY_REMOVED], 0, id);
g_free (id);
}
}
for (i = 0; i < uids; i++) {
- id = seahorse_context_key_to_dbus (SCTX_APP (), skey, i);
+ id = seahorse_context_object_to_dbus (SCTX_APP (), sobj, i);
g_signal_emit (SEAHORSE_SERVICE_KEYSET (skset), signals[KEY_CHANGED], 0, id);
g_free (id);
}
@@ -412,18 +422,18 @@
* PUBLIC METHODS
*/
-SeahorseKeyset*
-seahorse_service_keyset_new (GQuark ktype, SeahorseKeyLoc location)
+SeahorseSet*
+seahorse_service_keyset_new (GQuark ktype, SeahorseLocation location)
{
SeahorseServiceKeyset *skset;
- SeahorseKeyPredicate *pred = g_new0(SeahorseKeyPredicate, 1);
+ SeahorseObjectPredicate *pred = g_new0(SeahorseObjectPredicate, 1);
- pred->ktype = ktype;
+ pred->tag = ktype;
pred->location = location;
skset = g_object_new (SEAHORSE_TYPE_SERVICE_KEYSET, "predicate", pred, NULL);
g_object_set_data_full (G_OBJECT (skset), "quick-predicate", pred, g_free);
skset->ktype = ktype;
- return SEAHORSE_KEYSET (skset);
+ return SEAHORSE_SET (skset);
}
Modified: trunk/daemon/seahorse-service.c
==============================================================================
--- trunk/daemon/seahorse-service.c (original)
+++ trunk/daemon/seahorse-service.c Thu Jul 17 01:41:51 2008
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
*/
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 @@
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 */
Modified: trunk/daemon/seahorse-service.h
==============================================================================
--- trunk/daemon/seahorse-service.h (original)
+++ trunk/daemon/seahorse-service.h Thu Jul 17 01:41:51 2008
@@ -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 @@
#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 @@
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);
Modified: trunk/gkr/libseahorse-gkr-c.vapi
==============================================================================
--- trunk/gkr/libseahorse-gkr-c.vapi (original)
+++ trunk/gkr/libseahorse-gkr-c.vapi Thu Jul 17 01:41:51 2008
@@ -27,7 +27,7 @@
}
[CCode (cheader_filename = "seahorse-gkeyring-source.h")]
- public class Source : Seahorse.KeySource {
+ public class Source : Seahorse.Source {
}
Modified: trunk/gkr/seahorse-gkeyring-item-properties.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-item-properties.c (original)
+++ trunk/gkr/seahorse-gkeyring-item-properties.c Thu Jul 17 01:41:51 2008
@@ -614,7 +614,7 @@
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 @@
/* 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);
Modified: trunk/gkr/seahorse-gkeyring-item.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-item.c (original)
+++ trunk/gkr/seahorse-gkeyring-item.c Thu Jul 17 01:41:51 2008
@@ -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 @@
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 @@
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 @@
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 @@
*/
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 @@
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;
}
Modified: trunk/gkr/seahorse-gkeyring-item.h
==============================================================================
--- trunk/gkr/seahorse-gkeyring-item.h (original)
+++ trunk/gkr/seahorse-gkeyring-item.h Thu Jul 17 01:41:51 2008
@@ -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 @@
};
// 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,
Modified: trunk/gkr/seahorse-gkeyring-operation.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-operation.c (original)
+++ trunk/gkr/seahorse-gkeyring-operation.c Thu Jul 17 01:41:51 2008
@@ -250,13 +250,13 @@
/* 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 @@
SeahorseOperation*
seahorse_gkeyring_operation_update_acl (SeahorseGKeyringItem *git, GList *acl)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseGKeyringOperation *gop;
SeahorseGKeyringOperationPrivate *pv;
const gchar *keyring_name;
Modified: trunk/gkr/seahorse-gkeyring-source.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-source.c (original)
+++ trunk/gkr/seahorse-gkeyring-source.c Thu Jul 17 01:41:51 2008
@@ -69,14 +69,14 @@
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 @@
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 @@
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 @@
/* 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 @@
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 @@
/* 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 @@
*/
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 @@
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 @@
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 @@
}
static SeahorseOperation*
-seahorse_gkeyring_source_load (SeahorseKeySource *src, GQuark keyid)
+seahorse_gkeyring_source_load (SeahorseSource *src, GQuark keyid)
{
SeahorseGKeyringSource *gsrc;
SeahorseListOperation *lop;
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
gsrc = SEAHORSE_GKEYRING_SOURCE (src);
lop = start_list_operation (gsrc, keyid);
@@ -589,7 +589,7 @@
}
static SeahorseOperation*
-seahorse_gkeyring_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_gkeyring_source_import (SeahorseSource *sksrc, GInputStream *input)
{
GError *err = NULL;
@@ -602,7 +602,7 @@
}
static SeahorseOperation*
-seahorse_gkeyring_source_export (SeahorseKeySource *sksrc, GList *keys,
+seahorse_gkeyring_source_export (SeahorseSource *sksrc, GList *keys,
gboolean complete, GOutputStream *output)
{
GError *err = NULL;
@@ -616,7 +616,7 @@
}
static gboolean
-seahorse_gkeyring_source_remove (SeahorseKeySource *sksrc, SeahorseKey *skey,
+seahorse_gkeyring_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
guint name, GError **err)
{
SeahorseGKeyringItem *git;
@@ -624,8 +624,8 @@
GnomeKeyringResult res;
gboolean ret;
- g_return_val_if_fail (SEAHORSE_IS_GKEYRING_ITEM (skey), FALSE);
- git = SEAHORSE_GKEYRING_ITEM (skey);
+ g_return_val_if_fail (SEAHORSE_IS_GKEYRING_ITEM (sobj), FALSE);
+ git = SEAHORSE_GKEYRING_ITEM (sobj);
g_return_val_if_fail (SEAHORSE_IS_GKEYRING_SOURCE (sksrc), FALSE);
gsrc = SEAHORSE_GKEYRING_SOURCE (sksrc);
@@ -637,8 +637,8 @@
ret = seahorse_gkeyring_operation_parse_error (res, err);
if (ret) {
- seahorse_context_remove_key (SCTX_APP (), skey);
- seahorse_key_source_load_async (sksrc, 0);
+ seahorse_context_remove_object (SCTX_APP (), sobj);
+ seahorse_source_load_async (sksrc, 0);
}
return ret;
@@ -691,7 +691,7 @@
seahorse_gkeyring_source_class_init (SeahorseGKeyringSourceClass *klass)
{
GObjectClass *gobject_class;
- SeahorseKeySourceClass *key_class;
+ SeahorseSourceClass *key_class;
seahorse_gkeyring_source_parent_class = g_type_class_peek_parent (klass);
@@ -702,7 +702,7 @@
gobject_class->set_property = seahorse_gkeyring_source_set_property;
gobject_class->get_property = seahorse_gkeyring_source_get_property;
- key_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
+ key_class = SEAHORSE_SOURCE_CLASS (klass);
key_class->load = seahorse_gkeyring_source_load;
key_class->import = seahorse_gkeyring_source_import;
key_class->export = seahorse_gkeyring_source_export;
@@ -721,8 +721,8 @@
NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseKeyLoc",
- 0, G_MAXUINT, SKEY_LOC_INVALID, G_PARAM_READABLE));
+ g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
+ 0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));
seahorse_registry_register_type (NULL, SEAHORSE_TYPE_GKEYRING_SOURCE, "key-source", "local", SEAHORSE_GKR_STR, NULL);
Modified: trunk/gkr/seahorse-gkeyring-source.h
==============================================================================
--- trunk/gkr/seahorse-gkeyring-source.h (original)
+++ trunk/gkr/seahorse-gkeyring-source.h Thu Jul 17 01:41:51 2008
@@ -22,20 +22,20 @@
/**
* SeahorseGKeyringSource: A key source for gnome-keyring credentials
*
- * - Derived from SeahorseKeySource
+ * - Derived from SeahorseSource
* - Adds the keys it loads to the SeahorseContext.
*
* Properties:
* ktype: (GQuark) The ktype (ie: SEAHORSE_GKR) of keys originating from this
key source.
- * location: (SeahorseKeyLoc) The location of keys that come from this
- * source. (ie: SKEY_LOC_LOCAL)
+ * location: (SeahorseLocation) The location of keys that come from this
+ * source. (ie: SEAHORSE_LOCATION_LOCAL)
*/
#ifndef __SEAHORSE_GKEYRING_SOURCE_H__
#define __SEAHORSE_GKEYRING_SOURCE_H__
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#define SEAHORSE_TYPE_GKEYRING_SOURCE (seahorse_gkeyring_source_get_type ())
#define SEAHORSE_GKEYRING_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GKEYRING_SOURCE, SeahorseGKeyringSource))
@@ -49,14 +49,14 @@
typedef struct _SeahorseGKeyringSourcePrivate SeahorseGKeyringSourcePrivate;
struct _SeahorseGKeyringSource {
- SeahorseKeySource parent;
+ SeahorseSource parent;
/*< private >*/
SeahorseGKeyringSourcePrivate *pv;
};
struct _SeahorseGKeyringSourceClass {
- SeahorseKeySourceClass parent_class;
+ SeahorseSourceClass parent_class;
};
GType seahorse_gkeyring_source_get_type (void);
Modified: trunk/gkr/seahorse-gkr-commands.c
==============================================================================
--- trunk/gkr/seahorse-gkr-commands.c (original)
+++ trunk/gkr/seahorse-gkr-commands.c Thu Jul 17 01:41:51 2008
@@ -25,7 +25,7 @@
#include <seahorse-view.h>
#include <glib/gi18n-lib.h>
#include <seahorse-util.h>
-#include <seahorse-key-source.h>
+#include <seahorse-source.h>
#include <common/seahorse-registry.h>
#include "seahorse-gkr.h"
@@ -43,23 +43,23 @@
SEAHORSE_GKEYRING_COMMANDS_UI_DEFINITION,
SEAHORSE_GKEYRING_COMMANDS_COMMAND_ACTIONS
};
-static void seahorse_gkeyring_commands_real_show_properties (SeahorseCommands* base, SeahorseKey* key);
-static void seahorse_gkeyring_commands_real_delete_keys (SeahorseCommands* base, GList* keys, GError** error);
+static void seahorse_gkeyring_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key);
+static void seahorse_gkeyring_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error);
static gpointer seahorse_gkeyring_commands_parent_class = NULL;
static void seahorse_gkeyring_commands_dispose (GObject * obj);
-static void seahorse_gkeyring_commands_real_show_properties (SeahorseCommands* base, SeahorseKey* key) {
+static void seahorse_gkeyring_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key) {
SeahorseGKeyringCommands * self;
self = SEAHORSE_GKEYRING_COMMANDS (base);
- g_return_if_fail (SEAHORSE_IS_KEY (key));
- g_return_if_fail (seahorse_key_get_ktype (key) == SEAHORSE_GKEYRING_TYPE);
+ g_return_if_fail (SEAHORSE_IS_OBJECT (key));
+ g_return_if_fail (seahorse_object_get_tag (key) == SEAHORSE_GKEYRING_TYPE);
seahorse_gkeyring_item_properties_show (SEAHORSE_GKEYRING_ITEM (key), seahorse_view_get_window (seahorse_commands_get_view (SEAHORSE_COMMANDS (self))));
}
-static void seahorse_gkeyring_commands_real_delete_keys (SeahorseCommands* base, GList* keys, GError** error) {
+static void seahorse_gkeyring_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error) {
SeahorseGKeyringCommands * self;
GError * inner_error;
guint num;
@@ -75,14 +75,14 @@
if (num == 1) {
char* _tmp0;
_tmp0 = NULL;
- prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the password '%s'?"), seahorse_key_get_display_name (((SeahorseKey*) (((SeahorseKey*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp0);
+ prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the password '%s'?"), seahorse_object_get_description (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp0);
} else {
char* _tmp1;
_tmp1 = NULL;
prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete %d passwords?"), num), (prompt = (g_free (prompt), NULL)), _tmp1);
}
if (seahorse_util_prompt_delete (prompt)) {
- seahorse_key_source_delete_keys (keys, &inner_error);
+ seahorse_source_delete_objects (keys, &inner_error);
if (inner_error != NULL) {
g_propagate_error (error, inner_error);
prompt = (g_free (prompt), NULL);
@@ -149,7 +149,7 @@
G_OBJECT_CLASS (klass)->get_property = seahorse_gkeyring_commands_get_property;
G_OBJECT_CLASS (klass)->dispose = seahorse_gkeyring_commands_dispose;
SEAHORSE_COMMANDS_CLASS (klass)->show_properties = seahorse_gkeyring_commands_real_show_properties;
- SEAHORSE_COMMANDS_CLASS (klass)->delete_keys = seahorse_gkeyring_commands_real_delete_keys;
+ SEAHORSE_COMMANDS_CLASS (klass)->delete_objects = seahorse_gkeyring_commands_real_delete_objects;
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_GKEYRING_COMMANDS_KTYPE, "ktype");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_GKEYRING_COMMANDS_UI_DEFINITION, "ui-definition");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_GKEYRING_COMMANDS_COMMAND_ACTIONS, "command-actions");
Modified: trunk/gkr/seahorse-gkr-commands.h
==============================================================================
--- trunk/gkr/seahorse-gkr-commands.h (original)
+++ trunk/gkr/seahorse-gkr-commands.h Thu Jul 17 01:41:51 2008
@@ -25,7 +25,7 @@
#include <glib.h>
#include <glib-object.h>
#include <seahorse-commands.h>
-#include <seahorse-key.h>
+#include <seahorse-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
Modified: trunk/gkr/seahorse-gkr-commands.vala
==============================================================================
--- trunk/gkr/seahorse-gkr-commands.vala (original)
+++ trunk/gkr/seahorse-gkr-commands.vala Thu Jul 17 01:41:51 2008
@@ -48,24 +48,24 @@
}
}
- public override void show_properties (Seahorse.Key key) {
- return_if_fail (key.ktype == Seahorse.Gkr.TYPE);
+ public override void show_properties (Object key) {
+ return_if_fail (key.tag == Seahorse.Gkr.TYPE);
ItemProperties.show ((Gkr.Item)key, view.window);
}
- public override void delete_keys (List<Key> keys) throws GLib.Error {
+ public override void delete_objects (List<Object> keys) throws GLib.Error {
uint num = keys.length();
if (num == 0)
return;
string prompt;
if (num == 1)
- prompt = _("Are you sure you want to delete the password '%s'?").printf(keys.data.display_name);
+ prompt = _("Are you sure you want to delete the password '%s'?").printf(keys.data.description);
else
prompt = _("Are you sure you want to delete %d passwords?").printf(num);
if (Util.prompt_delete (prompt))
- KeySource.delete_keys (keys);
+ Seahorse.Source.delete_objects (keys);
}
}
}
Modified: trunk/gkr/vala-build.stamp
==============================================================================
--- trunk/gkr/vala-build.stamp (original)
+++ trunk/gkr/vala-build.stamp Thu Jul 17 01:41:51 2008
@@ -1 +1 @@
-1216229805
+1216254164
Modified: trunk/libseahorse/Makefile.am
==============================================================================
--- trunk/libseahorse/Makefile.am (original)
+++ trunk/libseahorse/Makefile.am Thu Jul 17 01:41:51 2008
@@ -18,7 +18,9 @@
VALA_SRCS = \
seahorse-commands.vala \
seahorse-generator.vala \
+ seahorse-object.vala \
seahorse-servers.vala \
+ seahorse-types.vala \
seahorse-view.vala
VALA_PKGS = \
@@ -51,13 +53,13 @@
libseahorse_la_SOURCES = \
seahorse-key.c seahorse-key.h \
- seahorse-key-source.c seahorse-key-source.h \
+ seahorse-source.c seahorse-source.h \
seahorse-key-widget.c seahorse-key-widget.h \
seahorse-unknown-key.c seahorse-unknown-key.h \
seahorse-unknown-source.c seahorse-unknown-source.h \
seahorse-context.c seahorse-context.h \
seahorse-widget.c seahorse-widget.h \
- seahorse-keyset.c seahorse-keyset.h \
+ seahorse-set.c seahorse-set.h \
seahorse-key-model.c seahorse-key-model.h \
seahorse-util.c seahorse-util.h \
seahorse-validity.c seahorse-validity.h \
Modified: trunk/libseahorse/libseahorse-c.vapi
==============================================================================
--- trunk/libseahorse/libseahorse-c.vapi (original)
+++ trunk/libseahorse/libseahorse-c.vapi Thu Jul 17 01:41:51 2008
@@ -22,41 +22,24 @@
[CCode (cprefix = "Seahorse", lower_case_cprefix = "seahorse_")]
namespace Seahorse {
- [CCode (cheader_filename = "seahorse-key-source.h")]
- public class KeySource : GLib.Object {
+ [CCode (cheader_filename = "seahorse-source.h")]
+ public class Source : GLib.Object {
public GLib.Quark ktype { get; }
- public static Operation export_keys (GLib.List<Key> keys, GLib.OutputStream output);
- public static void delete_keys (GLib.List<Key> keys) throws GLib.Error;
+ public static Operation export_objects (GLib.List<Object> objects, GLib.OutputStream output);
+ public static void delete_objects (GLib.List<Object> objects) throws GLib.Error;
- public virtual Operation load (GLib.Quark keyid);
+ public virtual Operation load (GLib.Quark id);
public virtual Operation search (string match);
public virtual Operation import (GLib.InputStream input);
- public virtual Operation export (GLib.List<weak Key> keys, bool complete, GLib.OutputStream output);
- public virtual Operation export_raw (GLib.List<GLib.Quark> keyids, GLib.OutputStream output);
- public virtual void remove (Key key, uint name) throws GLib.Error;
+ public virtual Operation export (GLib.List<weak Object> objects, bool complete, GLib.OutputStream output);
+ public virtual Operation export_raw (GLib.List<GLib.Quark> ids, GLib.OutputStream output);
+ public virtual void remove (Object object, uint name) throws GLib.Error;
}
[CCode (cheader_filename = "seahorse-key.h")]
- public class Key : Gtk.Object {
- [CCode (cprefix = "SKEY_LOC_")]
- public static enum Loc {
- INVALID = 0,
- MISSING = 10,
- SEARCHING = 20,
- REMOTE = 50,
- LOCAL = 100
- }
-
- [CCode (cprefix = "SKEY_")]
- public static enum EType {
- ETYPE_NONE = 0,
- SYMMETRIC = 1,
- PUBLIC = 2,
- PRIVATE = 3,
- CREDENTIALS
- }
+ public class Key : Seahorse.Object {
- [CCode (cprefix = "SKEY_FLAG_")]
+ [CCode (cprefix = "SKEY_FLAG_")]
public static enum Flag {
IS_VALID = 0x0001,
CAN_ENCRYPT = 0x0002,
@@ -69,28 +52,14 @@
public GLib.Quark ktype { get; }
public GLib.Quark keyid { get; }
- public EType etype { get; }
+ public Usage usage { get; }
public string display_name { get; }
}
- public delegate bool KeyPredicateFunc (Key key);
-
- [CCode (cheader_filename = "seahorse-key.h")]
- public struct KeyPredicate {
- public GLib.Quark ktype;
- public GLib.Quark keyid;
- public Key.Loc location;
- public Key.EType etype;
- public uint flags;
- public uint nflags;
- public weak KeySource sksrc;
- public KeyPredicateFunc custom;
- }
-
- [CCode (cheader_filename = "seahorse-keyset.h")]
- public class Keyset : GLib.Object {
- public Keyset.full (ref KeyPredicate pred);
- public bool has_key (Key key);
+ [CCode (cheader_filename = "seahorse-set.h")]
+ public class Set : GLib.Object {
+ public Set.full (ref Object.Predicate pred);
+ public bool has_object (Object obj);
}
public delegate void DoneFunc (Operation op);
@@ -115,11 +84,11 @@
public class Context : Gtk.Object {
public static weak Context for_app ();
public uint count { get; }
- public weak KeySource find_key_source (GLib.Quark ktype, Key.Loc location);
- public void add_key_source (KeySource sksrc);
- public weak Key? find_key (GLib.Quark ktype, Key.Loc loc);
- public GLib.List<weak Key> find_keys (GLib.Quark ktype, Key.EType etype, Key.Loc loc);
- public Operation transfer_keys (GLib.List<Key> keys, KeySource? to);
+ public weak Source find_source (GLib.Quark ktype, Location location);
+ public void add_source (Source sksrc);
+ public weak Object? find_object (GLib.Quark ktype, Location loc);
+ public GLib.List<weak Object> find_objects (GLib.Quark ktype, Usage usage, Location loc);
+ public Operation transfer_objects (GLib.List<Object> objects, Source? to);
public void destroy ();
}
@@ -201,7 +170,7 @@
[CCode (cheader_filename = "seahorse-key-manager-store.h")]
public class KeyManagerStore : GLib.Object {
- public KeyManagerStore(Keyset keyset, Gtk.TreeView view);
+ public KeyManagerStore(Set set, Gtk.TreeView view);
public static GLib.List<weak Key> get_selected_keys (Gtk.TreeView view);
public static void set_selected_keys (Gtk.TreeView view, GLib.List<Key> keys);
public static weak Key? get_selected_key (Gtk.TreeView view, out uint uid);
Modified: trunk/libseahorse/libseahorse.gidl
==============================================================================
--- trunk/libseahorse/libseahorse.gidl (original)
+++ trunk/libseahorse/libseahorse.gidl Thu Jul 17 01:41:51 2008
@@ -1,18 +1,33 @@
<?xml version="1.0"?>
<api version="1.0">
<namespace name="Seahorse">
+ <enum name="SeahorseLocation" get-type="seahorse_location_get_type">
+ <member name="SEAHORSE_LOCATION_INVALID"/>
+ <member name="SEAHORSE_LOCATION_MISSING"/>
+ <member name="SEAHORSE_LOCATION_SEARCHING"/>
+ <member name="SEAHORSE_LOCATION_REMOTE"/>
+ <member name="SEAHORSE_LOCATION_LOCAL"/>
+ </enum>
+ <enum name="SeahorseUsage" get-type="seahorse_usage_get_type">
+ <member name="SEAHORSE_USAGE_NONE"/>
+ <member name="SEAHORSE_USAGE_SYMMETRIC_KEY"/>
+ <member name="SEAHORSE_USAGE_PUBLIC_KEY"/>
+ <member name="SEAHORSE_USAGE_PRIVATE_KEY"/>
+ <member name="SEAHORSE_USAGE_CREDENTIALS"/>
+ <member name="SEAHORSE_USAGE_OTHER"/>
+ </enum>
<object name="Commands" parent="GLib.Object" type-name="SeahorseCommands" get-type="seahorse_commands_get_type">
<method name="show_properties" symbol="seahorse_commands_show_properties">
<parameters>
<parameter name="self" type="Seahorse.Commands*"/>
- <parameter name="key" type="Seahorse.Key*"/>
+ <parameter name="obj" type="Seahorse.Object*"/>
</parameters>
<return-type type="void"/>
</method>
- <method name="delete_keys" symbol="seahorse_commands_delete_keys">
+ <method name="delete_objects" symbol="seahorse_commands_delete_objects">
<parameters>
<parameter name="self" type="Seahorse.Commands*"/>
- <parameter name="keys" type="GLib.List*"/>
+ <parameter name="obj" type="GLib.List*"/>
</parameters>
<return-type type="void"/>
</method>
@@ -24,6 +39,83 @@
<object name="Generator" parent="GLib.Object" type-name="SeahorseGenerator" get-type="seahorse_generator_get_type">
<property name="actions" type="Gtk.ActionGroup*" readable="1"/>
</object>
+ <object name="Object" parent="GLib.Object" type-name="SeahorseObject" get-type="seahorse_object_get_type">
+ <enum name="SeahorseObjectChange" get-type="seahorse_object_change_get_type">
+ <member name="SEAHORSE_OBJECT_CHANGE_ALL"/>
+ <member name="SEAHORSE_OBJECT_CHANGE_LOCATION"/>
+ <member name="SEAHORSE_OBJECT_CHANGE_PREFERRED"/>
+ <member name="SEAHORSE_OBJECT_CHANGE_MAX"/>
+ </enum>
+ <field name="_tag"/>
+ <field name="_id"/>
+ <field name="_location"/>
+ <field name="_usage"/>
+ <field name="_flags"/>
+ <field name="attached_to"/>
+ <method name="get_children" symbol="seahorse_object_get_children">
+ <parameters>
+ <parameter name="self" type="Seahorse.Object*"/>
+ </parameters>
+ <return-type type="GLib.List*" transfer="full"/>
+ </method>
+ <method name="fire_changed" symbol="seahorse_object_fire_changed">
+ <parameters>
+ <parameter name="self" type="Seahorse.Object*"/>
+ <parameter name="what" type="Seahorse.Object.Change"/>
+ </parameters>
+ <return-type type="void"/>
+ </method>
+ <property name="tag" type="GLib.Quark" readable="1"/>
+ <property name="id" type="GLib.Quark" readable="1"/>
+ <property name="location" type="Seahorse.Location" readable="1" writable="1"/>
+ <property name="usage" type="Seahorse.Usage" readable="1"/>
+ <property name="flags" type="uint" readable="1"/>
+ <property name="source" type="Seahorse.Source*" readable="1" writable="1"/>
+ <property name="preferred" type="Seahorse.Object*" readable="1" writable="1"/>
+ <property name="description" type="string*" readable="1"/>
+ <property name="markup" type="string*" readable="1"/>
+ <property name="stock_icon" type="string*" readable="1"/>
+ <property name="parent" type="Seahorse.Object*" readable="1" writable="1"/>
+ <signal name="changed">
+ <parameters>
+ <parameter name="what" type="Seahorse.Object.Change"/>
+ </parameters>
+ <return-type type="void"/>
+ </signal>
+ <signal name="hierarchy">
+ <parameters>
+ </parameters>
+ <return-type type="void"/>
+ </signal>
+ <signal name="destroy">
+ <parameters>
+ </parameters>
+ <return-type type="void"/>
+ </signal>
+ <struct name="SeahorseObjectPredicate">
+ <field name="tag"/>
+ <field name="id"/>
+ <field name="location"/>
+ <field name="usage"/>
+ <field name="flags"/>
+ <field name="nflags"/>
+ <field name="source"/>
+ <field name="custom"/>
+ <method name="match" symbol="seahorse_object_predicate_match">
+ <parameters>
+ <parameter name="self" type="Seahorse.Object.Predicate"/>
+ <parameter name="obj" type="Seahorse.Object*"/>
+ </parameters>
+ <return-type type="bool" transfer="full"/>
+ </method>
+ </struct>
+ <callback name="SeahorseObjectPredicateFunc">
+ <parameters>
+ <parameter name="obj" type="Seahorse.Object*"/>
+ </parameters>
+ <return-type type="bool" transfer="full"/>
+ </callback>
+ </object>
<object name="Servers" parent="GLib.Object" type-name="SeahorseServers" get-type="seahorse_servers_get_type">
<method name="get_types" symbol="seahorse_servers_get_types">
<parameters>
@@ -70,28 +162,28 @@
<requires>
<object name="GLib.Object"/>
</requires>
- <method name="get_selected_keys" symbol="seahorse_view_get_selected_keys">
+ <method name="get_selected_objects" symbol="seahorse_view_get_selected_objects">
<parameters>
<parameter name="self" type="Seahorse.View*"/>
</parameters>
<return-type type="GLib.List*" transfer="full"/>
</method>
- <method name="set_selected_keys" symbol="seahorse_view_set_selected_keys">
+ <method name="set_selected_objects" symbol="seahorse_view_set_selected_objects">
<parameters>
<parameter name="self" type="Seahorse.View*"/>
- <parameter name="keys" type="GLib.List*"/>
+ <parameter name="objects" type="GLib.List*"/>
</parameters>
<return-type type="void"/>
</method>
- <method name="get_selected_key_and_uid" symbol="seahorse_view_get_selected_key_and_uid">
+ <method name="get_selected_object_and_uid" symbol="seahorse_view_get_selected_object_and_uid">
<parameters>
<parameter name="self" type="Seahorse.View*"/>
<parameter name="uid" type="uint" direction="out" transfer="full"/>
</parameters>
- <return-type type="Seahorse.Key*"/>
+ <return-type type="Seahorse.Object*"/>
</method>
- <property name="selected_key" type="Seahorse.Key*" readable="1" writable="1"/>
- <property name="current_keyset" type="Seahorse.Keyset*" readable="1"/>
+ <property name="selected" type="Seahorse.Object*" readable="1" writable="1"/>
+ <property name="current_set" type="Seahorse.Set*" readable="1"/>
<property name="window" type="Gtk.Window*" readable="1"/>
<signal name="selection_changed">
<parameters>
Modified: trunk/libseahorse/libseahorse.vapi
==============================================================================
--- trunk/libseahorse/libseahorse.vapi (original)
+++ trunk/libseahorse/libseahorse.vapi Thu Jul 17 01:41:51 2008
@@ -2,10 +2,27 @@
[CCode (cprefix = "Seahorse", lower_case_cprefix = "seahorse_")]
namespace Seahorse {
+ [CCode (cprefix = "SEAHORSE_LOCATION_", cheader_filename = "seahorse-types.h")]
+ public enum Location {
+ INVALID,
+ MISSING,
+ SEARCHING,
+ REMOTE,
+ LOCAL
+ }
+ [CCode (cprefix = "SEAHORSE_USAGE_", cheader_filename = "seahorse-types.h")]
+ public enum Usage {
+ NONE,
+ SYMMETRIC_KEY,
+ PUBLIC_KEY,
+ PRIVATE_KEY,
+ CREDENTIALS,
+ OTHER
+ }
[CCode (cheader_filename = "seahorse-commands.h")]
public abstract class Commands : GLib.Object {
- public abstract void show_properties (Seahorse.Key key);
- public abstract void delete_keys (GLib.List<Seahorse.Key> keys) throws GLib.Error;
+ public abstract void show_properties (Seahorse.Object obj);
+ public abstract void delete_objects (GLib.List<Seahorse.Object> obj) throws GLib.Error;
public Seahorse.View view { get; construct; }
public abstract GLib.Quark ktype { get; }
public abstract Gtk.ActionGroup command_actions { get; }
@@ -15,6 +32,52 @@
public abstract class Generator : GLib.Object {
public abstract Gtk.ActionGroup actions { get; }
}
+ [CCode (cheader_filename = "seahorse-object.h")]
+ public abstract class Object : GLib.Object {
+ [CCode (cprefix = "SEAHORSE_OBJECT_CHANGE_", cheader_filename = "seahorse-object.h")]
+ public enum Change {
+ ALL,
+ LOCATION,
+ PREFERRED,
+ MAX
+ }
+ protected GLib.Quark _tag;
+ protected GLib.Quark _id;
+ protected Seahorse.Location _location;
+ protected Seahorse.Usage _usage;
+ protected uint _flags;
+ public Seahorse.Context attached_to;
+ public GLib.List<weak Seahorse.Object> get_children ();
+ protected void fire_changed (Seahorse.Object.Change what);
+ public GLib.Quark tag { get; }
+ public GLib.Quark id { get; }
+ public Seahorse.Location location { get; set; }
+ public Seahorse.Usage usage { get; }
+ public uint flags { get; }
+ public Seahorse.Source source { get; set; }
+ public Seahorse.Object preferred { get; set; }
+ public abstract string# description { get; }
+ public abstract string# markup { get; }
+ public abstract string# stock_icon { get; }
+ public Seahorse.Object? parent { get; set; }
+ public signal void changed (Seahorse.Object.Change what);
+ public signal void hierarchy ();
+ public signal void destroy ();
+ [CCode (cheader_filename = "seahorse-object.h")]
+ public struct Predicate {
+ public GLib.Quark tag;
+ public GLib.Quark id;
+ public Seahorse.Location location;
+ public Seahorse.Usage usage;
+ public uint flags;
+ public uint nflags;
+ public weak Seahorse.Source? source;
+ public Seahorse.Object.PredicateFunc? custom;
+ public bool match (Seahorse.Object obj);
+ }
+ [CCode (cheader_filename = "seahorse-object.h")]
+ public delegate bool PredicateFunc (Seahorse.Object obj);
+ }
[CCode (cheader_filename = "seahorse-servers.h")]
public class Servers : GLib.Object {
public static GLib.SList<string> get_types ();
@@ -27,11 +90,11 @@
}
[CCode (cheader_filename = "seahorse-view.h")]
public interface View : GLib.Object {
- public abstract GLib.List<weak Seahorse.Key> get_selected_keys ();
- public abstract void set_selected_keys (GLib.List<Seahorse.Key> keys);
- public abstract weak Seahorse.Key? get_selected_key_and_uid (out uint uid);
- public abstract Seahorse.Key? selected_key { get; set; }
- public abstract Seahorse.Keyset? current_keyset { get; }
+ public abstract GLib.List<weak Seahorse.Object> get_selected_objects ();
+ public abstract void set_selected_objects (GLib.List<Seahorse.Object> objects);
+ public abstract weak Seahorse.Object? get_selected_object_and_uid (out uint uid);
+ public abstract Seahorse.Object? selected { get; set; }
+ public abstract Seahorse.Set? current_set { get; }
public abstract Gtk.Window window { get; }
public signal void selection_changed ();
}
Modified: trunk/libseahorse/seahorse-combo-keys.c
==============================================================================
--- trunk/libseahorse/seahorse-combo-keys.c (original)
+++ trunk/libseahorse/seahorse-combo-keys.c Thu Jul 17 01:41:51 2008
@@ -34,7 +34,7 @@
*/
static void
-key_added (SeahorseKeyset *skset, SeahorseKey *skey, GtkComboBox *combo)
+key_added (SeahorseSet *skset, SeahorseKey *skey, GtkComboBox *combo)
{
GtkListStore *model;
GtkTreeIter iter;
@@ -55,11 +55,11 @@
g_free (userid);
- seahorse_keyset_set_closure (skset, skey, GINT_TO_POINTER (TRUE));
+ seahorse_set_set_closure (skset, SEAHORSE_OBJECT (skey), GINT_TO_POINTER (TRUE));
}
static void
-key_changed (SeahorseKeyset *skset, SeahorseKey *skey, SeahorseKeyChange change,
+key_changed (SeahorseSet *skset, SeahorseKey *skey, SeahorseKeyChange change,
GtkWidget *closure, GtkComboBox *combo)
{
GtkTreeModel *model;
@@ -96,7 +96,7 @@
}
static void
-key_removed (SeahorseKeyset *skset, SeahorseKey *skey, GtkWidget *closure,
+key_removed (SeahorseSet *skset, SeahorseKey *skey, GtkWidget *closure,
GtkComboBox *combo)
{
GtkTreeModel *model;
@@ -129,7 +129,7 @@
}
static void
-combo_destroyed (GtkComboBox *combo, SeahorseKeyset *skset)
+combo_destroyed (GtkComboBox *combo, SeahorseSet *skset)
{
g_signal_handlers_disconnect_by_func (skset, key_added, combo);
g_signal_handlers_disconnect_by_func (skset, key_changed, combo);
@@ -141,7 +141,7 @@
*/
void
-seahorse_combo_keys_attach (GtkComboBox *combo, SeahorseKeyset *skset,
+seahorse_combo_keys_attach (GtkComboBox *combo, SeahorseSet *skset,
const gchar *none_option)
{
GtkTreeModel *model;
@@ -165,7 +165,7 @@
}
/* Setup the key list */
- keys = seahorse_keyset_get_keys (skset);
+ keys = seahorse_set_get_objects (skset);
for (l = keys; l != NULL; l = g_list_next (l)) {
skey = SEAHORSE_KEY (l->data);
key_added (skset, skey, combo);
Modified: trunk/libseahorse/seahorse-combo-keys.h
==============================================================================
--- trunk/libseahorse/seahorse-combo-keys.h (original)
+++ trunk/libseahorse/seahorse-combo-keys.h Thu Jul 17 01:41:51 2008
@@ -23,17 +23,19 @@
* seahorse_combo_keys_*: Shows a list of keys in a dropdown for selection.
*
* - Attaches to a GtkComboBox
- * - Gets its list of keys from a SeahorseKeyset.
+ * - Gets its list of keys from a SeahorseSet.
*/
#ifndef __SEAHORSE_COMBO_KEYS_H__
#define __SEAHORSE_COMBO_KEYS_H__
#include <gtk/gtk.h>
-#include "seahorse-keyset.h"
+
+#include "seahorse-key.h"
+#include "seahorse-set.h"
void seahorse_combo_keys_attach (GtkComboBox *combo,
- SeahorseKeyset *skset,
+ SeahorseSet *skset,
const gchar *none_option);
void seahorse_combo_keys_set_active_id (GtkComboBox *combo,
Modified: trunk/libseahorse/seahorse-commands.c
==============================================================================
--- trunk/libseahorse/seahorse-commands.c (original)
+++ trunk/libseahorse/seahorse-commands.c Thu Jul 17 01:41:51 2008
@@ -42,13 +42,13 @@
-void seahorse_commands_show_properties (SeahorseCommands* self, SeahorseKey* key) {
- SEAHORSE_COMMANDS_GET_CLASS (self)->show_properties (self, key);
+void seahorse_commands_show_properties (SeahorseCommands* self, SeahorseObject* obj) {
+ SEAHORSE_COMMANDS_GET_CLASS (self)->show_properties (self, obj);
}
-void seahorse_commands_delete_keys (SeahorseCommands* self, GList* keys, GError** error) {
- SEAHORSE_COMMANDS_GET_CLASS (self)->delete_keys (self, keys, error);
+void seahorse_commands_delete_objects (SeahorseCommands* self, GList* obj, GError** error) {
+ SEAHORSE_COMMANDS_GET_CLASS (self)->delete_objects (self, obj, error);
}
Modified: trunk/libseahorse/seahorse-commands.h
==============================================================================
--- trunk/libseahorse/seahorse-commands.h (original)
+++ trunk/libseahorse/seahorse-commands.h Thu Jul 17 01:41:51 2008
@@ -24,10 +24,10 @@
#include <glib.h>
#include <glib-object.h>
-#include <seahorse-key.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
+#include <seahorse-object.h>
#include <seahorse-view.h>
G_BEGIN_DECLS
@@ -51,13 +51,13 @@
struct _SeahorseCommandsClass {
GObjectClass parent_class;
- void (*show_properties) (SeahorseCommands* self, SeahorseKey* key);
- void (*delete_keys) (SeahorseCommands* self, GList* keys, GError** error);
+ void (*show_properties) (SeahorseCommands* self, SeahorseObject* obj);
+ void (*delete_objects) (SeahorseCommands* self, GList* obj, GError** error);
};
-void seahorse_commands_show_properties (SeahorseCommands* self, SeahorseKey* key);
-void seahorse_commands_delete_keys (SeahorseCommands* self, GList* keys, GError** error);
+void seahorse_commands_show_properties (SeahorseCommands* self, SeahorseObject* obj);
+void seahorse_commands_delete_objects (SeahorseCommands* self, GList* obj, GError** error);
SeahorseView* seahorse_commands_get_view (SeahorseCommands* self);
GQuark seahorse_commands_get_ktype (SeahorseCommands* self);
GtkActionGroup* seahorse_commands_get_command_actions (SeahorseCommands* self);
Modified: trunk/libseahorse/seahorse-commands.vala
==============================================================================
--- trunk/libseahorse/seahorse-commands.vala (original)
+++ trunk/libseahorse/seahorse-commands.vala Thu Jul 17 01:41:51 2008
@@ -37,8 +37,8 @@
public abstract string# ui_definition { get; }
- public abstract void show_properties (Key key);
+ public abstract void show_properties (Object obj);
- public abstract void delete_keys (List<Key> keys) throws GLib.Error;
+ public abstract void delete_objects (List<Object> obj) throws GLib.Error;
}
}
Modified: trunk/libseahorse/seahorse-context.c
==============================================================================
--- trunk/libseahorse/seahorse-context.c (original)
+++ trunk/libseahorse/seahorse-context.c Thu Jul 17 01:41:51 2008
@@ -58,23 +58,23 @@
G_DEFINE_TYPE (SeahorseContext, seahorse_context, GTK_TYPE_OBJECT);
/*
- * Two hashtables are used to keep track of the keys:
+ * Two hashtables are used to keep track of the objects:
*
- * keys_by_source: This contains a reference to the key and allows us to
- * lookup keys by their source. Each key/source combination should be
+ * objects_by_source: This contains a reference to the object and allows us to
+ * lookup objects by their source. Each object/source combination should be
* unique. Hashkeys are made with hashkey_by_source()
- * keys_by_type: Each value contains a GList of keys with the same keyid
- * (ie: same key from different key sources). The keys are
+ * objects_by_type: Each value contains a GList of objects with the same id
+ * (ie: same object from different sources). The objects are
* orderred in by preferred usage.
*/
struct _SeahorseContextPrivate {
- GSList *sources; /* Key sources which add keys to this context */
- GHashTable *auto_sources; /* Automatically added key sources (keyservers) */
- GHashTable *keys_by_source; /* See explanation above */
- GHashTable *keys_by_type; /* See explanation above */
+ GSList *sources; /* Sources which add keys to this context */
+ GHashTable *auto_sources; /* Automatically added sources (keyservers) */
+ GHashTable *objects_by_source; /* See explanation above */
+ GHashTable *objects_by_type; /* See explanation above */
guint notify_id; /* Notify for GConf watch */
- SeahorseServiceDiscovery *discovery; /* Adds key sources from DNS-SD */
+ SeahorseServiceDiscovery *discovery; /* Adds sources from DNS-SD */
};
static void seahorse_context_dispose (GObject *gobject);
@@ -97,13 +97,13 @@
signals[ADDED] = g_signal_new ("added", SEAHORSE_TYPE_CONTEXT,
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, added),
- NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_KEY);
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_OBJECT);
signals[REMOVED] = g_signal_new ("removed", SEAHORSE_TYPE_CONTEXT,
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, removed),
- NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_KEY);
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_OBJECT);
signals[CHANGED] = g_signal_new ("changed", SEAHORSE_TYPE_CONTEXT,
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, changed),
- NULL, NULL, seahorse_marshal_VOID__OBJECT_UINT, G_TYPE_NONE, 2, SEAHORSE_TYPE_KEY, G_TYPE_UINT);
+ NULL, NULL, seahorse_marshal_VOID__OBJECT_UINT, G_TYPE_NONE, 2, SEAHORSE_TYPE_OBJECT, G_TYPE_UINT);
}
/* init context, private vars, set prefs, connect signals */
@@ -116,12 +116,12 @@
/* A list of sources */
sctx->pv->sources = NULL;
- /* A table of keys */
- sctx->pv->keys_by_source = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, g_object_unref);
+ /* A table of objects */
+ sctx->pv->objects_by_source = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+ NULL, g_object_unref);
- sctx->pv->keys_by_type = g_hash_table_new_full (g_direct_hash, g_direct_equal,
- NULL, NULL);
+ sctx->pv->objects_by_type = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+ NULL, NULL);
/* The context is explicitly destroyed */
g_object_ref (sctx);
@@ -129,7 +129,7 @@
}
static gboolean
-remove_each (gpointer key, gpointer value, gpointer user_data)
+remove_each (gpointer object, gpointer value, gpointer user_data)
{
return TRUE;
}
@@ -143,9 +143,9 @@
sctx = SEAHORSE_CONTEXT (gobject);
- /* All the keys */
- g_hash_table_foreach_remove (sctx->pv->keys_by_source, remove_each, NULL);
- g_hash_table_foreach_remove (sctx->pv->keys_by_type, remove_each, NULL);
+ /* All the objects */
+ g_hash_table_foreach_remove (sctx->pv->objects_by_source, remove_each, NULL);
+ g_hash_table_foreach_remove (sctx->pv->objects_by_type, remove_each, NULL);
/* Gconf notification */
if (sctx->pv->notify_id)
@@ -164,24 +164,24 @@
/* Release all the sources */
for (l = sctx->pv->sources; l; l = g_slist_next (l))
- g_object_unref (SEAHORSE_KEY_SOURCE (l->data));
+ g_object_unref (SEAHORSE_SOURCE (l->data));
g_slist_free (sctx->pv->sources);
sctx->pv->sources = NULL;
G_OBJECT_CLASS (seahorse_context_parent_class)->dispose (gobject);
}
-/* destroy all keys, free private vars */
+/* destroy all objects, free private vars */
static void
seahorse_context_finalize (GObject *gobject)
{
SeahorseContext *sctx = SEAHORSE_CONTEXT (gobject);
/* Destroy the hash table */
- if (sctx->pv->keys_by_source)
- g_hash_table_destroy (sctx->pv->keys_by_source);
- if (sctx->pv->keys_by_type)
- g_hash_table_destroy (sctx->pv->keys_by_type);
+ if (sctx->pv->objects_by_source)
+ g_hash_table_destroy (sctx->pv->objects_by_source);
+ if (sctx->pv->objects_by_type)
+ g_hash_table_destroy (sctx->pv->objects_by_type);
/* Other stuff already done in dispose */
g_assert (sctx->pv->sources == NULL);
@@ -213,8 +213,8 @@
types = seahorse_registry_find_types (NULL, "key-source", "local", NULL);
for (l = types; l; l = g_list_next (l)) {
- SeahorseKeySource *src = g_object_new (GPOINTER_TO_UINT (l->data), NULL);
- seahorse_context_take_key_source (sctx, src);
+ SeahorseSource *src = g_object_new (GPOINTER_TO_UINT (l->data), NULL);
+ seahorse_context_take_source (sctx, src);
}
g_list_free (types);
@@ -260,20 +260,20 @@
}
void
-seahorse_context_take_key_source (SeahorseContext *sctx, SeahorseKeySource *sksrc)
+seahorse_context_take_source (SeahorseContext *sctx, SeahorseSource *sksrc)
{
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- g_return_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc));
+ g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
if (!g_slist_find (sctx->pv->sources, sksrc))
sctx->pv->sources = g_slist_append (sctx->pv->sources, sksrc);
}
void
-seahorse_context_add_key_source (SeahorseContext *sctx, SeahorseKeySource *sksrc)
+seahorse_context_add_source (SeahorseContext *sctx, SeahorseSource *sksrc)
{
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- g_return_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc));
+ g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
if (g_slist_find (sctx->pv->sources, sksrc))
return;
@@ -283,53 +283,53 @@
}
void
-seahorse_context_remove_key_source (SeahorseContext *sctx, SeahorseKeySource *sksrc)
+seahorse_context_remove_source (SeahorseContext *sctx, SeahorseSource *sksrc)
{
- GList *l, *keys;
+ GList *l, *objects;
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- g_return_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc));
+ g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
if (!g_slist_find (sctx->pv->sources, sksrc))
return;
- /* Remove all keys from this source */
- keys = seahorse_context_get_keys (sctx, sksrc);
- for (l = keys; l; l = g_list_next (l))
- seahorse_context_remove_key (sctx, SEAHORSE_KEY (l->data));
+ /* Remove all objects from this source */
+ objects = seahorse_context_get_objects (sctx, sksrc);
+ for (l = objects; l; l = g_list_next (l))
+ seahorse_context_remove_object (sctx, SEAHORSE_OBJECT (l->data));
/* Remove the source itself */
sctx->pv->sources = g_slist_remove (sctx->pv->sources, sksrc);
g_object_unref (sksrc);
}
-SeahorseKeySource*
-seahorse_context_find_key_source (SeahorseContext *sctx, GQuark ktype,
- SeahorseKeyLoc location)
+SeahorseSource*
+seahorse_context_find_source (SeahorseContext *sctx, GQuark ktype,
+ SeahorseLocation location)
{
- SeahorseKeySource *ks;
+ SeahorseSource *ks;
GSList *l;
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
- ks = SEAHORSE_KEY_SOURCE (l->data);
+ ks = SEAHORSE_SOURCE (l->data);
if (ktype != SKEY_UNKNOWN &&
- seahorse_key_source_get_ktype (ks) != ktype)
+ seahorse_source_get_ktype (ks) != ktype)
continue;
- if (location != SKEY_LOC_INVALID &&
- seahorse_key_source_get_location (ks) != location)
+ if (location != SEAHORSE_LOCATION_INVALID &&
+ seahorse_source_get_location (ks) != location)
continue;
return ks;
}
/* If we don't have an unknown source for this type, create it */
- if (location == SKEY_LOC_UNKNOWN && location != SKEY_UNKNOWN) {
- ks = SEAHORSE_KEY_SOURCE (seahorse_unknown_source_new (ktype));
- seahorse_context_add_key_source (sctx, ks);
+ if (location == SEAHORSE_LOCATION_MISSING && location != SKEY_UNKNOWN) {
+ ks = SEAHORSE_SOURCE (seahorse_unknown_source_new (ktype));
+ seahorse_context_add_source (sctx, ks);
return ks;
}
@@ -337,24 +337,24 @@
}
GSList*
-seahorse_context_find_key_sources (SeahorseContext *sctx, GQuark ktype,
- SeahorseKeyLoc location)
+seahorse_context_find_sources (SeahorseContext *sctx, GQuark ktype,
+ SeahorseLocation location)
{
- SeahorseKeySource *ks;
+ SeahorseSource *ks;
GSList *sources = NULL;
GSList *l;
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
- ks = SEAHORSE_KEY_SOURCE (l->data);
+ ks = SEAHORSE_SOURCE (l->data);
if (ktype != SKEY_UNKNOWN &&
- seahorse_key_source_get_ktype (ks) != ktype)
+ seahorse_source_get_ktype (ks) != ktype)
continue;
- if (location != SKEY_LOC_INVALID &&
- seahorse_key_source_get_location (ks) != location)
+ if (location != SEAHORSE_LOCATION_INVALID &&
+ seahorse_source_get_location (ks) != location)
continue;
sources = g_slist_append (sources, ks);
@@ -363,10 +363,10 @@
return sources;
}
-SeahorseKeySource*
-seahorse_context_remote_key_source (SeahorseContext *sctx, const gchar *uri)
+SeahorseSource*
+seahorse_context_remote_source (SeahorseContext *sctx, const gchar *uri)
{
- SeahorseKeySource *ks = NULL;
+ SeahorseSource *ks = NULL;
gboolean found = FALSE;
gchar *ks_uri;
GSList *l;
@@ -375,9 +375,9 @@
g_return_val_if_fail (uri && *uri, NULL);
for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
- ks = SEAHORSE_KEY_SOURCE (l->data);
+ ks = SEAHORSE_SOURCE (l->data);
- if (seahorse_key_source_get_location (ks) != SKEY_LOC_REMOTE)
+ if (seahorse_source_get_location (ks) != SEAHORSE_LOCATION_REMOTE)
continue;
g_object_get (ks, "uri", &ks_uri, NULL);
@@ -394,9 +394,9 @@
#ifdef WITH_PGP
/* Auto generate one if possible */
if (sctx->pv->auto_sources) {
- ks = SEAHORSE_KEY_SOURCE (seahorse_server_source_new (uri));
+ ks = SEAHORSE_SOURCE (seahorse_server_source_new (uri));
if (ks != NULL) {
- seahorse_context_take_key_source (sctx, ks);
+ seahorse_context_take_source (sctx, ks);
g_hash_table_replace (sctx->pv->auto_sources, g_strdup (uri), ks);
}
}
@@ -408,23 +408,23 @@
static void
-key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseContext *sctx)
+object_changed (SeahorseObject *sobj, SeahorseKeyChange change, SeahorseContext *sctx)
{
- g_signal_emit (sctx, signals[CHANGED], 0, skey, change);
+ g_signal_emit (sctx, signals[CHANGED], 0, sobj, change);
}
static void
-key_destroyed (SeahorseKey *skey, SeahorseContext *sctx)
+object_destroyed (SeahorseObject *sobj, SeahorseContext *sctx)
{
- /* When keys are destroyed elsewhere */
- seahorse_context_remove_key (sctx, skey);
+ /* When objects are destroyed elsewhere */
+ seahorse_context_remove_object (sctx, sobj);
}
static gpointer
-hashkey_by_source (SeahorseKeySource *sksrc, GQuark keyid)
+hashkey_by_source (SeahorseSource *sksrc, GQuark id)
{
return GINT_TO_POINTER (g_direct_hash (sksrc) ^
- g_str_hash (g_quark_to_string (keyid)));
+ g_str_hash (g_quark_to_string (id)));
}
static gint
@@ -432,11 +432,11 @@
{
guint aloc, bloc;
- g_assert (SEAHORSE_IS_KEY (a));
- g_assert (SEAHORSE_IS_KEY (b));
+ g_assert (SEAHORSE_IS_OBJECT (a));
+ g_assert (SEAHORSE_IS_OBJECT (b));
- aloc = seahorse_key_get_location (SEAHORSE_KEY (a));
- bloc = seahorse_key_get_location (SEAHORSE_KEY (b));
+ aloc = seahorse_object_get_location (SEAHORSE_OBJECT (a));
+ bloc = seahorse_object_get_location (SEAHORSE_OBJECT (b));
if (aloc == bloc)
return 0;
@@ -444,119 +444,119 @@
}
static void
-setup_keys_by_type (SeahorseContext *sctx, SeahorseKey *skey, gboolean add)
+setup_objects_by_type (SeahorseContext *sctx, SeahorseObject *sobj, gboolean add)
{
- GList *l, *keys = NULL;
- SeahorseKey *akey, *next;
- gpointer kt = GUINT_TO_POINTER (seahorse_key_get_keyid (skey));
+ GList *l, *objects = NULL;
+ SeahorseObject *aobj, *next;
+ gpointer kt = GUINT_TO_POINTER (seahorse_object_get_id (sobj));
gboolean first;
- /* Get current set of keys in this ktype/keyid */
+ /* Get current set of objects in this tag/id */
if (add)
- keys = g_list_prepend (keys, skey);
+ objects = g_list_prepend (objects, sobj);
- for (akey = g_hash_table_lookup (sctx->pv->keys_by_type, kt);
- akey; akey = akey->preferred)
+ for (aobj = g_hash_table_lookup (sctx->pv->objects_by_type, kt);
+ aobj; aobj = seahorse_object_get_preferred (aobj))
{
- if (akey != skey)
- keys = g_list_prepend (keys, akey);
+ if (aobj != sobj)
+ objects = g_list_prepend (objects, aobj);
}
- /* No keys just remove */
- if (!keys) {
- g_hash_table_remove (sctx->pv->keys_by_type, kt);
+ /* No objects just remove */
+ if (!objects) {
+ g_hash_table_remove (sctx->pv->objects_by_type, kt);
return;
}
/* Sort and add back */
- keys = g_list_sort (keys, sort_by_location);
- for (l = keys, first = TRUE; l; l = g_list_next (l), first = FALSE) {
+ objects = g_list_sort (objects, sort_by_location);
+ for (l = objects, first = TRUE; l; l = g_list_next (l), first = FALSE) {
- akey = SEAHORSE_KEY (l->data);
+ aobj = SEAHORSE_OBJECT (l->data);
/* Set first as start of list */
if (first)
- g_hash_table_replace (sctx->pv->keys_by_type, kt, akey);
+ g_hash_table_replace (sctx->pv->objects_by_type, kt, aobj);
/* Set next one as preferred */
else {
- next = g_list_next (l) ? SEAHORSE_KEY (g_list_next (l)->data) : NULL;
- seahorse_key_set_preferred (akey, next);
+ next = g_list_next (l) ? SEAHORSE_OBJECT (g_list_next (l)->data) : NULL;
+ seahorse_object_set_preferred (aobj, next);
}
}
- g_list_free (keys);
+ g_list_free (objects);
}
void
-seahorse_context_add_key (SeahorseContext *sctx, SeahorseKey *skey)
+seahorse_context_add_object (SeahorseContext *sctx, SeahorseObject *sobj)
{
- g_object_ref (skey);
- seahorse_context_take_key (sctx, skey);
+ g_object_ref (sobj);
+ seahorse_context_take_object (sctx, sobj);
}
void
-seahorse_context_take_key (SeahorseContext *sctx, SeahorseKey *skey)
+seahorse_context_take_object (SeahorseContext *sctx, SeahorseObject *sobj)
{
gpointer ks;
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- g_return_if_fail (SEAHORSE_IS_KEY (skey));
- g_return_if_fail (skey->keyid != 0);
- g_return_if_fail (!skey->attached_to);
+ g_return_if_fail (SEAHORSE_IS_OBJECT (sobj));
+ g_return_if_fail (sobj->_id != 0);
+ g_return_if_fail (!sobj->attached_to);
- ks = hashkey_by_source (seahorse_key_get_source (skey),
- seahorse_key_get_keyid (skey));
+ ks = hashkey_by_source (seahorse_object_get_source (sobj),
+ seahorse_object_get_id (sobj));
- g_return_if_fail (!g_hash_table_lookup (sctx->pv->keys_by_source, ks));
+ g_return_if_fail (!g_hash_table_lookup (sctx->pv->objects_by_source, ks));
- g_object_ref (skey);
+ g_object_ref (sobj);
- skey->attached_to = sctx;
- g_hash_table_replace (sctx->pv->keys_by_source, ks, skey);
- setup_keys_by_type (sctx, skey, TRUE);
- g_signal_emit (sctx, signals[ADDED], 0, skey);
- g_object_unref (skey);
+ sobj->attached_to = sctx;
+ g_hash_table_replace (sctx->pv->objects_by_source, ks, sobj);
+ setup_objects_by_type (sctx, sobj, TRUE);
+ g_signal_emit (sctx, signals[ADDED], 0, sobj);
+ g_object_unref (sobj);
- g_signal_connect (skey, "changed", G_CALLBACK (key_changed), sctx);
- g_signal_connect (skey, "destroy", G_CALLBACK (key_destroyed), sctx);
+ g_signal_connect (sobj, "changed", G_CALLBACK (object_changed), sctx);
+ g_signal_connect (sobj, "destroy", G_CALLBACK (object_destroyed), sctx);
}
guint
seahorse_context_get_count (SeahorseContext *sctx)
{
- return g_hash_table_size (sctx->pv->keys_by_source);
+ return g_hash_table_size (sctx->pv->objects_by_source);
}
-SeahorseKey*
-seahorse_context_get_key (SeahorseContext *sctx, SeahorseKeySource *sksrc,
- GQuark keyid)
+SeahorseObject*
+seahorse_context_get_object (SeahorseContext *sctx, SeahorseSource *sksrc,
+ GQuark id)
{
gconstpointer k;
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
- k = hashkey_by_source (sksrc, keyid);
- return SEAHORSE_KEY (g_hash_table_lookup (sctx->pv->keys_by_source, k));
+ k = hashkey_by_source (sksrc, id);
+ return SEAHORSE_OBJECT (g_hash_table_lookup (sctx->pv->objects_by_source, k));
}
-typedef struct _KeyMatcher {
+typedef struct _ObjectMatcher {
- SeahorseKeyPredicate *kp;
+ SeahorseObjectPredicate *kp;
gboolean many;
- GList *keys;
+ GList *objects;
-} KeyMatcher;
+} ObjectMatcher;
gboolean
-find_matching_keys (gpointer key, SeahorseKey *skey, KeyMatcher *km)
+find_matching_objects (gpointer key, SeahorseObject *sobj, ObjectMatcher *km)
{
- if (km->kp && seahorse_key_predicate_match (km->kp, skey))
- km->keys = g_list_prepend (km->keys, skey);
+ if (km->kp && seahorse_object_predicate_match (km->kp, SEAHORSE_OBJECT (sobj)))
+ km->objects = g_list_prepend (km->objects, sobj);
/* Terminate search */
- if (!km->many && km->keys)
+ if (!km->many && km->objects)
return TRUE;
/* Keep going */
@@ -564,65 +564,65 @@
}
GList*
-seahorse_context_get_keys (SeahorseContext *sctx, SeahorseKeySource *sksrc)
+seahorse_context_get_objects (SeahorseContext *sctx, SeahorseSource *sksrc)
{
- SeahorseKeyPredicate kp;
- KeyMatcher km;
+ SeahorseObjectPredicate kp;
+ ObjectMatcher km;
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
- g_return_val_if_fail (sksrc == NULL || SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
+ g_return_val_if_fail (sksrc == NULL || SEAHORSE_IS_SOURCE (sksrc), NULL);
memset (&kp, 0, sizeof (kp));
memset (&km, 0, sizeof (km));
km.kp = &kp;
km.many = TRUE;
- kp.sksrc = sksrc;
+ kp.source = sksrc;
- g_hash_table_find (sctx->pv->keys_by_source, (GHRFunc)find_matching_keys, &km);
- return km.keys;
+ g_hash_table_find (sctx->pv->objects_by_source, (GHRFunc)find_matching_objects, &km);
+ return km.objects;
}
-SeahorseKey*
-seahorse_context_find_key (SeahorseContext *sctx, GQuark keyid, SeahorseKeyLoc location)
+SeahorseObject*
+seahorse_context_find_object (SeahorseContext *sctx, GQuark id, SeahorseLocation location)
{
- SeahorseKey *skey;
+ SeahorseObject *sobj;
- skey = (SeahorseKey*)g_hash_table_lookup (sctx->pv->keys_by_type, GUINT_TO_POINTER (keyid));
- while (skey) {
+ sobj = (SeahorseObject*)g_hash_table_lookup (sctx->pv->objects_by_type, GUINT_TO_POINTER (id));
+ while (sobj) {
- /* If at the end and no more keys in list, return */
- if (location == SKEY_LOC_INVALID && !skey->preferred)
- return skey;
+ /* If at the end and no more objects in list, return */
+ if (location == SEAHORSE_LOCATION_INVALID && !seahorse_object_get_preferred (sobj))
+ return sobj;
- if (location >= seahorse_key_get_location (skey))
- return skey;
+ if (location >= seahorse_object_get_location (sobj))
+ return sobj;
/* Look down the list for this location */
- skey = skey->preferred;
+ sobj = seahorse_object_get_preferred (sobj);
}
return NULL;
}
GList*
-seahorse_context_find_keys (SeahorseContext *sctx, GQuark ktype,
- SeahorseKeyEType etype, SeahorseKeyLoc location)
+seahorse_context_find_objects (SeahorseContext *sctx, GQuark ktype,
+ SeahorseUsage usage, SeahorseLocation location)
{
- SeahorseKeyPredicate pred;
+ SeahorseObjectPredicate pred;
memset (&pred, 0, sizeof (pred));
- pred.ktype = ktype;
- pred.etype = etype;
+ pred.tag = ktype;
+ pred.usage = usage;
pred.location = location;
- return seahorse_context_find_keys_full (sctx, &pred);
+ return seahorse_context_find_objects_full (sctx, &pred);
}
GList*
-seahorse_context_find_keys_full (SeahorseContext *sctx, SeahorseKeyPredicate *skpred)
+seahorse_context_find_objects_full (SeahorseContext *sctx, SeahorseObjectPredicate *skpred)
{
- KeyMatcher km;
+ ObjectMatcher km;
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
@@ -631,38 +631,38 @@
km.kp = skpred;
km.many = TRUE;
- g_hash_table_find (sctx->pv->keys_by_source, (GHRFunc)find_matching_keys, &km);
- return km.keys;
+ g_hash_table_find (sctx->pv->objects_by_source, (GHRFunc)find_matching_objects, &km);
+ return km.objects;
}
gboolean
-seahorse_context_owns_key (SeahorseContext *sctx, SeahorseKey *skey)
+seahorse_context_owns_object (SeahorseContext *sctx, SeahorseObject *sobj)
{
- return skey->attached_to == sctx;
+ return sobj->attached_to == sctx;
}
void
-seahorse_context_remove_key (SeahorseContext *sctx, SeahorseKey *skey)
+seahorse_context_remove_object (SeahorseContext *sctx, SeahorseObject *sobj)
{
gconstpointer k;
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- g_return_if_fail (SEAHORSE_IS_KEY (skey));
+ g_return_if_fail (SEAHORSE_IS_OBJECT (sobj));
- k = hashkey_by_source (seahorse_key_get_source (skey),
- seahorse_key_get_keyid (skey));
+ k = hashkey_by_source (seahorse_object_get_source (sobj),
+ seahorse_object_get_id (sobj));
- if (g_hash_table_lookup (sctx->pv->keys_by_source, k)) {
- g_return_if_fail (skey->attached_to == sctx);
+ if (g_hash_table_lookup (sctx->pv->objects_by_source, k)) {
+ g_return_if_fail (sobj->attached_to == sctx);
- g_object_ref (skey);
- g_signal_handlers_disconnect_by_func (skey, key_changed, sctx);
- g_signal_handlers_disconnect_by_func (skey, key_destroyed, sctx);
- skey->attached_to = NULL;
- g_hash_table_remove (sctx->pv->keys_by_source, k);
- setup_keys_by_type (sctx, skey, FALSE);
- g_signal_emit (sctx, signals[REMOVED], 0, skey);
- g_object_unref (skey);
+ g_object_ref (sobj);
+ g_signal_handlers_disconnect_by_func (sobj, object_changed, sctx);
+ g_signal_handlers_disconnect_by_func (sobj, object_destroyed, sctx);
+ sobj->attached_to = NULL;
+ g_hash_table_remove (sctx->pv->objects_by_source, k);
+ setup_objects_by_type (sctx, sobj, FALSE);
+ g_signal_emit (sctx, signals[REMOVED], 0, sobj);
+ g_object_unref (sobj);
}
}
@@ -680,7 +680,7 @@
SeahorseKey*
seahorse_context_get_default_key (SeahorseContext *sctx)
{
- SeahorseKey *skey = NULL;
+ SeahorseObject *sobj = NULL;
gchar *id;
/* TODO: All of this needs to take multiple key types into account */
@@ -688,11 +688,14 @@
id = seahorse_gconf_get_string (SEAHORSE_DEFAULT_KEY);
if (id != NULL && id[0]) {
GQuark keyid = g_quark_from_string (id);
- skey = seahorse_context_find_key (sctx, keyid, SKEY_LOC_LOCAL);
+ sobj = seahorse_context_find_object (sctx, keyid, SEAHORSE_LOCATION_LOCAL);
}
g_free (id);
- return skey;
+
+ if (SEAHORSE_IS_KEY (sobj))
+ return SEAHORSE_KEY (sobj);
+ return NULL;
}
/**
@@ -711,9 +714,9 @@
}
SeahorseOperation*
-seahorse_context_load_local_keys (SeahorseContext *sctx)
+seahorse_context_load_local_objects (SeahorseContext *sctx)
{
- SeahorseKeySource *ks;
+ SeahorseSource *ks;
SeahorseMultiOperation *mop = NULL;
SeahorseOperation *op = NULL;
GSList *l;
@@ -721,15 +724,15 @@
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
- ks = SEAHORSE_KEY_SOURCE (l->data);
+ ks = SEAHORSE_SOURCE (l->data);
- if (seahorse_key_source_get_location (ks) == SKEY_LOC_LOCAL) {
+ if (seahorse_source_get_location (ks) == SEAHORSE_LOCATION_LOCAL) {
if (mop == NULL && op != NULL) {
mop = seahorse_multi_operation_new ();
seahorse_multi_operation_take (mop, op);
}
- op = seahorse_key_source_load (ks, 0);
+ op = seahorse_source_load (ks, 0);
if (mop != NULL)
seahorse_multi_operation_take (mop, op);
@@ -740,25 +743,25 @@
}
static gboolean
-load_local_keys (SeahorseContext *sctx)
+load_local_objects (SeahorseContext *sctx)
{
- SeahorseOperation *op = seahorse_context_load_local_keys (sctx);
+ SeahorseOperation *op = seahorse_context_load_local_objects (sctx);
g_return_val_if_fail (op != NULL, FALSE);
g_object_unref (op);
return FALSE;
}
void
-seahorse_context_load_local_keys_async (SeahorseContext *sctx)
+seahorse_context_load_local_objects_async (SeahorseContext *sctx)
{
- g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)load_local_keys, sctx, NULL);
+ g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)load_local_objects, sctx, NULL);
}
SeahorseOperation*
-seahorse_context_load_remote_keys (SeahorseContext *sctx, const gchar *search)
+seahorse_context_load_remote_objects (SeahorseContext *sctx, const gchar *search)
{
- SeahorseKeySource *ks;
+ SeahorseSource *ks;
SeahorseMultiOperation *mop = NULL;
SeahorseOperation *op = NULL;
GSList *l, *names;
@@ -776,9 +779,9 @@
}
for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
- ks = SEAHORSE_KEY_SOURCE (l->data);
+ ks = SEAHORSE_SOURCE (l->data);
- if (seahorse_key_source_get_location (ks) != SKEY_LOC_REMOTE)
+ if (seahorse_source_get_location (ks) != SEAHORSE_LOCATION_REMOTE)
continue;
if (servers) {
@@ -796,7 +799,7 @@
seahorse_multi_operation_take (mop, op);
}
- op = seahorse_key_source_search (ks, search);
+ op = seahorse_source_search (ks, search);
if (mop != NULL)
seahorse_multi_operation_take (mop, op);
@@ -810,15 +813,15 @@
#ifdef WITH_PGP
/* For copying the keys */
static void
-auto_source_to_hash (const gchar *uri, SeahorseKeySource *sksrc, GHashTable *ht)
+auto_source_to_hash (const gchar *uri, SeahorseSource *sksrc, GHashTable *ht)
{
g_hash_table_replace (ht, (gpointer)uri, sksrc);
}
static void
-auto_source_remove (const gchar* uri, SeahorseKeySource *sksrc, SeahorseContext *sctx)
+auto_source_remove (const gchar* uri, SeahorseSource *sksrc, SeahorseContext *sctx)
{
- seahorse_context_remove_key_source (sctx, sksrc);
+ seahorse_context_remove_source (sctx, sksrc);
g_hash_table_remove (sctx->pv->auto_sources, uri);
}
#endif
@@ -856,7 +859,7 @@
if (!g_hash_table_lookup (sctx->pv->auto_sources, uri)) {
ssrc = seahorse_server_source_new (uri);
if (ssrc != NULL) {
- seahorse_context_take_key_source (sctx, SEAHORSE_KEY_SOURCE (ssrc));
+ seahorse_context_take_source (sctx, SEAHORSE_SOURCE (ssrc));
g_hash_table_replace (sctx->pv->auto_sources, g_strdup (uri), ssrc);
}
}
@@ -875,49 +878,49 @@
}
SeahorseOperation*
-seahorse_context_transfer_keys (SeahorseContext *sctx, GList *keys,
- SeahorseKeySource *to)
+seahorse_context_transfer_objects (SeahorseContext *sctx, GList *objects,
+ SeahorseSource *to)
{
- SeahorseKeySource *from;
+ SeahorseSource *from;
SeahorseOperation *op = NULL;
SeahorseMultiOperation *mop = NULL;
- SeahorseKey *skey;
- GSList *keyids = NULL;
+ SeahorseObject *sobj;
+ GSList *ids = NULL;
GList *next, *l;
GQuark ktype;
- keys = g_list_copy (keys);
+ objects = g_list_copy (objects);
/* Sort by key source */
- keys = seahorse_util_keylist_sort (keys);
+ objects = seahorse_util_objects_sort (objects);
- while (keys) {
+ while (objects) {
/* break off one set (same keysource) */
- next = seahorse_util_keylist_splice (keys);
+ next = seahorse_util_objects_splice (objects);
- g_assert (SEAHORSE_IS_KEY (keys->data));
- skey = SEAHORSE_KEY (keys->data);
+ g_assert (SEAHORSE_IS_OBJECT (objects->data));
+ sobj = SEAHORSE_OBJECT (objects->data);
/* Export from this key source */
- from = seahorse_key_get_source (skey);
+ from = seahorse_object_get_source (sobj);
g_return_val_if_fail (from != NULL, FALSE);
- ktype = seahorse_key_source_get_ktype (from);
+ ktype = seahorse_source_get_ktype (from);
/* Find a local keysource to import to */
if (!to) {
- to = seahorse_context_find_key_source (sctx, ktype, SKEY_LOC_LOCAL);
+ to = seahorse_context_find_source (sctx, ktype, SEAHORSE_LOCATION_LOCAL);
if (!to) {
/* TODO: How can we warn caller about this. Do we need to? */
- g_warning ("couldn't find a local key source for: %s",
+ g_warning ("couldn't find a local source for: %s",
g_quark_to_string (ktype));
}
}
/* Make sure it's the same type */
- if (ktype != seahorse_key_source_get_ktype (to)) {
+ if (ktype != seahorse_source_get_ktype (to)) {
/* TODO: How can we warn caller about this. Do we need to? */
- g_warning ("destination key source is not of type: %s",
+ g_warning ("destination is not of type: %s",
g_quark_to_string (ktype));
}
@@ -929,26 +932,26 @@
seahorse_multi_operation_take (mop, op);
}
- /* Build keyid list */
- for (l = keys; l; l = g_list_next (l))
- keyids = g_slist_prepend (keyids, GUINT_TO_POINTER (seahorse_key_get_keyid (l->data)));
- keyids = g_slist_reverse (keyids);
+ /* Build id list */
+ for (l = objects; l; l = g_list_next (l))
+ ids = g_slist_prepend (ids, GUINT_TO_POINTER (seahorse_object_get_id (l->data)));
+ ids = g_slist_reverse (ids);
- /* Start a new transfer operation between the two key sources */
- op = seahorse_transfer_operation_new (NULL, from, to, keyids);
+ /* Start a new transfer operation between the two sources */
+ op = seahorse_transfer_operation_new (NULL, from, to, ids);
g_return_val_if_fail (op != NULL, FALSE);
- g_slist_free (keyids);
- keyids = NULL;
+ g_slist_free (ids);
+ ids = NULL;
}
- g_list_free (keys);
- keys = next;
+ g_list_free (objects);
+ objects = next;
}
- /* No keys done, just return success */
+ /* No objects done, just return success */
if (!mop && !op) {
- g_warning ("no valid keys to transfer found");
+ g_warning ("no valid objects to transfer found");
return seahorse_operation_new_complete (NULL);
}
@@ -956,34 +959,34 @@
}
SeahorseOperation*
-seahorse_context_retrieve_keys (SeahorseContext *sctx, GQuark ktype,
- GSList *keyids, SeahorseKeySource *to)
+seahorse_context_retrieve_objects (SeahorseContext *sctx, GQuark ktype,
+ GSList *ids, SeahorseSource *to)
{
SeahorseMultiOperation *mop = NULL;
SeahorseOperation *op = NULL;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
GSList *sources, *l;
if (!to) {
- to = seahorse_context_find_key_source (sctx, ktype, SKEY_LOC_LOCAL);
+ to = seahorse_context_find_source (sctx, ktype, SEAHORSE_LOCATION_LOCAL);
if (!to) {
/* TODO: How can we warn caller about this. Do we need to? */
- g_warning ("couldn't find a local key source for: %s",
+ g_warning ("couldn't find a local source for: %s",
g_quark_to_string (ktype));
return seahorse_operation_new_complete (NULL);
}
}
- sources = seahorse_context_find_key_sources (sctx, ktype, SKEY_LOC_REMOTE);
+ sources = seahorse_context_find_sources (sctx, ktype, SEAHORSE_LOCATION_REMOTE);
if (!sources) {
- g_warning ("no key sources found for type: %s", g_quark_to_string (ktype));
+ g_warning ("no sources found for type: %s", g_quark_to_string (ktype));
return seahorse_operation_new_complete (NULL);
}
for (l = sources; l; l = g_slist_next (l)) {
- sksrc = SEAHORSE_KEY_SOURCE (l->data);
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
+ sksrc = SEAHORSE_SOURCE (l->data);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
if (op != NULL) {
if (mop == NULL)
@@ -992,7 +995,7 @@
}
/* Start a new transfer operation between the two key sources */
- op = seahorse_transfer_operation_new (NULL, sksrc, to, keyids);
+ op = seahorse_transfer_operation_new (NULL, sksrc, to, ids);
g_return_val_if_fail (op != NULL, FALSE);
}
@@ -1001,64 +1004,64 @@
GList*
-seahorse_context_discover_keys (SeahorseContext *sctx, GQuark ktype,
- GSList *rawids)
+seahorse_context_discover_objects (SeahorseContext *sctx, GQuark ktype,
+ GSList *rawids)
{
- GList *rkeys = NULL;
- GQuark keyid = 0;
+ GList *robjects = NULL;
+ GQuark id = 0;
GSList *todiscover = NULL;
GList *toimport = NULL;
- SeahorseKeySource *sksrc;
- SeahorseKey* skey;
- SeahorseKeyLoc loc;
+ SeahorseSource *sksrc;
+ SeahorseObject* sobj;
+ SeahorseLocation loc;
SeahorseOperation *op;
GSList *l;
- /* Check all the keyids */
+ /* Check all the ids */
for (l = rawids; l; l = g_slist_next (l)) {
- keyid = seahorse_key_source_canonize_keyid (ktype, (gchar*)l->data);
- if (!keyid) {
- /* TODO: Try and match this partial keyid */
- g_warning ("invalid keyid: %s", (gchar*)l->data);
+ id = seahorse_source_canonize_id (ktype, (gchar*)l->data);
+ if (!id) {
+ /* TODO: Try and match this partial id */
+ g_warning ("invalid id: %s", (gchar*)l->data);
continue;
}
- /* Do we know about this key? */
- skey = seahorse_context_find_key (sctx, keyid, SKEY_LOC_INVALID);
+ /* Do we know about this object? */
+ sobj = seahorse_context_find_object (sctx, id, SEAHORSE_LOCATION_INVALID);
- /* No such key anywhere, discover it */
- if (!skey) {
- todiscover = g_slist_prepend (todiscover, GUINT_TO_POINTER (keyid));
- keyid = 0;
+ /* No such object anywhere, discover it */
+ if (!sobj) {
+ todiscover = g_slist_prepend (todiscover, GUINT_TO_POINTER (id));
+ id = 0;
continue;
}
/* Our return value */
- rkeys = g_list_prepend (rkeys, skey);
+ robjects = g_list_prepend (robjects, sobj);
- /* We know about this key, check where it is */
- loc = seahorse_key_get_location (skey);
- g_assert (loc != SKEY_LOC_INVALID);
+ /* We know about this object, check where it is */
+ loc = seahorse_object_get_location (sobj);
+ g_assert (loc != SEAHORSE_LOCATION_INVALID);
- /* Do nothing for local keys */
- if (loc >= SKEY_LOC_LOCAL)
+ /* Do nothing for local objects */
+ if (loc >= SEAHORSE_LOCATION_LOCAL)
continue;
- /* Remote keys get imported */
- else if (loc >= SKEY_LOC_REMOTE)
- toimport = g_list_prepend (toimport, skey);
+ /* Remote objects get imported */
+ else if (loc >= SEAHORSE_LOCATION_REMOTE)
+ toimport = g_list_prepend (toimport, sobj);
- /* Searching keys are ignored */
- else if (loc >= SKEY_LOC_SEARCHING)
+ /* Searching objects are ignored */
+ else if (loc >= SEAHORSE_LOCATION_SEARCHING)
continue;
- /* TODO: Should we try SKEY_LOC_UNKNOWN keys again? */
+ /* TODO: Should we try SEAHORSE_LOCATION_MISSING objects again? */
}
/* Start an import process on all toimport */
if (toimport) {
- op = seahorse_context_transfer_keys (sctx, toimport, NULL);
+ op = seahorse_context_transfer_objects (sctx, toimport, NULL);
g_list_free (toimport);
@@ -1068,15 +1071,15 @@
/* Start a discover process on all todiscover */
if (seahorse_gconf_get_boolean (AUTORETRIEVE_KEY) && todiscover) {
- op = seahorse_context_retrieve_keys (sctx, ktype, todiscover, NULL);
+ op = seahorse_context_retrieve_objects (sctx, ktype, todiscover, NULL);
- /* Add unknown keys for all these */
- sksrc = seahorse_context_find_key_source (sctx, ktype, SKEY_LOC_UNKNOWN);
+ /* Add unknown objects for all these */
+ sksrc = seahorse_context_find_source (sctx, ktype, SEAHORSE_LOCATION_MISSING);
for (l = todiscover; l; l = g_slist_next (l)) {
if (sksrc) {
- skey = seahorse_unknown_source_add_key (SEAHORSE_UNKNOWN_SOURCE (sksrc),
- GPOINTER_TO_UINT (l->data), op);
- rkeys = g_list_prepend (rkeys, skey);
+ sobj = seahorse_unknown_source_add_object (SEAHORSE_UNKNOWN_SOURCE (sksrc),
+ GPOINTER_TO_UINT (l->data), op);
+ robjects = g_list_prepend (robjects, sobj);
}
}
@@ -1086,13 +1089,13 @@
g_object_unref (op);
}
- return rkeys;
+ return robjects;
}
-SeahorseKey*
-seahorse_context_key_from_dbus (SeahorseContext *sctx, const gchar *key, guint *uid)
+SeahorseObject*
+seahorse_context_object_from_dbus (SeahorseContext *sctx, const gchar *key, guint *uid)
{
- SeahorseKey *skey;
+ SeahorseObject *sobj;
const gchar *t = NULL;
gchar *x, *alloc = NULL;
@@ -1107,37 +1110,37 @@
}
/* This will always get the most preferred key */
- skey = seahorse_context_find_key (sctx, g_quark_from_string (key),
- SKEY_LOC_INVALID);
+ sobj = seahorse_context_find_object (sctx, g_quark_from_string (key),
+ SEAHORSE_LOCATION_INVALID);
if (uid)
*uid = 0;
/* Parse out the uid */
- if (skey && t) {
+ if (SEAHORSE_IS_KEY (sobj) && sobj && t) {
glong l = strtol (t, &x, 10);
/* Make sure it's valid */
- if (*x || l < 0 || l >= seahorse_key_get_num_names (skey))
- skey = NULL;
+ if (*x || l < 0 || l >= seahorse_key_get_num_names (SEAHORSE_KEY (sobj)))
+ sobj = NULL;
else if (uid)
*uid = (guint)l;
}
- return skey;
+ return sobj;
}
gchar*
-seahorse_context_key_to_dbus (SeahorseContext *sctx, SeahorseKey *skey, guint uid)
+seahorse_context_object_to_dbus (SeahorseContext *sctx, SeahorseObject *sobj, guint uid)
{
- return seahorse_context_keyid_to_dbus (sctx, seahorse_key_get_keyid (skey), uid);
+ return seahorse_context_id_to_dbus (sctx, seahorse_object_get_id (sobj), uid);
}
gchar*
-seahorse_context_keyid_to_dbus (SeahorseContext* sctx, GQuark keyid, guint uid)
+seahorse_context_id_to_dbus (SeahorseContext* sctx, GQuark id, guint uid)
{
if (uid == 0)
- return g_strdup (g_quark_to_string (keyid));
+ return g_strdup (g_quark_to_string (id));
else
- return g_strdup_printf ("%s:%d", g_quark_to_string (keyid), uid);
+ return g_strdup_printf ("%s:%d", g_quark_to_string (id), uid);
}
Modified: trunk/libseahorse/seahorse-context.h
==============================================================================
--- trunk/libseahorse/seahorse-context.h (original)
+++ trunk/libseahorse/seahorse-context.h Thu Jul 17 01:41:51 2008
@@ -26,14 +26,14 @@
*
* - Usually there's only one SeahorseContext per process created by passing
* |TRUE| to |seahorse_context_new|, and accessed via the |SCTX_APP| macro.
- * - Retains the list of all valid SeahorseKey objects.
- * - Has a collection of SeahorseKeySource objects which add keys to the
+ * - Retains the list of all valid struct _SeahorseObject objects.
+ * - Has a collection of SeahorseSource objects which add objects to the
* SeahorseContext.
*
* Signals:
- * added: A key was added to the context.
- * removed: A key was removed from the context.
- * changed: A key changed.
+ * added: A object was added to the context.
+ * removed: A object was removed from the context.
+ * changed: A object changed.
* destroy: The context was destroyed.
*/
@@ -42,8 +42,7 @@
#include <gtk/gtk.h>
-#include "seahorse-key.h"
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#include "seahorse-dns-sd.h"
#define SEAHORSE_TYPE_CONTEXT (seahorse_context_get_type ())
@@ -53,6 +52,10 @@
#define SEAHORSE_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_CONTEXT))
#define SEAHORSE_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_CONTEXT, SeahorseContextClass))
+struct _SeahorseKey;
+struct _SeahorseObject;
+struct _SeahorseObjectPredicate;
+
typedef struct _SeahorseContext SeahorseContext;
typedef struct _SeahorseContextClass SeahorseContextClass;
typedef struct _SeahorseContextPrivate SeahorseContextPrivate;
@@ -72,14 +75,14 @@
/* signals --------------------------------------------------------- */
- /* A key was added to this source */
- void (*added) (SeahorseContext *sctx, SeahorseKey *key);
+ /* A object was added to this source */
+ void (*added) (SeahorseContext *sctx, struct _SeahorseObject *sobj);
- /* Removed a key from this source */
- void (*removed) (SeahorseContext *sctx, SeahorseKey *key);
+ /* Removed a object from this source */
+ void (*removed) (SeahorseContext *sctx, struct _SeahorseObject *sobj);
- /* This key has changed */
- void (*changed) (SeahorseContext *sctx, SeahorseKey *skey, SeahorseKeyChange change);
+ /* This object has changed */
+ void (*changed) (SeahorseContext *sctx, struct _SeahorseObject *sobj, int change);
};
enum SeahorseContextType {
@@ -100,95 +103,95 @@
#define seahorse_context_is_daemon(ctx) ((ctx)->is_daemon)
-void seahorse_context_add_key_source (SeahorseContext *sctx,
- SeahorseKeySource *sksrc);
+void seahorse_context_add_source (SeahorseContext *sctx,
+ SeahorseSource *sksrc);
-void seahorse_context_take_key_source (SeahorseContext *sctx,
- SeahorseKeySource *sksrc);
+void seahorse_context_take_source (SeahorseContext *sctx,
+ SeahorseSource *sksrc);
-void seahorse_context_remove_key_source (SeahorseContext *sctx,
- SeahorseKeySource *sksrc);
+void seahorse_context_remove_source (SeahorseContext *sctx,
+ SeahorseSource *sksrc);
-SeahorseKeySource* seahorse_context_find_key_source (SeahorseContext *sctx,
+SeahorseSource* seahorse_context_find_source (SeahorseContext *sctx,
GQuark ktype,
- SeahorseKeyLoc location);
+ SeahorseLocation location);
-GSList* seahorse_context_find_key_sources (SeahorseContext *sctx,
+GSList* seahorse_context_find_sources (SeahorseContext *sctx,
GQuark ktype,
- SeahorseKeyLoc location);
+ SeahorseLocation location);
-SeahorseKeySource* seahorse_context_remote_key_source (SeahorseContext *sctx,
+SeahorseSource* seahorse_context_remote_source (SeahorseContext *sctx,
const gchar *uri);
-void seahorse_context_add_key (SeahorseContext *sctx,
- SeahorseKey *skey);
+void seahorse_context_add_object (SeahorseContext *sctx,
+ struct _SeahorseObject *sobj);
-void seahorse_context_take_key (SeahorseContext *sctx,
- SeahorseKey *skey);
+void seahorse_context_take_object (SeahorseContext *sctx,
+ struct _SeahorseObject *sobj);
guint seahorse_context_get_count (SeahorseContext *sctx);
-SeahorseKey* seahorse_context_get_key (SeahorseContext *sctx,
- SeahorseKeySource *sksrc,
- GQuark keyid);
-
-GList* seahorse_context_get_keys (SeahorseContext *sctx,
- SeahorseKeySource *sksrc);
-
-SeahorseKey* seahorse_context_find_key (SeahorseContext *sctx,
- GQuark keyid,
- SeahorseKeyLoc location);
+struct _SeahorseObject* seahorse_context_get_object (SeahorseContext *sctx,
+ SeahorseSource *sksrc,
+ GQuark id);
+
+GList* seahorse_context_get_objects (SeahorseContext *sctx,
+ SeahorseSource *sksrc);
+
+struct _SeahorseObject* seahorse_context_find_object (SeahorseContext *sctx,
+ GQuark id,
+ SeahorseLocation location);
-GList* seahorse_context_find_keys (SeahorseContext *sctx,
+GList* seahorse_context_find_objects (SeahorseContext *sctx,
GQuark ktype,
- SeahorseKeyEType etype,
- SeahorseKeyLoc location);
+ SeahorseUsage usage,
+ SeahorseLocation location);
-GList* seahorse_context_find_keys_full (SeahorseContext *sctx,
- SeahorseKeyPredicate *skpred);
+GList* seahorse_context_find_objects_full (SeahorseContext *sctx,
+ struct _SeahorseObjectPredicate *skpred);
-void seahorse_context_remove_key (SeahorseContext *sctx,
- SeahorseKey *skey);
+void seahorse_context_remove_object (SeahorseContext *sctx,
+ struct _SeahorseObject *sobj);
-gboolean seahorse_context_owns_key (SeahorseContext *sctx,
- SeahorseKey *skey);
+gboolean seahorse_context_owns_object (SeahorseContext *sctx,
+ struct _SeahorseObject *sobj);
SeahorseServiceDiscovery*
seahorse_context_get_discovery (SeahorseContext *sctx);
-SeahorseKey* seahorse_context_get_default_key (SeahorseContext *sctx);
+struct _SeahorseKey* seahorse_context_get_default_key (SeahorseContext *sctx);
-SeahorseOperation* seahorse_context_load_local_keys (SeahorseContext *sctx);
+SeahorseOperation* seahorse_context_load_local_objects (SeahorseContext *sctx);
-void seahorse_context_load_local_keys_async (SeahorseContext *sctx);
+void seahorse_context_load_local_objects_async (SeahorseContext *sctx);
-SeahorseOperation* seahorse_context_load_remote_keys (SeahorseContext *sctx,
- const gchar *search);
+SeahorseOperation* seahorse_context_load_remote_objects (SeahorseContext *sctx,
+ const gchar *search);
-SeahorseOperation* seahorse_context_transfer_keys (SeahorseContext *sctx,
- GList *keys,
- SeahorseKeySource *to);
+SeahorseOperation* seahorse_context_transfer_objects (SeahorseContext *sctx,
+ GList *objs,
+ SeahorseSource *to);
-SeahorseOperation* seahorse_context_retrieve_keys (SeahorseContext *sctx,
+SeahorseOperation* seahorse_context_retrieve_objects (SeahorseContext *sctx,
GQuark ktype,
- GSList *keyids,
- SeahorseKeySource *to);
+ GSList *ids,
+ SeahorseSource *to);
-GList* seahorse_context_discover_keys (SeahorseContext *sctx,
+GList* seahorse_context_discover_objects (SeahorseContext *sctx,
GQuark ktype,
- GSList *keyids);
+ GSList *ids);
-SeahorseKey* seahorse_context_key_from_dbus (SeahorseContext *sctx,
+struct _SeahorseObject* seahorse_context_object_from_dbus (SeahorseContext *sctx,
const gchar *dbusid,
guint *uid);
-gchar* seahorse_context_key_to_dbus (SeahorseContext *sctx,
- SeahorseKey *skey,
+gchar* seahorse_context_object_to_dbus (SeahorseContext *sctx,
+ struct _SeahorseObject *sobj,
guint uid);
-gchar* seahorse_context_keyid_to_dbus (SeahorseContext *sctx,
- GQuark keyid,
+gchar* seahorse_context_id_to_dbus (SeahorseContext *sctx,
+ GQuark id,
guint uid);
#endif /* __SEAHORSE_CONTEXT_H__ */
Modified: trunk/libseahorse/seahorse-dns-sd.c
==============================================================================
--- trunk/libseahorse/seahorse-dns-sd.c (original)
+++ trunk/libseahorse/seahorse-dns-sd.c Thu Jul 17 01:41:51 2008
@@ -139,10 +139,10 @@
g_signal_emit (ssd, signals[ADDED], 0, service_name);
/* Add it to the context */
- if (!seahorse_context_remote_key_source (SCTX_APP (), service_uri)) {
+ if (!seahorse_context_remote_source (SCTX_APP (), service_uri)) {
SeahorseServerSource *ssrc = seahorse_server_source_new (service_uri);
g_return_if_fail (ssrc != NULL);
- seahorse_context_add_key_source (SCTX_APP (), SEAHORSE_KEY_SOURCE (ssrc));
+ seahorse_context_add_source (SCTX_APP (), SEAHORSE_SOURCE (ssrc));
}
DEBUG_DNSSD (("DNS-SD added: %s %s\n", service_name, service_uri));
@@ -191,8 +191,8 @@
uri = g_hash_table_lookup (ssd->services, name);
if (uri != NULL) {
/* Remove it from the main context */
- SeahorseKeySource *sksrc = seahorse_context_remote_key_source (SCTX_APP(), uri);
- seahorse_context_remove_key_source (SCTX_APP(), sksrc);
+ SeahorseSource *sksrc = seahorse_context_remote_source (SCTX_APP(), uri);
+ seahorse_context_remove_source (SCTX_APP(), sksrc);
}
/* And remove it from our tables */
Modified: trunk/libseahorse/seahorse-key-widget.c
==============================================================================
--- trunk/libseahorse/seahorse-key-widget.c (original)
+++ trunk/libseahorse/seahorse-key-widget.c Thu Jul 17 01:41:51 2008
@@ -135,8 +135,7 @@
gtk_window_group_remove_window (group, GTK_WINDOW (widget));
}
- g_signal_handlers_disconnect_by_func (GTK_OBJECT (skwidget->skey),
- seahorse_key_widget_destroyed, skwidget);
+ g_signal_handlers_disconnect_by_func (skwidget->skey, seahorse_key_widget_destroyed, skwidget);
G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
@@ -155,7 +154,7 @@
/* Refs key and connects to 'destroy' signal */
case PROP_KEY:
skwidget->skey = g_value_get_object (value);
- g_signal_connect_after (GTK_OBJECT (skwidget->skey), "destroy",
+ g_signal_connect_after (skwidget->skey, "destroy",
G_CALLBACK (seahorse_key_widget_destroyed), skwidget);
break;
case PROP_INDEX:
Modified: trunk/libseahorse/seahorse-key.c
==============================================================================
--- trunk/libseahorse/seahorse-key.c (original)
+++ trunk/libseahorse/seahorse-key.c Thu Jul 17 01:41:51 2008
@@ -24,31 +24,7 @@
#include "seahorse-key.h"
#include "seahorse-context.h"
-#include "seahorse-key-source.h"
-
-gboolean
-seahorse_key_predicate_match (SeahorseKeyPredicate *kl, SeahorseKey *skey)
-{
- /* Now go for all the fields */
- if (kl->ktype && (kl->ktype != skey->ktype))
- return FALSE;
- if (kl->keyid && (kl->keyid != skey->keyid))
- return FALSE;
- if (kl->location && (kl->location != skey->location))
- return FALSE;
- if (kl->etype && (kl->etype != skey->etype))
- return FALSE;
- if (kl->flags && !(kl->flags & skey->flags))
- return FALSE;
- if (kl->nflags && (kl->nflags & skey->flags))
- return FALSE;
- if (kl->sksrc && (kl->sksrc != skey->sksrc))
- return FALSE;
- /* Any custom stuff last */
- if (kl->custom && !((kl->custom)(skey, kl->custom_target)))
- return FALSE;
- return TRUE;
-}
+#include "seahorse-source.h"
enum {
PROP_0,
@@ -58,8 +34,6 @@
PROP_KEY_DESC,
PROP_KTYPE,
PROP_ETYPE,
- PROP_FLAGS,
- PROP_LOCATION,
PROP_LOADED
};
@@ -73,14 +47,7 @@
GQuark special_properties[PROP_SPECIAL_MAX] = { 0 };
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (SeahorseKey, seahorse_key, GTK_TYPE_OBJECT);
+G_DEFINE_TYPE (SeahorseKey, seahorse_key, SEAHORSE_TYPE_OBJECT);
/* -----------------------------------------------------------------------------
* OBJECT
@@ -96,16 +63,12 @@
seahorse_key_set_property (GObject *object, guint prop_id, const GValue *value,
GParamSpec *pspec)
{
- SeahorseKey *skey = SEAHORSE_KEY (object);
-
- switch (prop_id) {
- case PROP_KEY_SOURCE:
- g_assert (!skey->sksrc);
- skey->sksrc = g_value_get_object (value);
- g_return_if_fail (SEAHORSE_IS_KEY_SOURCE (skey->sksrc));
- g_object_add_weak_pointer (G_OBJECT (skey->sksrc), (gpointer*)&(skey->sksrc));
- break;
- }
+ switch (prop_id) {
+ case PROP_KEY_SOURCE:
+ /* Pass on to SeahorseObject */
+ g_object_set_property (object, "source", value);
+ break;
+ }
}
static void
@@ -116,10 +79,12 @@
switch (prop_id) {
case PROP_KEY_SOURCE:
- g_value_set_object (value, skey->sksrc);
+ /* Pass on to SeahorseObject */
+ g_object_get_property(object, "source", value);
break;
case PROP_KEY_ID:
- g_value_set_uint (value, skey->keyid);
+ /* Pass on to SeahorseObject */
+ g_object_get_property(object, "id", value);
break;
case PROP_RAW_ID:
g_value_set_string (value, skey->rawid);
@@ -128,16 +93,12 @@
g_value_set_string (value, skey->keydesc);
break;
case PROP_KTYPE:
- g_value_set_uint (value, skey->ktype);
+ /* Pass on to SeahorseObject */
+ g_object_get_property(object, "tag", value);
break;
case PROP_ETYPE:
- g_value_set_uint (value, skey->etype);
- case PROP_FLAGS:
- g_value_set_uint (value, skey->flags);
- break;
- case PROP_LOCATION:
- g_value_set_uint (value, skey->location);
- break;
+ /* Pass on to SeahorseObject */
+ g_object_get_property(object, "usage", value);
case PROP_LOADED:
g_value_set_uint (value, skey->loaded);
break;
@@ -162,11 +123,9 @@
gobject_class->set_property = seahorse_key_set_property;
gobject_class->get_property = seahorse_key_get_property;
- klass->changed = NULL;
-
g_object_class_install_property (gobject_class, PROP_KEY_SOURCE,
g_param_spec_object ("key-source", "Key Source", "Key Source that this key belongs to",
- SEAHORSE_TYPE_KEY_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ SEAHORSE_TYPE_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_KEY_ID,
g_param_spec_uint ("key-id", "Key ID", "Key identifier",
@@ -186,24 +145,12 @@
g_object_class_install_property (gobject_class, PROP_ETYPE,
g_param_spec_uint ("etype", "Encrpyption Type", "Key encryption type",
- 0, G_MAXUINT, SKEY_ETYPE_NONE, G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class, PROP_FLAGS,
- g_param_spec_uint ("flags", "Key Flags", "Flags on capabilities of key. See SeahorseKeyFlags",
- 0, G_MAXUINT, 0, G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseKeyLoc",
- 0, G_MAXUINT, SKEY_LOC_INVALID, G_PARAM_READABLE));
+ 0, G_MAXUINT, SEAHORSE_USAGE_NONE, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_LOADED,
g_param_spec_uint ("loaded", "Loaded Information", "Which parts of the key are loaded. See SeahorseKeyLoaded",
0, G_MAXUINT, SKEY_INFO_NONE, G_PARAM_READABLE));
- signals[CHANGED] = g_signal_new ("changed", G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeahorseKeyClass, changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
-
/* Some special fields */
special_properties[PROP_SPECIAL_KEY_ID] = g_quark_from_static_string ("key-id");
special_properties[PROP_SPECIAL_DISPLAY_NAME] = g_quark_from_static_string ("display-name");
@@ -214,39 +161,12 @@
* PUBLIC
*/
-/**
- * seahorse_key_destroy:
- * @skey: #SeahorseKey to destroy
- *
- * Conveniance wrapper for gtk_object_destroy(). Emits destroy signal for @skey.
- **/
-void
-seahorse_key_destroy (SeahorseKey *skey)
-{
- g_return_if_fail (skey != NULL && GTK_IS_OBJECT (skey));
- gtk_object_destroy (GTK_OBJECT (skey));
-}
-
-/**
- * seahorse_key_changed:
- * @skey: #SeahorseKey that changed
- * @change: #SeahorseKeyChange type
- *
- * Emits the changed signal for @skey with @change.
- **/
-void
-seahorse_key_changed (SeahorseKey *skey, SeahorseKeyChange change)
-{
- g_return_if_fail (skey != NULL && SEAHORSE_IS_KEY (skey));
- g_signal_emit (G_OBJECT (skey), signals[CHANGED], 0, change);
-}
-
GQuark
seahorse_key_get_keyid (SeahorseKey *skey)
{
g_return_val_if_fail (skey && SEAHORSE_IS_KEY (skey), 0);
- return skey->keyid;
-}
+ return SEAHORSE_OBJECT (skey)->_id;
+}
const gchar*
seahorse_key_get_short_keyid (SeahorseKey *skey)
@@ -255,7 +175,7 @@
guint l;
g_return_val_if_fail (skey && SEAHORSE_IS_KEY (skey), NULL);
- id = g_quark_to_string (skey->keyid);
+ id = g_quark_to_string (SEAHORSE_OBJECT (skey)->_id);
l = strlen (id);
if (l > 8)
@@ -270,14 +190,13 @@
*
* Gets the key source for the given key
*
- * Returns: A #SeahorseKeySource
+ * Returns: A #SeahorseSource
**/
-struct _SeahorseKeySource*
+SeahorseSource*
seahorse_key_get_source (SeahorseKey *skey)
{
- g_return_val_if_fail (SEAHORSE_IS_KEY (skey), NULL);
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (skey->sksrc), NULL);
- return skey->sksrc;
+ g_return_val_if_fail (SEAHORSE_IS_KEY (skey), NULL);
+ return seahorse_object_get_source (SEAHORSE_OBJECT (skey));
}
const gchar*
@@ -290,14 +209,14 @@
seahorse_key_get_ktype (SeahorseKey *skey)
{
g_return_val_if_fail (SEAHORSE_IS_KEY (skey), SKEY_UNKNOWN);
- return skey->ktype;
+ return SEAHORSE_OBJECT (skey)->_tag;
}
-SeahorseKeyEType
-seahorse_key_get_etype (SeahorseKey *skey)
+SeahorseUsage
+seahorse_key_get_usage (SeahorseKey *skey)
{
- g_return_val_if_fail (SEAHORSE_IS_KEY (skey), SKEY_ETYPE_NONE);
- return skey->etype;
+ g_return_val_if_fail (SEAHORSE_IS_KEY (skey), SEAHORSE_USAGE_NONE);
+ return SEAHORSE_OBJECT (skey)->_usage;
}
/**
* seahorse_key_get_loaded_info
@@ -314,18 +233,18 @@
return skey->loaded;
}
-SeahorseKeyLoc
+SeahorseLocation
seahorse_key_get_location (SeahorseKey *skey)
{
- g_return_val_if_fail (SEAHORSE_IS_KEY (skey), SKEY_LOC_INVALID);
- return skey->location;
+ g_return_val_if_fail (SEAHORSE_IS_KEY (skey), SEAHORSE_LOCATION_INVALID);
+ return SEAHORSE_OBJECT (skey)->_location;
}
guint
seahorse_key_get_flags (SeahorseKey *skey)
{
g_return_val_if_fail (SEAHORSE_IS_KEY (skey), 0);
- return skey->flags;
+ return SEAHORSE_OBJECT (skey)->_flags;
}
guint
@@ -468,21 +387,6 @@
return stock_id;
}
-void
-seahorse_key_set_preferred (SeahorseKey *skey, SeahorseKey *preferred)
-{
- /*
- * We don't ref, because the SeahorseContext takes care of
- * keeping things sane.
- */
-
- if (preferred != skey->preferred) {
- skey->preferred = preferred;
- seahorse_key_changed (skey, SKEY_CHANGE_PREFERRED);
- }
-}
-
-
gboolean
seahorse_key_lookup_property (SeahorseKey *skey, guint uid, const gchar *field, GValue *value)
{
@@ -494,7 +398,7 @@
/* The key-id for these guys contains the uid */
if (qfield == special_properties[PROP_SPECIAL_KEY_ID]) {
- text = seahorse_context_key_to_dbus (SCTX_APP (), skey, uid);
+ text = seahorse_context_object_to_dbus (SCTX_APP (), SEAHORSE_OBJECT (skey), uid);
g_value_init (value, G_TYPE_STRING);
g_value_take_string (value, text);
return TRUE;
Modified: trunk/libseahorse/seahorse-key.h
==============================================================================
--- trunk/libseahorse/seahorse-key.h (original)
+++ trunk/libseahorse/seahorse-key.h Thu Jul 17 01:41:51 2008
@@ -27,21 +27,21 @@
* find etc... These are stored in the SeahorseKey structure for fast
* access. The derived classes (ie: SeahorsePGPKey) keep these in sync
* whenever the key changes.
- * - Each key keeps note of the SeahorseKeySource it came from.
+ * - Each key keeps note of the SeahorseSource it came from.
*
* Signals:
* destroy: The key was destroyed.
*
* Properties:
- * key-source: (SeahorseKeySource) The key source this key came from.
+ * key-source: (SeahorseSource) The key source this key came from.
* key-id: (GQuark) The key identifier in the format ktype:fingerprint
* (ie: the DBUS format)
* raw-id: (gchar*) The raw backend specific key identifier
* key-desc: (gchar*) A description of the key type.
* ktype: (GQuark) The type of key (ie: SEAHORSE_PGP).
- * etype: (SeahorseKeyEType) The encryption type (ie: SKEY_PUBLIC)
+ * etype: (SeahorseUsage) The encryption type (ie: SEAHORSE_USAGE_PUBLIC_KEY)
* flags: (guint) Flags on the capabilities of the key (ie: SeahorseKeyFlags)
- * location: (SeahorseKeyLoc) The location this key is stored. (ie: SKEY_LOC_REMOTE)
+ * location: (SeahorseLocation) The location this key is stored. (ie: SEAHORSE_LOCATION_REMOTE)
* loaded: (SeahorseKeyInfo) How much of the key is loaded (ie: SKEY_INFO_COMPLETE)
* preferred: (SeahorseKey) Another representation of this key, that is better suited
* for use. (eg: for a remote key could point to it's local counterpart)
@@ -64,6 +64,7 @@
#include <gtk/gtk.h>
#include "cryptui.h"
+#include "seahorse-object.h"
#include "seahorse-validity.h"
#define SKEY_UNKNOWN 0
@@ -75,18 +76,6 @@
#define SEAHORSE_IS_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_KEY))
#define SEAHORSE_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_KEY, SeahorseKeyClass))
-/*
- * These types should never change. These values are exported via DBUS. In the
- * case of a key being in multiple locations, the highest location always 'wins'.
- */
-typedef enum {
- SKEY_LOC_INVALID = CRYPTUI_LOC_INVALID, /* An invalid key */
- SKEY_LOC_UNKNOWN = CRYPTUI_LOC_MISSING, /* A key we don't know anything about */
- SKEY_LOC_SEARCHING = CRYPTUI_LOC_SEARCHING, /* A key we're searching for but haven't found yet */
- SKEY_LOC_REMOTE = CRYPTUI_LOC_REMOTE, /* A key that we've found is present remotely */
- SKEY_LOC_LOCAL = CRYPTUI_LOC_LOCAL, /* A key on the local machine */
-} SeahorseKeyLoc;
-
typedef enum {
SKEY_INFO_NONE, /* We have no information on this key */
SKEY_INFO_BASIC, /* We have the usual basic quick info loaded */
@@ -94,14 +83,6 @@
} SeahorseKeyInfo;
typedef enum {
- SKEY_ETYPE_NONE = CRYPTUI_ENCTYPE_NONE, /* Any encryption type */
- SKEY_SYMMETRIC = CRYPTUI_ENCTYPE_SYMMETRIC, /* A symmetric key */
- SKEY_PUBLIC = CRYPTUI_ENCTYPE_PUBLIC, /* A public key */
- SKEY_PRIVATE = CRYPTUI_ENCTYPE_PRIVATE, /* A private key (assumes public/keypair) */
- SKEY_CREDENTIALS /* Credentials (ie: from gnome-keyring) */
-} SeahorseKeyEType;
-
-typedef enum {
SKEY_FLAG_IS_VALID = CRYPTUI_FLAG_IS_VALID,
SKEY_FLAG_CAN_ENCRYPT = CRYPTUI_FLAG_CAN_ENCRYPT,
SKEY_FLAG_CAN_SIGN = CRYPTUI_FLAG_CAN_SIGN,
@@ -113,8 +94,8 @@
/* Possible key changes */
typedef enum {
- SKEY_CHANGE_ALL = 1,
- SKEY_CHANGE_SIGNERS,
+ SKEY_CHANGE_ALL = SEAHORSE_OBJECT_CHANGE_ALL,
+ SKEY_CHANGE_SIGNERS = SEAHORSE_OBJECT_CHANGE_MAX,
SKEY_CHANGE_PASS,
SKEY_CHANGE_TRUST,
SKEY_CHANGE_DISABLED,
@@ -122,45 +103,28 @@
SKEY_CHANGE_REVOKERS,
SKEY_CHANGE_UIDS,
SKEY_CHANGE_SUBKEYS,
- SKEY_CHANGE_PHOTOS,
- SKEY_CHANGE_PREFERRED
+ SKEY_CHANGE_PHOTOS
} SeahorseKeyChange;
/* Forward declaration */
-struct _SeahorseKeySource;
+struct _SeahorseSource;
struct _SeahorseContext;
typedef struct _SeahorseKey SeahorseKey;
typedef struct _SeahorseKeyClass SeahorseKeyClass;
struct _SeahorseKey {
- GtkObject parent;
+ SeahorseObject parent;
/*< public >*/
- GQuark ktype;
- GQuark keyid;
const gchar* keydesc;
const gchar* rawid;
- SeahorseKeyLoc location;
SeahorseKeyInfo loaded;
- SeahorseKeyEType etype;
- guint flags;
- struct _SeahorseKeySource* sksrc;
-
- /*< private >*/
- struct _SeahorseContext* attached_to;
- struct _SeahorseKey* preferred;
};
struct _SeahorseKeyClass {
- GtkObjectClass parent_class;
+ SeahorseObjectClass parent_class;
- /* signals --------------------------------------------------------- */
-
- /* One of the key's attributes has changed */
- void (* changed) (SeahorseKey *skey,
- SeahorseKeyChange change);
-
/* virtual methods ------------------------------------------------- */
/* The number of UIDs on the key */
@@ -185,21 +149,16 @@
GType seahorse_key_get_type (void);
-void seahorse_key_destroy (SeahorseKey *skey);
-
-void seahorse_key_changed (SeahorseKey *skey,
- SeahorseKeyChange change);
-
GQuark seahorse_key_get_keyid (SeahorseKey *skey);
const gchar* seahorse_key_get_rawid (GQuark keyid);
const gchar* seahorse_key_get_short_keyid (SeahorseKey *skey);
-struct _SeahorseKeySource*
+struct _SeahorseSource*
seahorse_key_get_source (SeahorseKey *skey);
-SeahorseKeyEType seahorse_key_get_etype (SeahorseKey *skey);
+SeahorseUsage seahorse_key_get_usage (SeahorseKey *skey);
GQuark seahorse_key_get_ktype (SeahorseKey *skey);
@@ -207,7 +166,7 @@
SeahorseKeyInfo seahorse_key_get_loaded (SeahorseKey *skey);
-SeahorseKeyLoc seahorse_key_get_location (SeahorseKey *skey);
+SeahorseLocation seahorse_key_get_location (SeahorseKey *skey);
guint seahorse_key_get_flags (SeahorseKey *skey);
@@ -243,40 +202,9 @@
const gchar* seahorse_key_get_stock_id (SeahorseKey *skey);
-void seahorse_key_set_preferred (SeahorseKey *skey,
- SeahorseKey *preferred);
-
gboolean seahorse_key_lookup_property (SeahorseKey *skey,
guint uid,
const gchar *field,
GValue *value);
-
-/* -----------------------------------------------------------------------------
- * KEY PREDICATES
- */
-
-typedef gboolean (*SeahorseKeyPredicateFunc) (SeahorseKey *key, gpointer data);
-
-/* Used for searching, filtering keys */
-typedef struct _SeahorseKeyPredicate {
-
- /* Criteria */
- GQuark ktype; /* Keys of this type or 0*/
- GQuark keyid; /* A specific keyid or 0 */
- SeahorseKeyLoc location; /* Location of keys or SKEY_LOC_UNKNOWN */
- SeahorseKeyEType etype; /* Encryption type or SKEY_INVALID */
- guint flags; /* Flags keys must have or 0 */
- guint nflags; /* Flags keys must not have or 0 */
- struct _SeahorseKeySource *sksrc; /* key source keys must be from or NULL */
-
- /* Custom function */
- SeahorseKeyPredicateFunc custom;
- gpointer custom_target;
-
-} SeahorseKeyPredicate;
-
-gboolean
-seahorse_key_predicate_match (SeahorseKeyPredicate *skpred, SeahorseKey *skey);
-
#endif /* __SEAHORSE_KEY_H__ */
Modified: trunk/libseahorse/seahorse-notification.c
==============================================================================
--- trunk/libseahorse/seahorse-notification.c (original)
+++ trunk/libseahorse/seahorse-notification.c Thu Jul 17 01:41:51 2008
@@ -29,6 +29,8 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include "seahorse-key.h"
+#include "seahorse-object.h"
#include "seahorse-libdialogs.h"
#include "seahorse-util.h"
@@ -54,7 +56,7 @@
gchar *message;
const gchar *icon;
- GList *keys;
+ GList *objects;
GObject *widget;
} SeahorseNotification;
@@ -70,20 +72,20 @@
*/
/* Forward Declaration */
-static void key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseNotification *snotif);
+static void object_changed (SeahorseObject *sobj, SeahorseObjectChange change, SeahorseNotification *snotif);
static void
-insert_key_field (GString *res, const gchar *key, const gchar *field)
+insert_key_field (GString *res, const gchar *id, const gchar *field)
{
- SeahorseKey *skey;
+ SeahorseObject *sobj;
GValue value;
GValue svalue;
gchar *str;
guint uid;
- skey = seahorse_context_key_from_dbus (SCTX_APP (), key, &uid);
- if (!skey) {
- g_warning ("key '%s' in key text does not exist", key);
+ sobj = seahorse_context_object_from_dbus (SCTX_APP (), id, &uid);
+ if (!sobj || !SEAHORSE_IS_KEY (sobj)) {
+ g_warning ("key '%s' in key text does not exist", id);
return;
}
@@ -94,7 +96,7 @@
memset (&value, 0, sizeof (value));
memset (&svalue, 0, sizeof (value));
- if (seahorse_key_lookup_property (skey, uid, field, &value)) {
+ if (seahorse_key_lookup_property (SEAHORSE_KEY (sobj), uid, field, &value)) {
g_value_init (&svalue, G_TYPE_STRING);
if (g_value_transform (&value, &svalue)) {
str = g_markup_escape_text (g_value_get_string (&svalue), -1);
@@ -363,7 +365,7 @@
}
static void
-key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseNotification *snotif)
+object_changed (SeahorseObject *sobj, SeahorseObjectChange change, SeahorseNotification *snotif)
{
if (!snotif->widget)
return;
@@ -382,7 +384,7 @@
gpointer user_data, GError **error)
{
SeahorseNotification* snotif = SEAHORSE_NOTIFICATION (user_data);
- SeahorseKey *skey;
+ SeahorseObject *sobj;
if (strcmp (element_name, "key") == 0) {
@@ -400,10 +402,10 @@
g_warning ("key text <key> element requires the following attributes\n"
" <key id=\"xxxxx\" field=\"xxxxx\"/>");
- skey = seahorse_context_key_from_dbus (SCTX_APP (), key, NULL);
- if (skey) {
- snotif->keys = g_list_append (snotif->keys, skey);
- g_signal_connect (skey, "changed", G_CALLBACK (key_changed), snotif);
+ sobj = seahorse_context_object_from_dbus (SCTX_APP (), key, NULL);
+ if (sobj) {
+ snotif->objects = g_list_append (snotif->objects, sobj);
+ g_signal_connect (sobj, "changed", G_CALLBACK (object_changed), snotif);
}
}
@@ -437,10 +439,10 @@
snotif->widget = NULL;
- for (l = snotif->keys; l; l = g_list_next (l))
- g_signal_handlers_disconnect_by_func (l->data, key_changed, snotif);
- g_list_free (snotif->keys);
- snotif->keys = NULL;
+ for (l = snotif->objects; l; l = g_list_next (l))
+ g_signal_handlers_disconnect_by_func (l->data, object_changed, snotif);
+ g_list_free (snotif->objects);
+ snotif->objects = NULL;
G_OBJECT_CLASS (seahorse_notification_parent_class)->dispose (gobject);
}
Added: trunk/libseahorse/seahorse-object.c
==============================================================================
--- (empty file)
+++ trunk/libseahorse/seahorse-object.c Thu Jul 17 01:41:51 2008
@@ -0,0 +1,392 @@
+
+#include <seahorse-object.h>
+
+
+
+
+struct _SeahorseObjectPrivate {
+ SeahorseSource* _source;
+ SeahorseObject* _preferred;
+ SeahorseObject* _parent;
+ GList* _children;
+};
+
+#define SEAHORSE_OBJECT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_OBJECT, SeahorseObjectPrivate))
+enum {
+ SEAHORSE_OBJECT_DUMMY_PROPERTY,
+ SEAHORSE_OBJECT_TAG,
+ SEAHORSE_OBJECT_ID,
+ SEAHORSE_OBJECT_LOCATION,
+ SEAHORSE_OBJECT_USAGE,
+ SEAHORSE_OBJECT_FLAGS,
+ SEAHORSE_OBJECT_SOURCE,
+ SEAHORSE_OBJECT_PREFERRED,
+ SEAHORSE_OBJECT_DESCRIPTION,
+ SEAHORSE_OBJECT_MARKUP,
+ SEAHORSE_OBJECT_STOCK_ICON,
+ SEAHORSE_OBJECT_PARENT
+};
+static void seahorse_object_register_child (SeahorseObject* self, SeahorseObject* child);
+static void seahorse_object_unregister_child (SeahorseObject* self, SeahorseObject* child);
+static GObject * seahorse_object_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
+static gpointer seahorse_object_parent_class = NULL;
+static void seahorse_object_dispose (GObject * obj);
+
+
+
+
+GType seahorse_object_change_get_type (void) {
+ static GType seahorse_object_change_type_id = 0;
+ if (G_UNLIKELY (seahorse_object_change_type_id == 0)) {
+ static const GEnumValue values[] = {{SEAHORSE_OBJECT_CHANGE_ALL, "SEAHORSE_OBJECT_CHANGE_ALL", "all"}, {SEAHORSE_OBJECT_CHANGE_LOCATION, "SEAHORSE_OBJECT_CHANGE_LOCATION", "location"}, {SEAHORSE_OBJECT_CHANGE_PREFERRED, "SEAHORSE_OBJECT_CHANGE_PREFERRED", "preferred"}, {SEAHORSE_OBJECT_CHANGE_MAX, "SEAHORSE_OBJECT_CHANGE_MAX", "max"}, {0, NULL, NULL}};
+ seahorse_object_change_type_id = g_enum_register_static ("SeahorseObjectChange", values);
+ }
+ return seahorse_object_change_type_id;
+}
+
+
+GList* seahorse_object_get_children (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
+ return g_list_copy (self->priv->_children);
+}
+
+
+void seahorse_object_fire_changed (SeahorseObject* self, SeahorseObjectChange what) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ g_signal_emit_by_name (G_OBJECT (self), "changed", what);
+}
+
+
+static void seahorse_object_register_child (SeahorseObject* self, SeahorseObject* child) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ g_return_if_fail (SEAHORSE_IS_OBJECT (child));
+ g_assert (child->priv->_parent == NULL);
+ child->priv->_parent = self;
+ self->priv->_children = g_list_append (self->priv->_children, child);
+}
+
+
+static void seahorse_object_unregister_child (SeahorseObject* self, SeahorseObject* child) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ g_return_if_fail (SEAHORSE_IS_OBJECT (child));
+ g_assert (child->priv->_parent == self);
+ child->priv->_parent = NULL;
+ self->priv->_children = g_list_remove (self->priv->_children, child);
+}
+
+
+GQuark seahorse_object_get_tag (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0U);
+ return self->_tag;
+}
+
+
+GQuark seahorse_object_get_id (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0U);
+ return self->_id;
+}
+
+
+SeahorseLocation seahorse_object_get_location (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0);
+ return self->_location;
+}
+
+
+void seahorse_object_set_location (SeahorseObject* self, SeahorseLocation value) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ self->_location = value;
+ seahorse_object_fire_changed (self, SEAHORSE_OBJECT_CHANGE_LOCATION);
+}
+
+
+SeahorseUsage seahorse_object_get_usage (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0);
+ return self->_usage;
+}
+
+
+guint seahorse_object_get_flags (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), 0U);
+ return self->_flags;
+}
+
+
+SeahorseSource* seahorse_object_get_source (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
+ return self->priv->_source;
+}
+
+
+void seahorse_object_set_source (SeahorseObject* self, SeahorseSource* value) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ if (self->priv->_source != NULL) {
+ g_object_remove_weak_pointer (G_OBJECT (self->priv->_source), &self->priv->_source);
+ }
+ self->priv->_source = value;
+ if (self->priv->_source != NULL) {
+ g_object_add_weak_pointer (G_OBJECT (self->priv->_source), &self->priv->_source);
+ }
+}
+
+
+SeahorseObject* seahorse_object_get_preferred (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
+ return self->priv->_preferred;
+}
+
+
+void seahorse_object_set_preferred (SeahorseObject* self, SeahorseObject* value) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ if (self->priv->_preferred == value) {
+ return;
+ }
+ if (self->priv->_preferred != NULL) {
+ g_object_remove_weak_pointer (G_OBJECT (self->priv->_preferred), &self->priv->_preferred);
+ }
+ self->priv->_preferred = value;
+ if (self->priv->_preferred != NULL) {
+ g_object_add_weak_pointer (G_OBJECT (self->priv->_preferred), &self->priv->_preferred);
+ }
+ seahorse_object_fire_changed (self, SEAHORSE_OBJECT_CHANGE_PREFERRED);
+}
+
+
+char* seahorse_object_get_description (SeahorseObject* self) {
+ char* value;
+ g_object_get (G_OBJECT (self), "description", &value, NULL);
+ return value;
+}
+
+
+char* seahorse_object_get_markup (SeahorseObject* self) {
+ char* value;
+ g_object_get (G_OBJECT (self), "markup", &value, NULL);
+ return value;
+}
+
+
+char* seahorse_object_get_stock_icon (SeahorseObject* self) {
+ char* value;
+ g_object_get (G_OBJECT (self), "stock-icon", &value, NULL);
+ return value;
+}
+
+
+SeahorseObject* seahorse_object_get_parent (SeahorseObject* self) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (self), NULL);
+ return self->priv->_parent;
+}
+
+
+void seahorse_object_set_parent (SeahorseObject* self, SeahorseObject* value) {
+ g_return_if_fail (SEAHORSE_IS_OBJECT (self));
+ /* Set the new parent/child relationship */
+ if (self->priv->_parent != NULL) {
+ seahorse_object_unregister_child (self->priv->_parent, self);
+ }
+ if (value != NULL) {
+ seahorse_object_register_child (value, self);
+ }
+ g_assert (self->priv->_parent == value);
+ /* Fire a signal to let watchers know this changed */
+ g_signal_emit_by_name (G_OBJECT (self), "hierarchy");
+}
+
+
+static GObject * seahorse_object_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
+ GObject * obj;
+ SeahorseObjectClass * klass;
+ GObjectClass * parent_class;
+ SeahorseObject * self;
+ klass = SEAHORSE_OBJECT_CLASS (g_type_class_peek (SEAHORSE_TYPE_OBJECT));
+ parent_class = G_OBJECT_CLASS (g_type_class_peek_parent (klass));
+ obj = parent_class->constructor (type, n_construct_properties, construct_properties);
+ self = SEAHORSE_OBJECT (obj);
+ {
+ self->priv->_parent = NULL;
+ self->priv->_children = NULL;
+ }
+ return obj;
+}
+
+
+gboolean seahorse_object_predicate_match (SeahorseObjectPredicate *self, SeahorseObject* obj) {
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (obj), FALSE);
+ /* Check all the fields */
+ if ((*self).tag != 0 && ((*self).tag != obj->_tag)) {
+ return FALSE;
+ }
+ if ((*self).id != 0 && ((*self).id != obj->_id)) {
+ return FALSE;
+ }
+ if ((*self).location != 0 && ((*self).location != obj->_location)) {
+ return FALSE;
+ }
+ if ((*self).usage != 0 && ((*self).usage != obj->_usage)) {
+ return FALSE;
+ }
+ if ((*self).flags != 0 && ((*self).flags & obj->_flags) == 0) {
+ return FALSE;
+ }
+ if ((*self).nflags != 0 && ((*self).nflags & obj->_flags) != 0) {
+ return FALSE;
+ }
+ if ((*self).source != NULL && ((*self).source != obj->priv->_source)) {
+ return FALSE;
+ }
+ /* And any custom stuff */
+ if ((*self).custom != NULL && !(*self).custom (obj, (*self).custom_target)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+static void seahorse_object_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
+ SeahorseObject * self;
+ self = SEAHORSE_OBJECT (object);
+ switch (property_id) {
+ case SEAHORSE_OBJECT_TAG:
+ g_value_set_uint (value, seahorse_object_get_tag (self));
+ break;
+ case SEAHORSE_OBJECT_ID:
+ g_value_set_uint (value, seahorse_object_get_id (self));
+ break;
+ case SEAHORSE_OBJECT_LOCATION:
+ g_value_set_enum (value, seahorse_object_get_location (self));
+ break;
+ case SEAHORSE_OBJECT_USAGE:
+ g_value_set_enum (value, seahorse_object_get_usage (self));
+ break;
+ case SEAHORSE_OBJECT_FLAGS:
+ g_value_set_uint (value, seahorse_object_get_flags (self));
+ break;
+ case SEAHORSE_OBJECT_SOURCE:
+ g_value_set_object (value, seahorse_object_get_source (self));
+ break;
+ case SEAHORSE_OBJECT_PREFERRED:
+ g_value_set_object (value, seahorse_object_get_preferred (self));
+ break;
+ case SEAHORSE_OBJECT_PARENT:
+ g_value_set_object (value, seahorse_object_get_parent (self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void seahorse_object_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
+ SeahorseObject * self;
+ self = SEAHORSE_OBJECT (object);
+ switch (property_id) {
+ case SEAHORSE_OBJECT_LOCATION:
+ seahorse_object_set_location (self, g_value_get_enum (value));
+ break;
+ case SEAHORSE_OBJECT_SOURCE:
+ seahorse_object_set_source (self, g_value_get_object (value));
+ break;
+ case SEAHORSE_OBJECT_PREFERRED:
+ seahorse_object_set_preferred (self, g_value_get_object (value));
+ break;
+ case SEAHORSE_OBJECT_PARENT:
+ seahorse_object_set_parent (self, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void seahorse_object_class_init (SeahorseObjectClass * klass) {
+ seahorse_object_parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (SeahorseObjectPrivate));
+ G_OBJECT_CLASS (klass)->get_property = seahorse_object_get_property;
+ G_OBJECT_CLASS (klass)->set_property = seahorse_object_set_property;
+ G_OBJECT_CLASS (klass)->constructor = seahorse_object_constructor;
+ G_OBJECT_CLASS (klass)->dispose = seahorse_object_dispose;
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_TAG, g_param_spec_uint ("tag", "tag", "tag", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_ID, g_param_spec_uint ("id", "id", "id", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_LOCATION, g_param_spec_enum ("location", "location", "location", SEAHORSE_TYPE_LOCATION, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_USAGE, g_param_spec_enum ("usage", "usage", "usage", SEAHORSE_TYPE_USAGE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_FLAGS, g_param_spec_uint ("flags", "flags", "flags", 0, G_MAXUINT, 0U, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_SOURCE, g_param_spec_object ("source", "source", "source", SEAHORSE_TYPE_SOURCE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_PREFERRED, g_param_spec_object ("preferred", "preferred", "preferred", SEAHORSE_TYPE_OBJECT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_MARKUP, g_param_spec_string ("markup", "markup", "markup", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_STOCK_ICON, g_param_spec_string ("stock-icon", "stock-icon", "stock-icon", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_OBJECT_PARENT, g_param_spec_object ("parent", "parent", "parent", SEAHORSE_TYPE_OBJECT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_signal_new ("changed", SEAHORSE_TYPE_OBJECT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, SEAHORSE_OBJECT_TYPE_CHANGE);
+ g_signal_new ("hierarchy", SEAHORSE_TYPE_OBJECT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("destroy", SEAHORSE_TYPE_OBJECT, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+}
+
+
+static void seahorse_object_instance_init (SeahorseObject * self) {
+ self->priv = SEAHORSE_OBJECT_GET_PRIVATE (self);
+}
+
+
+static void seahorse_object_dispose (GObject * obj) {
+ SeahorseObject * self;
+ self = SEAHORSE_OBJECT (obj);
+ {
+ SeahorseObject* _tmp0;
+ SeahorseObject* new_parent;
+ if (self->priv->_source != NULL) {
+ g_object_remove_weak_pointer (G_OBJECT (self->priv->_source), &self->priv->_source);
+ }
+ if (self->priv->_preferred != NULL) {
+ g_object_remove_weak_pointer (G_OBJECT (self->priv->_source), &self->priv->_preferred);
+ }
+ /*
+ * When an object is destroyed, we reparent all
+ * children to this objects parent. If no parent
+ * of this object, all children become root objects.
+ */
+ _tmp0 = NULL;
+ new_parent = (_tmp0 = self->priv->_parent, (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ {
+ GList* child_collection;
+ GList* child_it;
+ child_collection = self->priv->_children;
+ for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
+ SeahorseObject* _tmp1;
+ SeahorseObject* child;
+ _tmp1 = NULL;
+ child = (_tmp1 = ((SeahorseObject*) (child_it->data)), (_tmp1 == NULL ? NULL : g_object_ref (_tmp1)));
+ {
+ seahorse_object_unregister_child (self, child);
+ if (new_parent != NULL) {
+ seahorse_object_register_child (new_parent, child);
+ }
+ /* Fire signal to let anyone know this has moved */
+ g_signal_emit_by_name (G_OBJECT (child), "hierarchy");
+ (child == NULL ? NULL : (child = (g_object_unref (child), NULL)));
+ }
+ }
+ }
+ /* Fire our destroy signal, so that any watchers can go away */
+ g_signal_emit_by_name (G_OBJECT (self), "destroy");
+ (new_parent == NULL ? NULL : (new_parent = (g_object_unref (new_parent), NULL)));
+ }
+ (self->attached_to == NULL ? NULL : (self->attached_to = (g_object_unref (self->attached_to), NULL)));
+ G_OBJECT_CLASS (seahorse_object_parent_class)->dispose (obj);
+}
+
+
+GType seahorse_object_get_type (void) {
+ static GType seahorse_object_type_id = 0;
+ if (G_UNLIKELY (seahorse_object_type_id == 0)) {
+ static const GTypeInfo g_define_type_info = { sizeof (SeahorseObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) seahorse_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SeahorseObject), 0, (GInstanceInitFunc) seahorse_object_instance_init };
+ seahorse_object_type_id = g_type_register_static (G_TYPE_OBJECT, "SeahorseObject", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
+ }
+ return seahorse_object_type_id;
+}
+
+
+
+
Added: trunk/libseahorse/seahorse-object.h
==============================================================================
--- (empty file)
+++ trunk/libseahorse/seahorse-object.h Thu Jul 17 01:41:51 2008
@@ -0,0 +1,92 @@
+
+#ifndef __SEAHORSE_OBJECT_H__
+#define __SEAHORSE_OBJECT_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <seahorse-context.h>
+#include <seahorse-source.h>
+#include <stdlib.h>
+#include <string.h>
+#include <seahorse-types.h>
+
+G_BEGIN_DECLS
+
+
+#define SEAHORSE_TYPE_OBJECT (seahorse_object_get_type ())
+#define SEAHORSE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_OBJECT, SeahorseObject))
+#define SEAHORSE_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_OBJECT, SeahorseObjectClass))
+#define SEAHORSE_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_OBJECT))
+#define SEAHORSE_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_OBJECT))
+#define SEAHORSE_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_OBJECT, SeahorseObjectClass))
+
+typedef struct _SeahorseObject SeahorseObject;
+typedef struct _SeahorseObjectClass SeahorseObjectClass;
+typedef struct _SeahorseObjectPrivate SeahorseObjectPrivate;
+
+#define SEAHORSE_OBJECT_TYPE_CHANGE (seahorse_object_change_get_type ())
+typedef struct _SeahorseObjectPredicate SeahorseObjectPredicate;
+typedef gboolean (*SeahorseObjectPredicateFunc) (SeahorseObject* obj, void* user_data);
+
+struct _SeahorseObject {
+ GObject parent_instance;
+ SeahorseObjectPrivate * priv;
+ GQuark _tag;
+ GQuark _id;
+ SeahorseLocation _location;
+ SeahorseUsage _usage;
+ guint _flags;
+ SeahorseContext* attached_to;
+};
+
+struct _SeahorseObjectClass {
+ GObjectClass parent_class;
+};
+
+/* INTERFACE --------------------------------------------------
+ TODO: Are we sure we need this? */
+typedef enum {
+ SEAHORSE_OBJECT_CHANGE_ALL = 1,
+ SEAHORSE_OBJECT_CHANGE_LOCATION,
+ SEAHORSE_OBJECT_CHANGE_PREFERRED,
+ SEAHORSE_OBJECT_CHANGE_MAX
+} SeahorseObjectChange;
+
+struct _SeahorseObjectPredicate {
+ GQuark tag;
+ GQuark id;
+ SeahorseLocation location;
+ SeahorseUsage usage;
+ guint flags;
+ guint nflags;
+ SeahorseSource* source;
+ SeahorseObjectPredicateFunc custom;
+ gpointer custom_target;
+};
+
+
+GType seahorse_object_change_get_type (void);
+GList* seahorse_object_get_children (SeahorseObject* self);
+void seahorse_object_fire_changed (SeahorseObject* self, SeahorseObjectChange what);
+GQuark seahorse_object_get_tag (SeahorseObject* self);
+GQuark seahorse_object_get_id (SeahorseObject* self);
+SeahorseLocation seahorse_object_get_location (SeahorseObject* self);
+void seahorse_object_set_location (SeahorseObject* self, SeahorseLocation value);
+SeahorseUsage seahorse_object_get_usage (SeahorseObject* self);
+guint seahorse_object_get_flags (SeahorseObject* self);
+SeahorseSource* seahorse_object_get_source (SeahorseObject* self);
+void seahorse_object_set_source (SeahorseObject* self, SeahorseSource* value);
+SeahorseObject* seahorse_object_get_preferred (SeahorseObject* self);
+void seahorse_object_set_preferred (SeahorseObject* self, SeahorseObject* value);
+char* seahorse_object_get_description (SeahorseObject* self);
+char* seahorse_object_get_markup (SeahorseObject* self);
+char* seahorse_object_get_stock_icon (SeahorseObject* self);
+SeahorseObject* seahorse_object_get_parent (SeahorseObject* self);
+void seahorse_object_set_parent (SeahorseObject* self, SeahorseObject* value);
+gboolean seahorse_object_predicate_match (SeahorseObjectPredicate *self, SeahorseObject* obj);
+GType seahorse_object_get_type (void);
+
+
+G_END_DECLS
+
+#endif
Added: trunk/libseahorse/seahorse-object.vala
==============================================================================
--- (empty file)
+++ trunk/libseahorse/seahorse-object.vala Thu Jul 17 01:41:51 2008
@@ -0,0 +1,198 @@
+
+namespace Seahorse {
+
+ public abstract class Object : GLib.Object {
+
+ /* PREDICATE -------------------------------------------------- */
+
+
+ public delegate bool PredicateFunc (Object obj);
+
+ public struct Predicate {
+ public GLib.Quark tag;
+ public GLib.Quark id;
+ public Location location;
+ public Usage usage;
+ public uint flags;
+ public uint nflags;
+ public weak Source? source;
+ public PredicateFunc? custom;
+
+ public bool match(Object obj)
+ {
+ /* Check all the fields */
+ if (this.tag != 0 && (this.tag != obj._tag))
+ return false;
+ if (this.id != 0 && (this.id != obj._id))
+ return false;
+ if (this.location != 0 && (this.location != obj._location))
+ return false;
+ if (this.usage != 0 && (this.usage != obj._usage))
+ return false;
+ if (this.flags != 0 && (this.flags & obj._flags) == 0)
+ return false;
+ if (this.nflags != 0 && (this.nflags & obj._flags) != 0)
+ return false;
+ if (this.source != null && (this.source != obj._source))
+ return false;
+
+ /* And any custom stuff */
+ if (this.custom != null && !this.custom(obj))
+ return false;
+
+ return true;
+ }
+ }
+
+ /* INTERFACE -------------------------------------------------- */
+
+ /* TODO: Are we sure we need this? */
+ public static enum Change {
+ ALL = 1,
+ LOCATION,
+ PREFERRED,
+ MAX
+ }
+
+ protected GLib.Quark _tag;
+ public GLib.Quark tag {
+ get { return _tag; }
+ }
+
+ protected GLib.Quark _id;
+ public GLib.Quark id {
+ get { return _id; }
+ }
+
+ protected Location _location;
+ public Location location {
+ get { return _location; }
+ set { _location = value; fire_changed (Change.LOCATION); }
+ }
+
+ protected Usage _usage;
+ public Usage usage {
+ get { return _usage; }
+ }
+
+ protected uint _flags;
+ public uint flags {
+ get { return _flags; }
+ }
+
+ private weak Source _source;
+ public Source source {
+ get { return _source; }
+ set {
+ if (_source != null)
+ _source.remove_weak_pointer (&_source);
+ _source = value;
+ if (_source != null)
+ _source.add_weak_pointer (&_source);
+ }
+ }
+
+ private weak Object _preferred;
+ public Object preferred {
+ get { return _preferred; }
+ set {
+ if (_preferred == value)
+ return;
+ if (_preferred != null)
+ _preferred.remove_weak_pointer (&_preferred);
+ _preferred = value;
+ if (_preferred != null)
+ _preferred.add_weak_pointer (&_preferred);
+ fire_changed (Change.PREFERRED);
+ }
+ }
+
+ public Context attached_to;
+
+ public signal void changed(Change what);
+ public signal void hierarchy();
+ public signal void destroy();
+
+ public abstract string# description { get; }
+ public abstract string# markup { get; }
+ public abstract weak string# stock_icon { get; }
+
+ public Object? parent {
+ get {
+ return _parent;
+ }
+ set {
+ /* Set the new parent/child relationship */
+ if(_parent != null)
+ _parent.unregister_child(this);
+ if(value != null)
+ value.register_child(this);
+ assert(_parent == value);
+
+ /* Fire a signal to let watchers know this changed */
+ this.hierarchy();
+ }
+ }
+
+ public GLib.List<weak Object> get_children()
+ {
+ return _children.copy();
+ }
+
+ protected void fire_changed(Change what)
+ {
+ this.changed(what);
+ }
+
+ /* IMPLEMENTATION --------------------------------------------- */
+
+ private weak Object? _parent;
+ private weak GLib.List<weak Object> _children;
+
+ construct {
+ _parent = null;
+ _children = null;
+ }
+
+ ~Object () {
+
+ if (_source != null)
+ _source.remove_weak_pointer (&_source);
+ if (_preferred != null)
+ _source.remove_weak_pointer (&_preferred);
+
+ /*
+ * When an object is destroyed, we reparent all
+ * children to this objects parent. If no parent
+ * of this object, all children become root objects.
+ */
+
+ Object new_parent = this._parent;
+ foreach (Object child in _children) {
+ unregister_child(child);
+ if (new_parent != null)
+ new_parent.register_child(child);
+
+ /* Fire signal to let anyone know this has moved */
+ child.hierarchy();
+ }
+
+ /* Fire our destroy signal, so that any watchers can go away */
+ this.destroy();
+ }
+
+ private void register_child(Object child)
+ {
+ assert(child._parent == null);
+ child._parent = this;
+ _children.append(child);
+ }
+
+ private void unregister_child(Object child)
+ {
+ assert(child._parent == this);
+ child._parent = null;
+ _children.remove(child);
+ }
+ }
+}
Modified: trunk/libseahorse/seahorse-prefs-keyrings.c
==============================================================================
--- trunk/libseahorse/seahorse-prefs-keyrings.c (original)
+++ trunk/libseahorse/seahorse-prefs-keyrings.c Thu Jul 17 01:41:51 2008
@@ -295,7 +295,7 @@
keyring_default_done (GnomeKeyringResult result, gpointer data)
{
SeahorseWidget *swidget;
- SeahorseKeySource *src;
+ SeahorseSource *src;
swidget = SEAHORSE_WIDGET (data);
g_return_if_fail (swidget);
@@ -311,11 +311,10 @@
* Update the main seahorse gkeyring source
* TODO: We shouldn't have to define SEAHORSE_GKR here again
*/
- src = seahorse_context_find_key_source (SCTX_APP (),
- g_quark_from_static_string ("gnome-keyring"),
- SKEY_LOC_LOCAL);
+ src = seahorse_context_find_source (SCTX_APP (), g_quark_from_static_string ("gnome-keyring"),
+ SEAHORSE_LOCATION_LOCAL);
if (src)
- seahorse_key_source_load_async (src, 0);
+ seahorse_source_load_async (src, 0);
/* Setting the default keyring failed */
} else if (result != GNOME_KEYRING_RESULT_CANCELLED) {
Copied: trunk/libseahorse/seahorse-set.c (from r2271, /trunk/libseahorse/seahorse-keyset.c)
==============================================================================
--- /trunk/libseahorse/seahorse-keyset.c (original)
+++ trunk/libseahorse/seahorse-set.c Thu Jul 17 01:41:51 2008
@@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
-#include "seahorse-keyset.h"
+#include "seahorse-set.h"
#include "seahorse-marshal.h"
#include "seahorse-gconf.h"
@@ -38,123 +38,123 @@
static guint signals[LAST_SIGNAL] = { 0 };
-struct _SeahorseKeysetPrivate {
- GHashTable *keys;
- SeahorseKeyPredicate *pred;
+struct _SeahorseSetPrivate {
+ GHashTable *objects;
+ SeahorseObjectPredicate *pred;
};
-G_DEFINE_TYPE (SeahorseKeyset, seahorse_keyset, G_TYPE_OBJECT);
+G_DEFINE_TYPE (SeahorseSet, seahorse_set, G_TYPE_OBJECT);
/* -----------------------------------------------------------------------------
* INTERNAL
*/
static gboolean
-remove_update (SeahorseKey *skey, gpointer closure, SeahorseKeyset *skset)
+remove_update (SeahorseObject *sobj, gpointer closure, SeahorseSet *skset)
{
if (closure == GINT_TO_POINTER (TRUE))
closure = NULL;
- g_signal_emit (skset, signals[REMOVED], 0, skey, closure);
+ g_signal_emit (skset, signals[REMOVED], 0, sobj, closure);
g_signal_emit (skset, signals[SET_CHANGED], 0);
return TRUE;
}
static void
-remove_key (SeahorseKey *skey, gpointer closure, SeahorseKeyset *skset)
+remove_object (SeahorseObject *sobj, gpointer closure, SeahorseSet *skset)
{
if (!closure)
- closure = g_hash_table_lookup (skset->pv->keys, skey);
+ closure = g_hash_table_lookup (skset->pv->objects, sobj);
- g_hash_table_remove (skset->pv->keys, skey);
- remove_update (skey, closure, skset);
+ g_hash_table_remove (skset->pv->objects, sobj);
+ remove_update (sobj, closure, skset);
}
static gboolean
-maybe_add_key (SeahorseKeyset *skset, SeahorseKey *skey)
+maybe_add_object (SeahorseSet *skset, SeahorseObject *sobj)
{
- if (!seahorse_context_owns_key (SCTX_APP (), skey))
+ if (!seahorse_context_owns_object (SCTX_APP (), sobj))
return FALSE;
- if (g_hash_table_lookup (skset->pv->keys, skey))
+ if (g_hash_table_lookup (skset->pv->objects, sobj))
return FALSE;
- if (!skset->pv->pred || !seahorse_key_predicate_match (skset->pv->pred, skey))
+ if (!skset->pv->pred || !seahorse_object_predicate_match (skset->pv->pred, sobj))
return FALSE;
- g_hash_table_replace (skset->pv->keys, skey, GINT_TO_POINTER (TRUE));
- g_signal_emit (skset, signals[ADDED], 0, skey);
+ g_hash_table_replace (skset->pv->objects, sobj, GINT_TO_POINTER (TRUE));
+ g_signal_emit (skset, signals[ADDED], 0, sobj);
g_signal_emit (skset, signals[SET_CHANGED], 0);
return TRUE;
}
static gboolean
-maybe_remove_key (SeahorseKeyset *skset, SeahorseKey *skey)
+maybe_remove_object (SeahorseSet *skset, SeahorseObject *sobj)
{
- if (!g_hash_table_lookup (skset->pv->keys, skey))
+ if (!g_hash_table_lookup (skset->pv->objects, sobj))
return FALSE;
- if (skset->pv->pred && seahorse_key_predicate_match (skset->pv->pred, skey))
+ if (skset->pv->pred && seahorse_object_predicate_match (skset->pv->pred, sobj))
return FALSE;
- remove_key (skey, NULL, skset);
+ remove_object (sobj, NULL, skset);
return TRUE;
}
static void
-key_added (SeahorseContext *sctx, SeahorseKey *skey, SeahorseKeyset *skset)
+object_added (SeahorseContext *sctx, SeahorseObject *sobj, SeahorseSet *skset)
{
- g_assert (SEAHORSE_IS_KEY (skey));
- g_assert (SEAHORSE_IS_KEYSET (skset));
+ g_assert (SEAHORSE_IS_OBJECT (sobj));
+ g_assert (SEAHORSE_IS_SET (skset));
- maybe_add_key (skset, skey);
+ maybe_add_object (skset, sobj);
}
static void
-key_removed (SeahorseContext *sctx, SeahorseKey *skey, SeahorseKeyset *skset)
+object_removed (SeahorseContext *sctx, SeahorseObject *sobj, SeahorseSet *skset)
{
- g_assert (SEAHORSE_IS_KEY (skey));
- g_assert (SEAHORSE_IS_KEYSET (skset));
+ g_assert (SEAHORSE_IS_OBJECT (sobj));
+ g_assert (SEAHORSE_IS_SET (skset));
- if (g_hash_table_lookup (skset->pv->keys, skey))
- remove_key (skey, NULL, skset);
+ if (g_hash_table_lookup (skset->pv->objects, sobj))
+ remove_object (sobj, NULL, skset);
}
static void
-key_changed (SeahorseContext *sctx, SeahorseKey *skey, SeahorseKeyChange change,
- SeahorseKeyset *skset)
+object_changed (SeahorseContext *sctx, SeahorseObject *sobj, SeahorseObjectChange change,
+ SeahorseSet *skset)
{
- gpointer closure = g_hash_table_lookup (skset->pv->keys, skey);
+ gpointer closure = g_hash_table_lookup (skset->pv->objects, sobj);
- g_assert (SEAHORSE_IS_KEY (skey));
- g_assert (SEAHORSE_IS_KEYSET (skset));
+ g_assert (SEAHORSE_IS_OBJECT (sobj));
+ g_assert (SEAHORSE_IS_SET (skset));
if (closure) {
/* See if needs to be removed, otherwise emit signal */
- if (!maybe_remove_key (skset, skey)) {
+ if (!maybe_remove_object (skset, sobj)) {
if (closure == GINT_TO_POINTER (TRUE))
closure = NULL;
- g_signal_emit (skset, signals[CHANGED], 0, skey, change, closure);
+ g_signal_emit (skset, signals[CHANGED], 0, sobj, change, closure);
}
/* Not in our set yet */
} else
- maybe_add_key (skset, skey);
+ maybe_add_object (skset, sobj);
}
static void
-keys_to_list (SeahorseKey *skey, gpointer *c, GList **l)
+objects_to_list (SeahorseObject *sobj, gpointer *c, GList **l)
{
- *l = g_list_append (*l, skey);
+ *l = g_list_append (*l, sobj);
}
static void
-keys_to_hash (SeahorseKey *skey, gpointer *c, GHashTable *ht)
+objects_to_hash (SeahorseObject *sobj, gpointer *c, GHashTable *ht)
{
- g_hash_table_replace (ht, skey, NULL);
+ g_hash_table_replace (ht, sobj, NULL);
}
/* -----------------------------------------------------------------------------
@@ -162,52 +162,52 @@
*/
static void
-seahorse_keyset_dispose (GObject *gobject)
+seahorse_set_dispose (GObject *gobject)
{
- SeahorseKeyset *skset = SEAHORSE_KEYSET (gobject);
+ SeahorseSet *skset = SEAHORSE_SET (gobject);
/* Release all our pointers and stuff */
- g_hash_table_foreach_remove (skset->pv->keys, (GHRFunc)remove_update, skset);
+ g_hash_table_foreach_remove (skset->pv->objects, (GHRFunc)remove_update, skset);
skset->pv->pred = NULL;
- g_signal_handlers_disconnect_by_func (SCTX_APP (), key_added, skset);
- g_signal_handlers_disconnect_by_func (SCTX_APP (), key_removed, skset);
- g_signal_handlers_disconnect_by_func (SCTX_APP (), key_changed, skset);
+ g_signal_handlers_disconnect_by_func (SCTX_APP (), object_added, skset);
+ g_signal_handlers_disconnect_by_func (SCTX_APP (), object_removed, skset);
+ g_signal_handlers_disconnect_by_func (SCTX_APP (), object_changed, skset);
- G_OBJECT_CLASS (seahorse_keyset_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (seahorse_set_parent_class)->dispose (gobject);
}
static void
-seahorse_keyset_finalize (GObject *gobject)
+seahorse_set_finalize (GObject *gobject)
{
- SeahorseKeyset *skset = SEAHORSE_KEYSET (gobject);
+ SeahorseSet *skset = SEAHORSE_SET (gobject);
- g_hash_table_destroy (skset->pv->keys);
+ g_hash_table_destroy (skset->pv->objects);
g_assert (skset->pv->pred == NULL);
g_free (skset->pv);
- G_OBJECT_CLASS (seahorse_keyset_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (seahorse_set_parent_class)->finalize (gobject);
}
static void
-seahorse_keyset_set_property (GObject *object, guint prop_id, const GValue *value,
+seahorse_set_set_property (GObject *object, guint prop_id, const GValue *value,
GParamSpec *pspec)
{
- SeahorseKeyset *skset = SEAHORSE_KEYSET (object);
+ SeahorseSet *skset = SEAHORSE_SET (object);
switch (prop_id) {
case PROP_PREDICATE:
- skset->pv->pred = (SeahorseKeyPredicate*)g_value_get_pointer (value);
- seahorse_keyset_refresh (skset);
+ skset->pv->pred = (SeahorseObjectPredicate*)g_value_get_pointer (value);
+ seahorse_set_refresh (skset);
break;
}
}
static void
-seahorse_keyset_get_property (GObject *object, guint prop_id, GValue *value,
+seahorse_set_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *pspec)
{
- SeahorseKeyset *skset = SEAHORSE_KEYSET (object);
+ SeahorseSet *skset = SEAHORSE_SET (object);
switch (prop_id) {
case PROP_PREDICATE:
@@ -217,49 +217,49 @@
}
static void
-seahorse_keyset_init (SeahorseKeyset *skset)
+seahorse_set_init (SeahorseSet *skset)
{
/* init private vars */
- skset->pv = g_new0 (SeahorseKeysetPrivate, 1);
+ skset->pv = g_new0 (SeahorseSetPrivate, 1);
- skset->pv->keys = g_hash_table_new (g_direct_hash, g_direct_equal);
+ skset->pv->objects = g_hash_table_new (g_direct_hash, g_direct_equal);
- g_signal_connect (SCTX_APP (), "added", G_CALLBACK (key_added), skset);
- g_signal_connect (SCTX_APP (), "removed", G_CALLBACK (key_removed), skset);
- g_signal_connect (SCTX_APP (), "changed", G_CALLBACK (key_changed), skset);
+ g_signal_connect (SCTX_APP (), "added", G_CALLBACK (object_added), skset);
+ g_signal_connect (SCTX_APP (), "removed", G_CALLBACK (object_removed), skset);
+ g_signal_connect (SCTX_APP (), "changed", G_CALLBACK (object_changed), skset);
}
static void
-seahorse_keyset_class_init (SeahorseKeysetClass *klass)
+seahorse_set_class_init (SeahorseSetClass *klass)
{
GObjectClass *gobject_class;
- seahorse_keyset_parent_class = g_type_class_peek_parent (klass);
+ seahorse_set_parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->dispose = seahorse_keyset_dispose;
- gobject_class->finalize = seahorse_keyset_finalize;
- gobject_class->set_property = seahorse_keyset_set_property;
- gobject_class->get_property = seahorse_keyset_get_property;
+ gobject_class->dispose = seahorse_set_dispose;
+ gobject_class->finalize = seahorse_set_finalize;
+ gobject_class->set_property = seahorse_set_set_property;
+ gobject_class->get_property = seahorse_set_get_property;
g_object_class_install_property (gobject_class, PROP_PREDICATE,
- g_param_spec_pointer ("predicate", "Predicate", "Predicate for matching keys into this set.",
+ g_param_spec_pointer ("predicate", "Predicate", "Predicate for matching objects into this set.",
G_PARAM_READWRITE));
- signals[ADDED] = g_signal_new ("added", SEAHORSE_TYPE_KEYSET,
- G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseKeysetClass, added),
- NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_KEY);
-
- signals[REMOVED] = g_signal_new ("removed", SEAHORSE_TYPE_KEYSET,
- G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseKeysetClass, removed),
- NULL, NULL, seahorse_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, SEAHORSE_TYPE_KEY, G_TYPE_POINTER);
-
- signals[CHANGED] = g_signal_new ("changed", SEAHORSE_TYPE_KEYSET,
- G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseKeysetClass, changed),
- NULL, NULL, seahorse_marshal_VOID__OBJECT_UINT_POINTER, G_TYPE_NONE, 3, SEAHORSE_TYPE_KEY, G_TYPE_UINT, G_TYPE_POINTER);
+ signals[ADDED] = g_signal_new ("added", SEAHORSE_TYPE_SET,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseSetClass, added),
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_OBJECT);
+
+ signals[REMOVED] = g_signal_new ("removed", SEAHORSE_TYPE_SET,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseSetClass, removed),
+ NULL, NULL, seahorse_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, SEAHORSE_TYPE_OBJECT, G_TYPE_POINTER);
+
+ signals[CHANGED] = g_signal_new ("changed", SEAHORSE_TYPE_SET,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseSetClass, changed),
+ NULL, NULL, seahorse_marshal_VOID__OBJECT_UINT_POINTER, G_TYPE_NONE, 3, SEAHORSE_TYPE_OBJECT, G_TYPE_UINT, G_TYPE_POINTER);
- signals[SET_CHANGED] = g_signal_new ("set-changed", SEAHORSE_TYPE_KEYSET,
- G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseKeysetClass, set_changed),
+ signals[SET_CHANGED] = g_signal_new ("set-changed", SEAHORSE_TYPE_SET,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseSetClass, set_changed),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
@@ -267,94 +267,94 @@
* PUBLIC
*/
-SeahorseKeyset*
-seahorse_keyset_new (GQuark ktype, SeahorseKeyEType etype, SeahorseKeyLoc location,
+SeahorseSet*
+seahorse_set_new (GQuark ktype, SeahorseUsage usage, SeahorseLocation location,
guint flags, guint nflags)
{
- SeahorseKeyset *skset;
- SeahorseKeyPredicate *pred = g_new0(SeahorseKeyPredicate, 1);
+ SeahorseSet *skset;
+ SeahorseObjectPredicate *pred = g_new0(SeahorseObjectPredicate, 1);
pred->location = location;
- pred->ktype = ktype;
- pred->etype = etype;
+ pred->id = ktype;
+ pred->usage = usage;
pred->flags = flags;
pred->nflags = nflags;
- skset = seahorse_keyset_new_full (pred);
+ skset = seahorse_set_new_full (pred);
g_object_set_data_full (G_OBJECT (skset), "quick-predicate", pred, g_free);
return skset;
}
-SeahorseKeyset*
-seahorse_keyset_new_full (SeahorseKeyPredicate *pred)
+SeahorseSet*
+seahorse_set_new_full (SeahorseObjectPredicate *pred)
{
- return g_object_new (SEAHORSE_TYPE_KEYSET, "predicate", pred, NULL);
+ return g_object_new (SEAHORSE_TYPE_SET, "predicate", pred, NULL);
}
gboolean
-seahorse_keyset_has_key (SeahorseKeyset *skset, SeahorseKey *skey)
+seahorse_set_has_object (SeahorseSet *skset, SeahorseObject *sobj)
{
- if (g_hash_table_lookup (skset->pv->keys, skey))
+ if (g_hash_table_lookup (skset->pv->objects, sobj))
return TRUE;
/*
- * This happens when the key has changed state, but we have
+ * This happens when the object has changed state, but we have
* not yet received the signal.
*/
- if (maybe_add_key (skset, skey))
+ if (maybe_add_object (skset, sobj))
return TRUE;
return FALSE;
}
GList*
-seahorse_keyset_get_keys (SeahorseKeyset *skset)
+seahorse_set_get_objects (SeahorseSet *skset)
{
- GList *keys = NULL;
- g_hash_table_foreach (skset->pv->keys, (GHFunc)keys_to_list, &keys);
- return keys;
+ GList *objs = NULL;
+ g_hash_table_foreach (skset->pv->objects, (GHFunc)objects_to_list, &objs);
+ return objs;
}
guint
-seahorse_keyset_get_count (SeahorseKeyset *skset)
+seahorse_set_get_count (SeahorseSet *skset)
{
- return g_hash_table_size (skset->pv->keys);
+ return g_hash_table_size (skset->pv->objects);
}
void
-seahorse_keyset_refresh (SeahorseKeyset *skset)
+seahorse_set_refresh (SeahorseSet *skset)
{
GHashTable *check = g_hash_table_new (g_direct_hash, g_direct_equal);
- GList *l, *keys = NULL;
- SeahorseKey *skey;
+ GList *l, *objects = NULL;
+ SeahorseObject *sobj;
- /* Make note of all the keys we had prior to refresh */
- g_hash_table_foreach (skset->pv->keys, (GHFunc)keys_to_hash, check);
+ /* Make note of all the objects we had prior to refresh */
+ g_hash_table_foreach (skset->pv->objects, (GHFunc)objects_to_hash, check);
if (skset->pv->pred)
- keys = seahorse_context_find_keys_full (SCTX_APP (), skset->pv->pred);
+ objects = seahorse_context_find_objects_full (SCTX_APP (), skset->pv->pred);
- for (l = keys; l; l = g_list_next (l)) {
- skey = SEAHORSE_KEY (l->data);
+ for (l = objects; l; l = g_list_next (l)) {
+ sobj = SEAHORSE_OBJECT (l->data);
- /* Make note that we've seen this key */
- g_hash_table_remove (check, skey);
+ /* Make note that we've seen this object */
+ g_hash_table_remove (check, sobj);
- /* This will add to keyset */
- maybe_add_key (skset, skey);
+ /* This will add to set */
+ maybe_add_object (skset, sobj);
}
- g_list_free (keys);
+ g_list_free (objects);
- g_hash_table_foreach (check, (GHFunc)remove_key, skset);
+ g_hash_table_foreach (check, (GHFunc)remove_object, skset);
g_hash_table_destroy (check);
}
gpointer
-seahorse_keyset_get_closure (SeahorseKeyset *skset, SeahorseKey *skey)
+seahorse_set_get_closure (SeahorseSet *skset, SeahorseObject *sobj)
{
- gpointer closure = g_hash_table_lookup (skset->pv->keys, skey);
+ gpointer closure = g_hash_table_lookup (skset->pv->objects, sobj);
g_return_val_if_fail (closure != NULL, NULL);
/* |TRUE| means no closure has been set */
@@ -365,15 +365,15 @@
}
void
-seahorse_keyset_set_closure (SeahorseKeyset *skset, SeahorseKey *skey,
+seahorse_set_set_closure (SeahorseSet *skset, SeahorseObject *sobj,
gpointer closure)
{
- /* Make sure we have the key */
- g_return_if_fail (g_hash_table_lookup (skset->pv->keys, skey) != NULL);
+ /* Make sure we have the object */
+ g_return_if_fail (g_hash_table_lookup (skset->pv->objects, sobj) != NULL);
/* |TRUE| means no closure has been set */
if (closure == NULL)
closure = GINT_TO_POINTER (TRUE);
- g_hash_table_insert (skset->pv->keys, skey, closure);
+ g_hash_table_insert (skset->pv->objects, sobj, closure);
}
Copied: trunk/libseahorse/seahorse-set.h (from r2271, /trunk/libseahorse/seahorse-keyset.h)
==============================================================================
--- /trunk/libseahorse/seahorse-keyset.h (original)
+++ trunk/libseahorse/seahorse-set.h Thu Jul 17 01:41:51 2008
@@ -20,13 +20,13 @@
*/
/**
- * SeahorseKeyset: A subset list of the keys in the SeahorseContext.
+ * SeahorseSet: A subset list of the keys in the SeahorseContext.
*
* - Used all over by various views to narrow in on the keys that they're
* interested in.
* - Originally was going to be called SeahorseView (database parlance) but
* that's far too confusing with overloaded terminology.
- * - Uses a SeahorseKeyPredicate to match keys.
+ * - Uses a SeahorseObjectPredicate to match keys.
* - Sends out events when keys get added and removed from it's view. Or a
* key in the view changes etc...
* - Supports per key event 'closures'. When a closure is set for a key, it's
@@ -40,77 +40,77 @@
*
* Properties:
* count: The number of keys
- * predicate: (SeahorseKeyPredicate) The predicate used for matching.
+ * predicate: (SeahorseObjectPredicate) The predicate used for matching.
*/
-#ifndef __SEAHORSE_KEYSET_H__
-#define __SEAHORSE_KEYSET_H__
+#ifndef __SEAHORSE_SET_H__
+#define __SEAHORSE_SET_H__
#include "seahorse-context.h"
-#include "seahorse-key.h"
-#include "seahorse-key-source.h"
+#include "seahorse-object.h"
+#include "seahorse-source.h"
-#define SEAHORSE_TYPE_KEYSET (seahorse_keyset_get_type ())
-#define SEAHORSE_KEYSET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_KEYSET, SeahorseKeyset))
-#define SEAHORSE_KEYSET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_KEYSET, SeahorseKeysetClass))
-#define SEAHORSE_IS_KEYSET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_KEYSET))
-#define SEAHORSE_IS_KEYSET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_KEYSET))
-#define SEAHORSE_KEYSET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_KEYSET, SeahorseKeysetClass))
-
-typedef struct _SeahorseKeyset SeahorseKeyset;
-typedef struct _SeahorseKeysetClass SeahorseKeysetClass;
-typedef struct _SeahorseKeysetPrivate SeahorseKeysetPrivate;
+#define SEAHORSE_TYPE_SET (seahorse_set_get_type ())
+#define SEAHORSE_SET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_SET, SeahorseSet))
+#define SEAHORSE_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_SET, SeahorseSetClass))
+#define SEAHORSE_IS_SET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_SET))
+#define SEAHORSE_IS_SET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_SET))
+#define SEAHORSE_SET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_SET, SeahorseSetClass))
+
+typedef struct _SeahorseSet SeahorseSet;
+typedef struct _SeahorseSetClass SeahorseSetClass;
+typedef struct _SeahorseSetPrivate SeahorseSetPrivate;
-struct _SeahorseKeyset {
+struct _SeahorseSet {
GtkObject parent;
/*<private>*/
- SeahorseKeysetPrivate *pv;
+ SeahorseSetPrivate *pv;
};
-struct _SeahorseKeysetClass {
+struct _SeahorseSetClass {
GtkObjectClass parent_class;
/* signals --------------------------------------------------------- */
/* A key was added to this view */
- void (*added) (SeahorseKeyset *skset, SeahorseKey *key);
+ void (*added) (SeahorseSet *skset, SeahorseObject *sobj);
/* Removed a key from this view */
- void (*removed) (SeahorseKeyset *skset, SeahorseKey *key, gpointer closure);
+ void (*removed) (SeahorseSet *skset, SeahorseObject *sobj, gpointer closure);
/* One of the key's attributes has changed */
- void (*changed) (SeahorseKeyset *skset, SeahorseKey *skey,
- SeahorseKeyChange change, gpointer closure);
+ void (*changed) (SeahorseSet *skset, SeahorseObject *sobj,
+ SeahorseObjectChange change, gpointer closure);
/* The set of keys changed */
- void (*set_changed) (SeahorseKeyset *skset);
+ void (*set_changed) (SeahorseSet *skset);
};
-GType seahorse_keyset_get_type (void);
+GType seahorse_set_get_type (void);
-SeahorseKeyset* seahorse_keyset_new (GQuark ktype,
- SeahorseKeyEType etype,
- SeahorseKeyLoc location,
+SeahorseSet* seahorse_set_new (GQuark ktype,
+ SeahorseUsage usage,
+ SeahorseLocation location,
guint flags,
guint nflags);
-SeahorseKeyset* seahorse_keyset_new_full (SeahorseKeyPredicate *pred);
+SeahorseSet* seahorse_set_new_full (SeahorseObjectPredicate *pred);
-gboolean seahorse_keyset_has_key (SeahorseKeyset *skset,
- SeahorseKey *skey);
+gboolean seahorse_set_has_object (SeahorseSet *skset,
+ SeahorseObject *sobj);
-GList* seahorse_keyset_get_keys (SeahorseKeyset *skset);
+GList* seahorse_set_get_objects (SeahorseSet *skset);
-guint seahorse_keyset_get_count (SeahorseKeyset *skset);
+guint seahorse_set_get_count (SeahorseSet *skset);
-void seahorse_keyset_refresh (SeahorseKeyset *skset);
+void seahorse_set_refresh (SeahorseSet *skset);
-gpointer seahorse_keyset_get_closure (SeahorseKeyset *skset,
- SeahorseKey *skey);
+gpointer seahorse_set_get_closure (SeahorseSet *skset,
+ SeahorseObject *sobj);
-void seahorse_keyset_set_closure (SeahorseKeyset *skset,
- SeahorseKey *skey,
- gpointer closure);
+void seahorse_set_set_closure (SeahorseSet *skset,
+ SeahorseObject *sobj,
+ gpointer closure);
-#endif /* __SEAHORSE_KEY_SET_H__ */
+#endif /* __SEAHORSE_SET_H__ */
Copied: trunk/libseahorse/seahorse-source.c (from r2276, /trunk/libseahorse/seahorse-key-source.c)
==============================================================================
--- /trunk/libseahorse/seahorse-key-source.c (original)
+++ trunk/libseahorse/seahorse-source.c Thu Jul 17 01:41:51 2008
@@ -21,151 +21,152 @@
#include "config.h"
-#include "seahorse-key-source.h"
-#include "seahorse-marshal.h"
#include "seahorse-context.h"
+#include "seahorse-marshal.h"
+#include "seahorse-object.h"
+#include "seahorse-source.h"
#include "seahorse-util.h"
#include "common/seahorse-registry.h"
-G_DEFINE_TYPE (SeahorseKeySource, seahorse_key_source, G_TYPE_OBJECT);
+G_DEFINE_TYPE (SeahorseSource, seahorse_source, G_TYPE_OBJECT);
/* GObject handlers */
-static void seahorse_key_source_dispose (GObject *gobject);
-static void seahorse_key_source_finalize (GObject *gobject);
+static void seahorse_source_dispose (GObject *gobject);
+static void seahorse_source_finalize (GObject *gobject);
static GObjectClass *parent_class = NULL;
static void
-seahorse_key_source_class_init (SeahorseKeySourceClass *klass)
+seahorse_source_class_init (SeahorseSourceClass *klass)
{
GObjectClass *gobject_class;
parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->dispose = seahorse_key_source_dispose;
- gobject_class->finalize = seahorse_key_source_finalize;
+ gobject_class->dispose = seahorse_source_dispose;
+ gobject_class->finalize = seahorse_source_finalize;
}
/* Initialize the object */
static void
-seahorse_key_source_init (SeahorseKeySource *sksrc)
+seahorse_source_init (SeahorseSource *sksrc)
{
}
/* dispose of all our internal references */
static void
-seahorse_key_source_dispose (GObject *gobject)
+seahorse_source_dispose (GObject *gobject)
{
G_OBJECT_CLASS (parent_class)->dispose (gobject);
}
/* free private vars */
static void
-seahorse_key_source_finalize (GObject *gobject)
+seahorse_source_finalize (GObject *gobject)
{
G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
/**
- * seahorse_key_source_load
- * @sksrc: A #SeahorseKeySource object
- * @keyid: The key to refresh or 0 for all.
+ * seahorse_source_load
+ * @sksrc: A #SeahorseSource object
+ * @id: The object to refresh or 0 for all.
*
- * Refreshes the #SeahorseKeySource's internal key listing.
+ * Refreshes the #SeahorseSource's internal object listing.
*
- * Returns the asynchronous key refresh operation.
+ * Returns the asynchronous refresh operation.
**/
SeahorseOperation*
-seahorse_key_source_load (SeahorseKeySource *sksrc, GQuark keyid)
+seahorse_source_load (SeahorseSource *sksrc, GQuark id)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
- klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
+ klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
g_return_val_if_fail (klass->load != NULL, NULL);
- return (*klass->load) (sksrc, keyid);
+ return (*klass->load) (sksrc, id);
}
/**
- * seahorse_key_source_load_sync
- * @sksrc: A #SeahorseKeySource object
- * @keyid: The key to refresh or 0 for all.
+ * seahorse_source_load_sync
+ * @sksrc: A #SeahorseSource object
+ * @id: The object to refresh or 0 for all.
*
- * Refreshes the #SeahorseKeySource's internal key listing, and waits for it to complete.
+ * Refreshes the #SeahorseSource's internal object listing, and waits for it to complete.
**/
void
-seahorse_key_source_load_sync (SeahorseKeySource *sksrc, GQuark keyid)
+seahorse_source_load_sync (SeahorseSource *sksrc, GQuark id)
{
- SeahorseOperation *op = seahorse_key_source_load (sksrc, keyid);
+ SeahorseOperation *op = seahorse_source_load (sksrc, id);
g_return_if_fail (op != NULL);
seahorse_operation_wait (op);
g_object_unref (op);
}
/**
- * seahorse_key_source_load_sync
- * @sksrc: A #SeahorseKeySource object
- * @keyid: The key to refresh or 0 for all.
+ * seahorse_source_load_sync
+ * @sksrc: A #SeahorseSource object
+ * @id: The object to refresh or 0 for all.
*
- * Refreshes the #SeahorseKeySource's internal key listing. Completes in the background.
+ * Refreshes the #SeahorseSource's internal object listing. Completes in the background.
**/
void
-seahorse_key_source_load_async (SeahorseKeySource *sksrc, GQuark keyid)
+seahorse_source_load_async (SeahorseSource *sksrc, GQuark id)
{
- SeahorseOperation *op = seahorse_key_source_load (sksrc, keyid);
+ SeahorseOperation *op = seahorse_source_load (sksrc, id);
g_return_if_fail (op != NULL);
g_object_unref (op);
}
/**
- * seahorse_key_source_search
- * @sksrc: A #SeahorseKeySource object
+ * seahorse_source_search
+ * @sksrc: A #SeahorseSource object
* @match: Text to search for
*
- * Refreshes the #SeahorseKeySource's internal key listing.
+ * Refreshes the #SeahorseSource's internal listing.
*
- * Returns the asynchronous key refresh operation.
+ * Returns the asynchronous refresh operation.
**/
SeahorseOperation*
-seahorse_key_source_search (SeahorseKeySource *sksrc, const gchar *match)
+seahorse_source_search (SeahorseSource *sksrc, const gchar *match)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
- klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
+ klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
g_return_val_if_fail (klass->search != NULL, NULL);
return (*klass->search) (sksrc, match);
}
SeahorseOperation*
-seahorse_key_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_source_import (SeahorseSource *sksrc, GInputStream *input)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
- klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
+ klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
g_return_val_if_fail (klass->import != NULL, NULL);
return (*klass->import) (sksrc, input);
}
gboolean
-seahorse_key_source_import_sync (SeahorseKeySource *sksrc, GInputStream *input,
- GError **err)
+seahorse_source_import_sync (SeahorseSource *sksrc, GInputStream *input,
+ GError **err)
{
SeahorseOperation *op;
gboolean ret;
g_return_val_if_fail (G_IS_INPUT_STREAM (input), FALSE);
- op = seahorse_key_source_import (sksrc, input);
+ op = seahorse_source_import (sksrc, input);
g_return_val_if_fail (op != NULL, FALSE);
seahorse_operation_wait (op);
@@ -178,31 +179,31 @@
}
SeahorseOperation*
-seahorse_key_source_export_keys (GList *keys, GOutputStream *output)
+seahorse_source_export_objects (GList *objects, GOutputStream *output)
{
SeahorseOperation *op = NULL;
SeahorseMultiOperation *mop = NULL;
- SeahorseKeySource *sksrc;
- SeahorseKey *skey;
+ SeahorseSource *sksrc;
+ SeahorseObject *sobj;
GList *next;
g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
g_object_ref (output);
- /* Sort by key source */
- keys = g_list_copy (keys);
- keys = seahorse_util_keylist_sort (keys);
+ /* Sort by object source */
+ objects = g_list_copy (objects);
+ objects = seahorse_util_objects_sort (objects);
- while (keys) {
+ while (objects) {
- /* Break off one set (same keysource) */
- next = seahorse_util_keylist_splice (keys);
+ /* Break off one set (same source) */
+ next = seahorse_util_objects_splice (objects);
- g_assert (SEAHORSE_IS_KEY (keys->data));
- skey = SEAHORSE_KEY (keys->data);
+ g_assert (SEAHORSE_IS_OBJECT (objects->data));
+ sobj = SEAHORSE_OBJECT (objects->data);
- /* Export from this key source */
- sksrc = seahorse_key_get_source (skey);
+ /* Export from this object source */
+ sksrc = seahorse_object_get_source (sobj);
g_return_val_if_fail (sksrc != NULL, FALSE);
if (op != NULL) {
@@ -212,11 +213,11 @@
}
/* We pass our own data object, to which data is appended */
- op = seahorse_key_source_export (sksrc, keys, FALSE, output);
+ op = seahorse_source_export (sksrc, objects, FALSE, output);
g_return_val_if_fail (op != NULL, FALSE);
- g_list_free (keys);
- keys = next;
+ g_list_free (objects);
+ objects = next;
}
if (mop) {
@@ -236,151 +237,139 @@
}
gboolean
-seahorse_key_source_delete_keys (GList *keys, GError **error)
+seahorse_source_delete_objects (GList *objects, GError **error)
{
- SeahorseKeySource *sksrc;
- SeahorseKey *skey;
- GList *next;
-
- /* Sort by key source */
- keys = g_list_copy (keys);
- keys = seahorse_util_keylist_sort (keys);
-
- while (keys) {
-
- /* Break off one set (same keysource) */
- next = seahorse_util_keylist_splice (keys);
+ GList *l;
+ SeahorseSource *sksrc;
+ SeahorseObject *sobj;
- g_assert (SEAHORSE_IS_KEY (keys->data));
- skey = SEAHORSE_KEY (keys->data);
+ for (l = objects; l; l = g_list_next (l)) {
+
+ g_assert (SEAHORSE_IS_OBJECT (l->data));
+ sobj = SEAHORSE_OBJECT (l->data);
- /* Export from this key source */
- sksrc = seahorse_key_get_source (skey);
+ /* Delete from this source */
+ sksrc = seahorse_object_get_source (sobj);
g_return_val_if_fail (sksrc != NULL, FALSE);
- if (!seahorse_key_source_remove (sksrc, skey, 0, error))
+ if (!seahorse_source_remove (sksrc, sobj, 0, error))
return FALSE;
-
- g_list_free (keys);
- keys = next;
}
return TRUE;
}
SeahorseOperation*
-seahorse_key_source_export (SeahorseKeySource *sksrc, GList *keys,
- gboolean complete, GOutputStream *output)
+seahorse_source_export (SeahorseSource *sksrc, GList *objects,
+ gboolean complete, GOutputStream *output)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
SeahorseOperation *op;
- GSList *keyids = NULL;
+ GSList *ids = NULL;
GList *l;
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
- klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+ klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
if (klass->export)
- return (*klass->export) (sksrc, keys, complete, output);
+ return (*klass->export) (sksrc, objects, complete, output);
/* Either export or export_raw must be implemented */
g_return_val_if_fail (klass->export_raw != NULL, NULL);
- for (l = keys; l; l = g_list_next (l))
- keyids = g_slist_prepend (keyids, GUINT_TO_POINTER (seahorse_key_get_keyid (l->data)));
+ for (l = objects; l; l = g_list_next (l))
+ ids = g_slist_prepend (ids, GUINT_TO_POINTER (seahorse_object_get_id (l->data)));
- keyids = g_slist_reverse (keyids);
- op = (*klass->export_raw) (sksrc, keyids, output);
- g_slist_free (keyids);
+ ids = g_slist_reverse (ids);
+ op = (*klass->export_raw) (sksrc, ids, output);
+ g_slist_free (ids);
return op;
}
SeahorseOperation*
-seahorse_key_source_export_raw (SeahorseKeySource *sksrc, GSList *keyids,
- GOutputStream *output)
+seahorse_source_export_raw (SeahorseSource *sksrc, GSList *ids, GOutputStream *output)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
SeahorseOperation *op;
- SeahorseKey *skey;
- GList *keys = NULL;
+ SeahorseObject *sobj;
+ GList *objects = NULL;
GSList *l;
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
- klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+ klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
/* Either export or export_raw must be implemented */
if (klass->export_raw)
- return (*klass->export_raw)(sksrc, keyids, output);
+ return (*klass->export_raw)(sksrc, ids, output);
g_return_val_if_fail (klass->export != NULL, NULL);
- for (l = keyids; l; l = g_slist_next (l)) {
- skey = seahorse_context_get_key (SCTX_APP (), sksrc, GPOINTER_TO_UINT (l->data));
+ for (l = ids; l; l = g_slist_next (l)) {
+ sobj = seahorse_context_get_object (SCTX_APP (), sksrc, GPOINTER_TO_UINT (l->data));
/* TODO: A proper error message here 'not found' */
- if (skey)
- keys = g_list_prepend (keys, skey);
+ if (sobj)
+ objects = g_list_prepend (objects, sobj);
}
- keys = g_list_reverse (keys);
- op = (*klass->export) (sksrc, keys, FALSE, output);
- g_list_free (keys);
+ objects = g_list_reverse (objects);
+ op = (*klass->export) (sksrc, objects, FALSE, output);
+ g_list_free (objects);
return op;
}
gboolean
-seahorse_key_source_remove (SeahorseKeySource *sksrc, SeahorseKey *skey,
- guint name, GError **error)
+seahorse_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj, guint name, GError **error)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
g_assert (!error || !*error);
- g_return_val_if_fail (seahorse_key_get_source (skey) == sksrc, FALSE);
+ g_return_val_if_fail (seahorse_object_get_source (sobj) == sksrc, FALSE);
- g_return_val_if_fail (SEAHORSE_IS_KEY_SOURCE (sksrc), FALSE);
- klass = SEAHORSE_KEY_SOURCE_GET_CLASS (sksrc);
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), FALSE);
+ klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
g_return_val_if_fail (klass->remove != NULL, FALSE);
- return (*klass->remove) (sksrc, skey, name, error);
+ return (*klass->remove) (sksrc, sobj, name, error);
}
GQuark
-seahorse_key_source_get_ktype (SeahorseKeySource *sksrc)
+seahorse_source_get_ktype (SeahorseSource *sksrc)
{
GQuark ktype;
g_object_get (sksrc, "key-type", &ktype, NULL);
return ktype;
}
-SeahorseKeyLoc
-seahorse_key_source_get_location (SeahorseKeySource *sksrc)
+SeahorseLocation
+seahorse_source_get_location (SeahorseSource *sksrc)
{
- SeahorseKeyLoc loc;
+ SeahorseLocation loc;
g_object_get (sksrc, "location", &loc, NULL);
return loc;
}
/* -----------------------------------------------------------------------------
- * CANONICAL KEYIDS
+ * CANONICAL IDS
*/
GQuark
-seahorse_key_source_canonize_keyid (GQuark ktype, const gchar *keyid)
+seahorse_source_canonize_id (GQuark ktype, const gchar *id)
{
- SeahorseKeySourceClass *klass;
+ SeahorseSourceClass *klass;
GType type;
- g_return_val_if_fail (keyid != NULL, 0);
+ g_return_val_if_fail (id != NULL, 0);
type = seahorse_registry_find_type (NULL, "key-source", g_quark_to_string (ktype), "local", NULL);
g_return_val_if_fail (type, 0);
- klass = SEAHORSE_KEY_SOURCE_CLASS (g_type_class_peek (type));
+ klass = SEAHORSE_SOURCE_CLASS (g_type_class_peek (type));
g_return_val_if_fail (klass, 0);
- g_return_val_if_fail (klass->canonize_keyid, 0);
- return (klass->canonize_keyid) (keyid);
+ g_return_val_if_fail (klass->canonize_id, 0);
+ return (klass->canonize_id) (id);
}
Copied: trunk/libseahorse/seahorse-source.h (from r2276, /trunk/libseahorse/seahorse-key-source.h)
==============================================================================
--- /trunk/libseahorse/seahorse-key-source.h (original)
+++ trunk/libseahorse/seahorse-source.h Thu Jul 17 01:41:51 2008
@@ -20,194 +20,196 @@
*/
/**
- * SeahorseKeySource: Base class for other key sources.
+ * SeahorseSource: Base class for other sources.
*
- * - A generic interface for accessing key sources.
+ * - A generic interface for accessing sources.
* - Eventually more functionality will be merged from seahorse-op.* into
* this class and derived classes.
- * - Each SeahorseKey has a weak pointer to the SeahorseKeySource that
+ * - Each SeahorseObject has a weak pointer to the SeahorseSource that
* created it.
*
* Properties base classes must implement:
- * ktype: (GQuark) The ktype (ie: SEAHORSE_PGP) of keys originating from this
- * key source.
+ * ktype: (GQuark) The ktype (ie: SEAHORSE_PGP) of objects originating from this
+ * object source.
* key-desc: (gchar*) Description for the type of keys originating here.
- * location: (SeahorseKeyLoc) The location of keys that come from this
- * source. (ie: SKEY_LOC_LOCAL, SKEY_LOC_REMOTE)
- * uri: (gchar*) Only for remote key sources. The full URI of the keyserver
+ * location: (SeahorseLocation) The location of objects that come from this
+ * source. (ie: SEAHORSE_LOCATION_LOCAL, SEAHORSE_LOCATION_REMOTE)
+ * uri: (gchar*) Only for remote object sources. The full URI of the keyserver
* being used.
*/
-#ifndef __SEAHORSE_KEY_SOURCE_H__
-#define __SEAHORSE_KEY_SOURCE_H__
+#ifndef __SEAHORSE_SOURCE_H__
+#define __SEAHORSE_SOURCE_H__
-#include "seahorse-key.h"
#include "seahorse-operation.h"
+#include "seahorse-types.h"
#include <gio/gio.h>
#include <glib-object.h>
-#define SEAHORSE_TYPE_KEY_SOURCE (seahorse_key_source_get_type ())
-#define SEAHORSE_KEY_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_KEY_SOURCE, SeahorseKeySource))
-#define SEAHORSE_KEY_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_KEY_SOURCE, SeahorseKeySourceClass))
-#define SEAHORSE_IS_KEY_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_KEY_SOURCE))
-#define SEAHORSE_IS_KEY_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_KEY_SOURCE))
-#define SEAHORSE_KEY_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_KEY_SOURCE, SeahorseKeySourceClass))
+#define SEAHORSE_TYPE_SOURCE (seahorse_source_get_type ())
+#define SEAHORSE_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_SOURCE, SeahorseSource))
+#define SEAHORSE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_SOURCE, SeahorseSourceClass))
+#define SEAHORSE_IS_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_SOURCE))
+#define SEAHORSE_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_SOURCE))
+#define SEAHORSE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_SOURCE, SeahorseSourceClass))
-typedef struct _SeahorseKeySource {
+struct _SeahorseObject;
+
+typedef struct _SeahorseSource {
GObject parent;
-} SeahorseKeySource;
+} SeahorseSource;
-typedef struct _SeahorseKeySourceClass {
+typedef struct _SeahorseSourceClass {
GtkObjectClass parent_class;
/* class props ----------------------------------------------------- */
- const GQuark key_type;
+ const GQuark obj_tag;
const gchar *display_name;
const gchar **mime_types;
/* class methods --------------------------------------------------- */
- GQuark (*canonize_keyid) (const gchar *keyid);
+ GQuark (*canonize_id) (const gchar *id);
/* virtual methods ------------------------------------------------- */
/**
* load
- * @sksrc: The #SeahorseKeySource.
- * @keyid: The key to load or 0 for all the keys.
+ * @sksrc: The #SeahorseSource.
+ * @id: The object to load or 0 for all the objects.
*
- * Loads the requested keys, and add the keys to SeahorseContext.
+ * Loads the requested objects, and add the objects to SeahorseContext.
*
* Returns: The load operation.
*/
- SeahorseOperation* (*load) (SeahorseKeySource *sksrc, GQuark keyid);
+ SeahorseOperation* (*load) (SeahorseSource *sksrc, GQuark id);
/**
* search
- * @sksrc: The #SeahorseKeySource
+ * @sksrc: The #SeahorseSource
* @match: Match text
*
- * Searches for keys in the key source.
+ * Searches for objects in the source.
*
* Returns: The search operation.
*/
- SeahorseOperation* (*search) (SeahorseKeySource *sksrc, const gchar *match);
+ SeahorseOperation* (*search) (SeahorseSource *sksrc, const gchar *match);
/**
* import
- * @sksrc: The #SeahorseKeySource to import into.
+ * @sksrc: The #SeahorseSource to import into.
* @input: The data to import.
*
- * Import keys into the key source. When operation is 'done' a GList of
- * updated keys may be found as the operation result.
+ * Import objects into the source. When operation is 'done' a GList of
+ * updated objects may be found as the operation result.
*
* Returns: The import operation
*/
- SeahorseOperation* (*import) (SeahorseKeySource *sksrc, GInputStream *input);
+ SeahorseOperation* (*import) (SeahorseSource *sksrc, GInputStream *input);
/**
* export
- * @sksrc: The #SeahorseKeySource to export from.
- * @keys: A list of keys to export.
- * @complete: Whether to export the secret key too.
+ * @sksrc: The #SeahorseSource to export from.
+ * @objects: A list of objects to export.
+ * @complete: Whether to export the secret objects too.
* @data: Output stream to export to.
*
- * Import keys into the key source. When operation is 'done' the result
+ * Import objects into the object source. When operation is 'done' the result
* of the operation will be a GOutputStream
*
* Returns: The export operation
*/
- SeahorseOperation* (*export) (SeahorseKeySource *sksrc, GList *keys,
+ SeahorseOperation* (*export) (SeahorseSource *sksrc, GList *objects,
gboolean complete, GOutputStream *output);
/**
* export_raw
- * @sksrc: The #SeahorseKeySource to export from.
- * @keys: A list of key ids to export.
+ * @sksrc: The #SeahorseSource to export from.
+ * @objects: A list of ids to export.
* @data: output stream to export to.
*
- * Import keys into the key source. When operation is 'done' the result
+ * Import objects into the source. When operation is 'done' the result
* of the operation will be a GOutputStream
*
* Returns: The export operation
*/
- SeahorseOperation* (*export_raw) (SeahorseKeySource *sksrc, GSList *keyids,
+ SeahorseOperation* (*export_raw) (SeahorseSource *sksrc, GSList *ids,
GOutputStream *output);
/**
* remove
- * @sksrc: The #SeahorseKeySource to delete the key from.
- * @key: A key to delete.
- * @name: UID/name to delete, or 0 for main key.
+ * @sksrc: The #SeahorseSource to delete the object from.
+ * @object: A object to delete.
+ * @name: UID/name to delete, or 0 for main object.
* @error: Error code when not successful.
*
- * Delete the keys from the key source.
+ * Delete the objects from the object source.
*
* Returns: Whether successful or not.
*/
- gboolean (*remove) (SeahorseKeySource *sksrc, SeahorseKey *skey,
+ gboolean (*remove) (SeahorseSource *sksrc, struct _SeahorseObject *sobj,
guint name, GError **error);
-} SeahorseKeySourceClass;
+} SeahorseSourceClass;
-GType seahorse_key_source_get_type (void);
+GType seahorse_source_get_type (void);
/* Method helper functions ------------------------------------------- */
-SeahorseOperation* seahorse_key_source_load (SeahorseKeySource *sksrc,
- GQuark keyid);
+SeahorseOperation* seahorse_source_load (SeahorseSource *sksrc,
+ GQuark id);
-void seahorse_key_source_load_sync (SeahorseKeySource *sksrc,
- GQuark keyid);
+void seahorse_source_load_sync (SeahorseSource *sksrc,
+ GQuark keyid);
-void seahorse_key_source_load_async (SeahorseKeySource *sksrc,
- GQuark keyid);
+void seahorse_source_load_async (SeahorseSource *sksrc,
+ GQuark id);
-SeahorseOperation* seahorse_key_source_search (SeahorseKeySource *sksrc,
- const gchar *match);
+SeahorseOperation* seahorse_source_search (SeahorseSource *sksrc,
+ const gchar *match);
/* Takes ownership of |data| */
-SeahorseOperation* seahorse_key_source_import (SeahorseKeySource *sksrc,
- GInputStream *input);
+SeahorseOperation* seahorse_source_import (SeahorseSource *sksrc,
+ GInputStream *input);
/* Takes ownership of |data| */
-gboolean seahorse_key_source_import_sync (SeahorseKeySource *sksrc,
- GInputStream *input,
- GError **err);
+gboolean seahorse_source_import_sync (SeahorseSource *sksrc,
+ GInputStream *input,
+ GError **err);
-SeahorseOperation* seahorse_key_source_export_keys (GList *keys,
- GOutputStream *output);
+SeahorseOperation* seahorse_source_export_objects (GList *objects,
+ GOutputStream *output);
-gboolean seahorse_key_source_delete_keys (GList *keys,
- GError **error);
+gboolean seahorse_source_delete_objects (GList *objects,
+ GError **error);
-SeahorseOperation* seahorse_key_source_export (SeahorseKeySource *sksrc,
- GList *keys,
- gboolean complete,
- GOutputStream *output);
+SeahorseOperation* seahorse_source_export (SeahorseSource *sksrc,
+ GList *objects,
+ gboolean complete,
+ GOutputStream *output);
-SeahorseOperation* seahorse_key_source_export_raw (SeahorseKeySource *sksrc,
- GSList *keyids,
- GOutputStream *output);
+SeahorseOperation* seahorse_source_export_raw (SeahorseSource *sksrc,
+ GSList *ids,
+ GOutputStream *output);
-gboolean seahorse_key_source_remove (SeahorseKeySource *sksrc,
- SeahorseKey *skey,
- guint name,
- GError **error);
+gboolean seahorse_source_remove (SeahorseSource *sksrc,
+ struct _SeahorseObject *sobj,
+ guint name,
+ GError **error);
-GQuark seahorse_key_source_get_ktype (SeahorseKeySource *sksrc);
+GQuark seahorse_source_get_ktype (SeahorseSource *sksrc);
-SeahorseKeyLoc seahorse_key_source_get_location (SeahorseKeySource *sksrc);
+SeahorseLocation seahorse_source_get_location (SeahorseSource *sksrc);
-GQuark seahorse_key_source_canonize_keyid (GQuark ktype,
- const gchar *keyid);
+GQuark seahorse_source_canonize_id (GQuark ktype,
+ const gchar *id);
-GQuark seahorse_key_source_mime_to_ktype (const gchar *mimetype);
+GQuark seahorse_source_mime_to_ktype (const gchar *mimetype);
-const gchar* seahorse_key_source_type_get_description (GType type);
+const gchar* seahorse_source_type_get_description (GType type);
-#endif /* __SEAHORSE_KEY_SOURCE_H__ */
+#endif /* __SEAHORSE_SOURCE_H__ */
Modified: trunk/libseahorse/seahorse-transfer-operation.c
==============================================================================
--- trunk/libseahorse/seahorse-transfer-operation.c (original)
+++ trunk/libseahorse/seahorse-transfer-operation.c Thu Jul 17 01:41:51 2008
@@ -66,11 +66,11 @@
g_object_class_install_property (gobject_class, PROP_FROM_KEY_SOURCE,
g_param_spec_object ("from-key-source", "From key source", "Key source keys are being transferred from",
- SEAHORSE_TYPE_KEY_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ SEAHORSE_TYPE_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_TO_KEY_SOURCE,
g_param_spec_object ("to-key-source", "To key source", "Key source keys are being transferred to",
- SEAHORSE_TYPE_KEY_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ SEAHORSE_TYPE_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_MESSAGE,
g_param_spec_string ("message", "Progress Message", "Progress message that overrides whatever GPGME gives us",
@@ -198,7 +198,7 @@
g_return_if_fail (input);
/* This frees data */
- pv->operation = seahorse_key_source_import (top->to, input);
+ pv->operation = seahorse_source_import (top->to, input);
g_return_if_fail (pv->operation != NULL);
g_object_unref (input);
@@ -217,7 +217,7 @@
start_transfer (SeahorseTransferOperation *top)
{
SeahorseTransferOperationPrivate *pv = SEAHORSE_TRANSFER_OPERATION_GET_PRIVATE (top);
- SeahorseKeySource *from;
+ SeahorseSource *from;
GSList *keyids;
g_assert (pv->operation == NULL);
@@ -227,7 +227,7 @@
g_assert (keyids && from);
pv = SEAHORSE_TRANSFER_OPERATION_GET_PRIVATE (top);
- pv->operation = seahorse_key_source_export_raw (from, keyids, G_OUTPUT_STREAM (pv->output));
+ pv->operation = seahorse_source_export_raw (from, keyids, G_OUTPUT_STREAM (pv->output));
g_return_val_if_fail (pv->operation != NULL, FALSE);
seahorse_operation_watch (pv->operation, (SeahorseDoneFunc) export_done, top,
@@ -356,8 +356,8 @@
*/
SeahorseOperation*
-seahorse_transfer_operation_new (const gchar *message, SeahorseKeySource *from,
- SeahorseKeySource *to, GSList *keyids)
+seahorse_transfer_operation_new (const gchar *message, SeahorseSource *from,
+ SeahorseSource *to, GSList *keyids)
{
SeahorseTransferOperation *top;
Modified: trunk/libseahorse/seahorse-transfer-operation.h
==============================================================================
--- trunk/libseahorse/seahorse-transfer-operation.h (original)
+++ trunk/libseahorse/seahorse-transfer-operation.h Thu Jul 17 01:41:51 2008
@@ -28,15 +28,15 @@
* - Import them into the 'to' key source.
*
* Properties:
- * from-key-source: (SeahorseKeySource) From key source
- * to-key-source: (SeahorseKeySource) To key source
+ * from-key-source: (SeahorseSource) From key source
+ * to-key-source: (SeahorseSource) To key source
*/
#ifndef __SEAHORSE_TRANSFER_OPERATION_H__
#define __SEAHORSE_TRANSFER_OPERATION_H__
#include "seahorse-operation.h"
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#define SEAHORSE_TYPE_TRANSFER_OPERATION (seahorse_transfer_operation_get_type ())
#define SEAHORSE_TRANSFER_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_TRANSFER_OPERATION, SeahorseTransferOperation))
@@ -47,13 +47,13 @@
DECLARE_OPERATION (Transfer, transfer)
/*< public >*/
- SeahorseKeySource *from;
- SeahorseKeySource *to;
+ SeahorseSource *from;
+ SeahorseSource *to;
END_DECLARE_OPERATION
SeahorseOperation* seahorse_transfer_operation_new (const gchar *message,
- SeahorseKeySource *from,
- SeahorseKeySource *to,
+ SeahorseSource *from,
+ SeahorseSource *to,
GSList *keyids);
#endif /* __SEAHORSE_TRANSFER_OPERATION_H__ */
Added: trunk/libseahorse/seahorse-types.c
==============================================================================
--- (empty file)
+++ trunk/libseahorse/seahorse-types.c Thu Jul 17 01:41:51 2008
@@ -0,0 +1,33 @@
+
+#include <seahorse-types.h>
+
+
+
+
+
+
+
+
+GType seahorse_location_get_type (void) {
+ static GType seahorse_location_type_id = 0;
+ if (G_UNLIKELY (seahorse_location_type_id == 0)) {
+ static const GEnumValue values[] = {{SEAHORSE_LOCATION_INVALID, "SEAHORSE_LOCATION_INVALID", "invalid"}, {SEAHORSE_LOCATION_MISSING, "SEAHORSE_LOCATION_MISSING", "missing"}, {SEAHORSE_LOCATION_SEARCHING, "SEAHORSE_LOCATION_SEARCHING", "searching"}, {SEAHORSE_LOCATION_REMOTE, "SEAHORSE_LOCATION_REMOTE", "remote"}, {SEAHORSE_LOCATION_LOCAL, "SEAHORSE_LOCATION_LOCAL", "local"}, {0, NULL, NULL}};
+ seahorse_location_type_id = g_enum_register_static ("SeahorseLocation", values);
+ }
+ return seahorse_location_type_id;
+}
+
+
+
+GType seahorse_usage_get_type (void) {
+ static GType seahorse_usage_type_id = 0;
+ if (G_UNLIKELY (seahorse_usage_type_id == 0)) {
+ static const GEnumValue values[] = {{SEAHORSE_USAGE_NONE, "SEAHORSE_USAGE_NONE", "none"}, {SEAHORSE_USAGE_SYMMETRIC_KEY, "SEAHORSE_USAGE_SYMMETRIC_KEY", "symmetric-key"}, {SEAHORSE_USAGE_PUBLIC_KEY, "SEAHORSE_USAGE_PUBLIC_KEY", "public-key"}, {SEAHORSE_USAGE_PRIVATE_KEY, "SEAHORSE_USAGE_PRIVATE_KEY", "private-key"}, {SEAHORSE_USAGE_CREDENTIALS, "SEAHORSE_USAGE_CREDENTIALS", "credentials"}, {SEAHORSE_USAGE_OTHER, "SEAHORSE_USAGE_OTHER", "other"}, {0, NULL, NULL}};
+ seahorse_usage_type_id = g_enum_register_static ("SeahorseUsage", values);
+ }
+ return seahorse_usage_type_id;
+}
+
+
+
+
Added: trunk/libseahorse/seahorse-types.h
==============================================================================
--- (empty file)
+++ trunk/libseahorse/seahorse-types.h Thu Jul 17 01:41:51 2008
@@ -0,0 +1,44 @@
+
+#ifndef __SEAHORSE_TYPES_H__
+#define __SEAHORSE_TYPES_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+
+#define SEAHORSE_TYPE_LOCATION (seahorse_location_get_type ())
+
+#define SEAHORSE_TYPE_USAGE (seahorse_usage_get_type ())
+
+/*
+ * These types should never change. These values are exported via DBUS. In the
+ * case of a key being in multiple locations, the highest location always 'wins'.
+ */
+typedef enum {
+ SEAHORSE_LOCATION_INVALID = 0,
+ SEAHORSE_LOCATION_MISSING = 10,
+ SEAHORSE_LOCATION_SEARCHING = 20,
+ SEAHORSE_LOCATION_REMOTE = 50,
+ SEAHORSE_LOCATION_LOCAL = 100
+} SeahorseLocation;
+
+/* Again, never change these values */
+typedef enum {
+ SEAHORSE_USAGE_NONE = 0,
+ SEAHORSE_USAGE_SYMMETRIC_KEY = 1,
+ SEAHORSE_USAGE_PUBLIC_KEY = 2,
+ SEAHORSE_USAGE_PRIVATE_KEY = 3,
+ SEAHORSE_USAGE_CREDENTIALS = 4,
+ SEAHORSE_USAGE_OTHER = 10
+} SeahorseUsage;
+
+
+GType seahorse_location_get_type (void);
+GType seahorse_usage_get_type (void);
+
+
+G_END_DECLS
+
+#endif
Added: trunk/libseahorse/seahorse-types.vala
==============================================================================
--- (empty file)
+++ trunk/libseahorse/seahorse-types.vala Thu Jul 17 01:41:51 2008
@@ -0,0 +1,24 @@
+
+namespace Seahorse {
+ /*
+ * These types should never change. These values are exported via DBUS. In the
+ * case of a key being in multiple locations, the highest location always 'wins'.
+ */
+ public enum Location {
+ INVALID = 0,
+ MISSING = 10,
+ SEARCHING = 20,
+ REMOTE = 50,
+ LOCAL = 100
+ }
+
+ /* Again, never change these values */
+ public enum Usage {
+ NONE = 0,
+ SYMMETRIC_KEY = 1,
+ PUBLIC_KEY = 2,
+ PRIVATE_KEY = 3,
+ CREDENTIALS = 4,
+ OTHER = 10
+ }
+}
Modified: trunk/libseahorse/seahorse-unknown-key.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-key.c (original)
+++ trunk/libseahorse/seahorse-unknown-key.c Thu Jul 17 01:41:51 2008
@@ -55,16 +55,18 @@
seahorse_unknown_key_constructor (GType type, guint n_props, GObjectConstructParam* props)
{
SeahorseKey *skey;
+ SeahorseObject *sobj;
GObject *obj;
obj = G_OBJECT_CLASS (seahorse_unknown_key_parent_class)->constructor (type, n_props, props);
skey = SEAHORSE_KEY (obj);
+ sobj = SEAHORSE_OBJECT (obj);
- if (skey->sksrc)
- skey->ktype = seahorse_key_source_get_ktype (skey->sksrc);
- skey->location = SKEY_LOC_UNKNOWN;
+ if (seahorse_object_get_source (sobj))
+ sobj->_tag = seahorse_source_get_ktype (seahorse_object_get_source (sobj));
+ sobj->_location = SEAHORSE_LOCATION_MISSING;
skey->loaded = SKEY_INFO_NONE;
- skey->etype = SKEY_ETYPE_NONE;
+ sobj->_usage = SEAHORSE_USAGE_NONE;
skey->keydesc = _("Unavailable");
return obj;
}
@@ -142,14 +144,14 @@
seahorse_unknown_key_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
- SeahorseUnknownKey *ukey = SEAHORSE_UNKNOWN_KEY (object);
+ SeahorseUnknownKey *ukey = SEAHORSE_UNKNOWN_KEY (object);
- switch (prop_id) {
- case PROP_KEYID:
- ukey->keyid = g_value_get_uint (value);
- SEAHORSE_KEY (ukey)->keyid = ukey->keyid;
- break;
- }
+ switch (prop_id) {
+ case PROP_KEYID:
+ ukey->keyid = g_value_get_uint (value);
+ SEAHORSE_OBJECT (ukey)->_id = ukey->keyid;
+ break;
+ }
}
static void
@@ -225,9 +227,5 @@
ukey = g_object_new (SEAHORSE_TYPE_UNKNOWN_KEY, "key-source", sksrc,
"key-id", keyid, NULL);
-
- /* We don't care about this floating business */
- g_object_ref (GTK_OBJECT (ukey));
- gtk_object_sink (GTK_OBJECT (ukey));
return ukey;
}
Modified: trunk/libseahorse/seahorse-unknown-source.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.c (original)
+++ trunk/libseahorse/seahorse-unknown-source.c Thu Jul 17 01:41:51 2008
@@ -36,16 +36,16 @@
PROP_LOCATION
};
-G_DEFINE_TYPE (SeahorseUnknownSource, seahorse_unknown_source, SEAHORSE_TYPE_KEY_SOURCE);
+G_DEFINE_TYPE (SeahorseUnknownSource, seahorse_unknown_source, SEAHORSE_TYPE_SOURCE);
/* -----------------------------------------------------------------------------
* INTERNAL
*/
static void
-search_done (SeahorseOperation *op, SeahorseKey *skey)
+search_done (SeahorseOperation *op, SeahorseObject *sobj)
{
- skey->location = SKEY_LOC_UNKNOWN;
+ g_object_set (sobj, "location", SEAHORSE_LOCATION_MISSING, NULL);
}
/* -----------------------------------------------------------------------------
@@ -53,30 +53,30 @@
*/
static SeahorseOperation*
-seahorse_unknown_source_load (SeahorseKeySource *src, GQuark keyid)
+seahorse_unknown_source_load (SeahorseSource *src, GQuark id)
{
SeahorseUnknownSource *usrc;
g_assert (SEAHORSE_IS_UNKNOWN_SOURCE (src));
usrc = SEAHORSE_UNKNOWN_SOURCE (src);
- if (keyid) {
- g_return_val_if_fail (keyid, NULL);
- seahorse_unknown_source_add_key (usrc, keyid, NULL);
+ if (id) {
+ g_return_val_if_fail (id, NULL);
+ seahorse_unknown_source_add_object (usrc, id, NULL);
}
return seahorse_operation_new_complete (NULL);
}
static SeahorseOperation*
-seahorse_unknown_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_unknown_source_import (SeahorseSource *sksrc, GInputStream *input)
{
g_return_val_if_reached (NULL);
return NULL;
}
static SeahorseOperation*
-seahorse_unknown_source_export_raw (SeahorseKeySource *sksrc, GSList *keyids,
+seahorse_unknown_source_export_raw (SeahorseSource *sksrc, GSList *ids,
GOutputStream *output)
{
g_return_val_if_reached (NULL);
@@ -84,11 +84,11 @@
}
static gboolean
-seahorse_unknown_source_remove (SeahorseKeySource *sksrc, SeahorseKey *skey,
+seahorse_unknown_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
guint name, GError **error)
{
- g_return_val_if_fail (sksrc == seahorse_key_get_source (skey), FALSE);
- seahorse_key_destroy (skey);
+ g_return_val_if_fail (sksrc == seahorse_object_get_source (sobj), FALSE);
+ seahorse_context_remove_object (SCTX_APP (), sobj);
return TRUE;
}
@@ -119,7 +119,7 @@
g_value_set_string (value, _("Unavailable Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SKEY_LOC_UNKNOWN);
+ g_value_set_uint (value, SEAHORSE_LOCATION_MISSING);
break;
}
}
@@ -134,7 +134,7 @@
seahorse_unknown_source_class_init (SeahorseUnknownSourceClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseKeySourceClass *parent_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
+ SeahorseSourceClass *parent_class = SEAHORSE_SOURCE_CLASS (klass);
seahorse_unknown_source_parent_class = g_type_class_peek_parent (klass);
@@ -155,8 +155,8 @@
NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseKeyLoc",
- 0, G_MAXUINT, SKEY_LOC_INVALID, G_PARAM_READABLE));
+ g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
+ 0, G_MAXUINT, SEAHORSE_LOCATION_MISSING, G_PARAM_READABLE));
seahorse_registry_register_type (NULL, SEAHORSE_TYPE_UNKNOWN_SOURCE, "key-source", NULL);
}
@@ -171,24 +171,24 @@
return g_object_new (SEAHORSE_TYPE_UNKNOWN_SOURCE, "key-type", ktype, NULL);
}
-SeahorseKey*
-seahorse_unknown_source_add_key (SeahorseUnknownSource *usrc, GQuark keyid,
- SeahorseOperation *search)
-{
- SeahorseKey *skey;
-
- g_return_val_if_fail (keyid != 0, NULL);
-
- skey = seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (usrc), keyid);
- if (!skey) {
- skey = SEAHORSE_KEY (seahorse_unknown_key_new (usrc, keyid));
- seahorse_context_add_key (SCTX_APP (), skey);
+SeahorseObject*
+seahorse_unknown_source_add_object (SeahorseUnknownSource *usrc, GQuark id,
+ SeahorseOperation *search)
+{
+ SeahorseObject *sobj;
+
+ g_return_val_if_fail (id != 0, NULL);
+
+ sobj = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (usrc), id);
+ if (!sobj) {
+ sobj = SEAHORSE_OBJECT (seahorse_unknown_key_new (usrc, id));
+ seahorse_context_add_object (SCTX_APP (), sobj);
}
if (search) {
- skey->location = SKEY_LOC_SEARCHING;
- seahorse_operation_watch (search, (SeahorseDoneFunc) search_done, skey, NULL, NULL);
+ sobj->_location = SEAHORSE_LOCATION_SEARCHING;
+ seahorse_operation_watch (search, (SeahorseDoneFunc) search_done, sobj, NULL, NULL);
}
- return skey;
+ return sobj;
}
Modified: trunk/libseahorse/seahorse-unknown-source.h
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.h (original)
+++ trunk/libseahorse/seahorse-unknown-source.h Thu Jul 17 01:41:51 2008
@@ -20,22 +20,23 @@
*/
/**
- * SeahorseUnknownSource: A key source for unknown keys
+ * SeahorseUnknownSource: A source for unknown objects
*
- * - Derived from SeahorseKeySource
- * - Is used for keys that haven't been found on a key server.
+ * - Derived from SeahorseSource
+ * - Is used for objects that haven't been found on a key server.
*
* Properties:
* ktype: (GQuark) The ktype (ie: SKEY_UNKNOWN) of keys originating from this
key source.
- * location: (SeahorseKeyLoc) The location of keys that come from this
- * source. (ie: SKEY_LOC_UNKNOWN)
+ * location: (SeahorseLocation) The location of objects that come from this
+ * source. (ie: SEAHORSE_LOCATION_MISSING)
*/
#ifndef __SEAHORSE_UNKNOWN_SOURCE_H__
#define __SEAHORSE_UNKNOWN_SOURCE_H__
-#include "seahorse-key-source.h"
+#include "seahorse-object.h"
+#include "seahorse-source.h"
#define SEAHORSE_TYPE_UNKNOWN_SOURCE (seahorse_unknown_source_get_type ())
#define SEAHORSE_UNKNOWN_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_UNKNOWN_SOURCE, SeahorseUnknownSource))
@@ -49,22 +50,22 @@
typedef struct _SeahorseUnknownSourcePrivate SeahorseUnknownSourcePrivate;
struct _SeahorseUnknownSource {
- SeahorseKeySource parent;
+ SeahorseSource parent;
/* <public> */
GQuark ktype;
};
struct _SeahorseUnknownSourceClass {
- SeahorseKeySourceClass parent_class;
+ SeahorseSourceClass parent_class;
};
GType seahorse_unknown_source_get_type (void);
SeahorseUnknownSource* seahorse_unknown_source_new (GQuark ktype);
-SeahorseKey* seahorse_unknown_source_add_key (SeahorseUnknownSource *usrc,
- GQuark keyid,
+SeahorseObject* seahorse_unknown_source_add_object (SeahorseUnknownSource *usrc,
+ GQuark id,
SeahorseOperation *search);
#endif /* __SEAHORSE_UNKNOWN_SOURCE_H__ */
Modified: trunk/libseahorse/seahorse-util.c
==============================================================================
--- trunk/libseahorse/seahorse-util.c (original)
+++ trunk/libseahorse/seahorse-util.c Thu Jul 17 01:41:51 2008
@@ -1045,15 +1045,15 @@
}
static gint
-sort_keys_by_source (SeahorseKey *k1, SeahorseKey *k2)
+sort_objects_by_source (SeahorseObject *k1, SeahorseObject *k2)
{
- SeahorseKeySource *sk1, *sk2;
+ SeahorseSource *sk1, *sk2;
- g_assert (SEAHORSE_IS_KEY (k1));
- g_assert (SEAHORSE_IS_KEY (k2));
+ g_assert (SEAHORSE_IS_OBJECT (k1));
+ g_assert (SEAHORSE_IS_OBJECT (k2));
- sk1 = seahorse_key_get_source (k1);
- sk2 = seahorse_key_get_source (k2);
+ sk1 = seahorse_object_get_source (k1);
+ sk2 = seahorse_object_get_source (k2);
if (sk1 == sk2)
return 0;
@@ -1062,24 +1062,24 @@
}
GList*
-seahorse_util_keylist_sort (GList *keys)
+seahorse_util_objects_sort (GList *objects)
{
- return g_list_sort (keys, (GCompareFunc)sort_keys_by_source);
+ return g_list_sort (objects, (GCompareFunc)sort_objects_by_source);
}
GList*
-seahorse_util_keylist_splice (GList *keys)
+seahorse_util_objects_splice (GList *objects)
{
- SeahorseKeySource *psk = NULL;
- SeahorseKeySource *sk;
+ SeahorseSource *psk = NULL;
+ SeahorseSource *sk;
GList *prev = NULL;
- /* Note that the keylist must be sorted */
+ /* Note that the objects must be sorted */
- for ( ; keys; keys = g_list_next (keys)) {
+ for ( ; objects; objects = g_list_next (objects)) {
- g_return_val_if_fail (SEAHORSE_IS_KEY (keys->data), NULL);
- sk = seahorse_key_get_source (SEAHORSE_KEY (keys->data));
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (objects->data), NULL);
+ sk = seahorse_object_get_source (SEAHORSE_OBJECT (objects->data));
/* Found a disconuity */
if (psk && sk != psk) {
@@ -1089,11 +1089,11 @@
prev->next = NULL;
/* And return the new list */
- return keys;
+ return objects;
}
psk = sk;
- prev = keys;
+ prev = objects;
}
return NULL;
Modified: trunk/libseahorse/seahorse-util.h
==============================================================================
--- trunk/libseahorse/seahorse-util.h (original)
+++ trunk/libseahorse/seahorse-util.h Thu Jul 17 01:41:51 2008
@@ -139,9 +139,9 @@
guint seahorse_util_strvec_length (const gchar **vec);
-GList* seahorse_util_keylist_sort (GList *keys);
+GList* seahorse_util_objects_sort (GList *objects);
-GList* seahorse_util_keylist_splice (GList *keys);
+GList* seahorse_util_objects_splice (GList *objects);
gboolean seahorse_util_string_equals (const gchar *s1, const gchar *s2);
Modified: trunk/libseahorse/seahorse-view.c
==============================================================================
--- trunk/libseahorse/seahorse-view.c (original)
+++ trunk/libseahorse/seahorse-view.c Thu Jul 17 01:41:51 2008
@@ -27,24 +27,24 @@
-GList* seahorse_view_get_selected_keys (SeahorseView* self) {
- return SEAHORSE_VIEW_GET_INTERFACE (self)->get_selected_keys (self);
+GList* seahorse_view_get_selected_objects (SeahorseView* self) {
+ return SEAHORSE_VIEW_GET_INTERFACE (self)->get_selected_objects (self);
}
-void seahorse_view_set_selected_keys (SeahorseView* self, GList* keys) {
- SEAHORSE_VIEW_GET_INTERFACE (self)->set_selected_keys (self, keys);
+void seahorse_view_set_selected_objects (SeahorseView* self, GList* objects) {
+ SEAHORSE_VIEW_GET_INTERFACE (self)->set_selected_objects (self, objects);
}
-SeahorseKey* seahorse_view_get_selected_key_and_uid (SeahorseView* self, guint* uid) {
- return SEAHORSE_VIEW_GET_INTERFACE (self)->get_selected_key_and_uid (self, uid);
+SeahorseObject* seahorse_view_get_selected_object_and_uid (SeahorseView* self, guint* uid) {
+ return SEAHORSE_VIEW_GET_INTERFACE (self)->get_selected_object_and_uid (self, uid);
}
-SeahorseKey* seahorse_view_get_selected_key (SeahorseView* self) {
- SeahorseKey* value;
- g_object_get (G_OBJECT (self), "selected-key", &value, NULL);
+SeahorseObject* seahorse_view_get_selected (SeahorseView* self) {
+ SeahorseObject* value;
+ g_object_get (G_OBJECT (self), "selected", &value, NULL);
if (value != NULL) {
g_object_unref (value);
}
@@ -52,14 +52,14 @@
}
-void seahorse_view_set_selected_key (SeahorseView* self, SeahorseKey* value) {
- g_object_set (G_OBJECT (self), "selected-key", value, NULL);
+void seahorse_view_set_selected (SeahorseView* self, SeahorseObject* value) {
+ g_object_set (G_OBJECT (self), "selected", value, NULL);
}
-SeahorseKeyset* seahorse_view_get_current_keyset (SeahorseView* self) {
- SeahorseKeyset* value;
- g_object_get (G_OBJECT (self), "current-keyset", &value, NULL);
+SeahorseSet* seahorse_view_get_current_set (SeahorseView* self) {
+ SeahorseSet* value;
+ g_object_get (G_OBJECT (self), "current-set", &value, NULL);
if (value != NULL) {
g_object_unref (value);
}
@@ -81,8 +81,8 @@
static gboolean initialized = FALSE;
if (!initialized) {
initialized = TRUE;
- g_object_interface_install_property (iface, g_param_spec_object ("selected-key", "selected-key", "selected-key", SEAHORSE_TYPE_KEY, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
- g_object_interface_install_property (iface, g_param_spec_object ("current-keyset", "current-keyset", "current-keyset", SEAHORSE_TYPE_KEYSET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
+ g_object_interface_install_property (iface, g_param_spec_object ("selected", "selected", "selected", SEAHORSE_TYPE_OBJECT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_interface_install_property (iface, g_param_spec_object ("current-set", "current-set", "current-set", SEAHORSE_TYPE_SET, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_object_interface_install_property (iface, g_param_spec_object ("window", "window", "window", GTK_TYPE_WINDOW, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_signal_new ("selection_changed", SEAHORSE_TYPE_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
Modified: trunk/libseahorse/seahorse-view.h
==============================================================================
--- trunk/libseahorse/seahorse-view.h (original)
+++ trunk/libseahorse/seahorse-view.h Thu Jul 17 01:41:51 2008
@@ -24,9 +24,9 @@
#include <glib.h>
#include <glib-object.h>
-#include <seahorse-key.h>
-#include <seahorse-keyset.h>
+#include <seahorse-set.h>
#include <gtk/gtk.h>
+#include <seahorse-object.h>
G_BEGIN_DECLS
@@ -41,18 +41,18 @@
struct _SeahorseViewIface {
GTypeInterface parent_iface;
- GList* (*get_selected_keys) (SeahorseView* self);
- void (*set_selected_keys) (SeahorseView* self, GList* keys);
- SeahorseKey* (*get_selected_key_and_uid) (SeahorseView* self, guint* uid);
+ GList* (*get_selected_objects) (SeahorseView* self);
+ void (*set_selected_objects) (SeahorseView* self, GList* objects);
+ SeahorseObject* (*get_selected_object_and_uid) (SeahorseView* self, guint* uid);
};
-GList* seahorse_view_get_selected_keys (SeahorseView* self);
-void seahorse_view_set_selected_keys (SeahorseView* self, GList* keys);
-SeahorseKey* seahorse_view_get_selected_key_and_uid (SeahorseView* self, guint* uid);
-SeahorseKey* seahorse_view_get_selected_key (SeahorseView* self);
-void seahorse_view_set_selected_key (SeahorseView* self, SeahorseKey* value);
-SeahorseKeyset* seahorse_view_get_current_keyset (SeahorseView* self);
+GList* seahorse_view_get_selected_objects (SeahorseView* self);
+void seahorse_view_set_selected_objects (SeahorseView* self, GList* objects);
+SeahorseObject* seahorse_view_get_selected_object_and_uid (SeahorseView* self, guint* uid);
+SeahorseObject* seahorse_view_get_selected (SeahorseView* self);
+void seahorse_view_set_selected (SeahorseView* self, SeahorseObject* value);
+SeahorseSet* seahorse_view_get_current_set (SeahorseView* self);
GtkWindow* seahorse_view_get_window (SeahorseView* self);
GType seahorse_view_get_type (void);
Modified: trunk/libseahorse/seahorse-view.vala
==============================================================================
--- trunk/libseahorse/seahorse-view.vala (original)
+++ trunk/libseahorse/seahorse-view.vala Thu Jul 17 01:41:51 2008
@@ -22,15 +22,15 @@
using GLib;
namespace Seahorse {
- public interface View : Object {
+ public interface View : GLib.Object {
public signal void selection_changed ();
- public abstract GLib.List<weak Key> get_selected_keys ();
- public abstract void set_selected_keys (GLib.List<Key> keys);
- public abstract weak Key? get_selected_key_and_uid (out uint uid);
+ public abstract GLib.List<weak Object> get_selected_objects ();
+ public abstract void set_selected_objects (GLib.List<Object> objects);
+ public abstract weak Object? get_selected_object_and_uid (out uint uid);
- public abstract weak Key? selected_key { get; set; }
- public abstract weak Keyset? current_keyset { get; }
+ public abstract weak Object? selected { get; set; }
+ public abstract weak Set? current_set { get; }
public abstract weak Gtk.Window window { get; }
}
}
Modified: trunk/libseahorse/vala-build.stamp
==============================================================================
--- trunk/libseahorse/vala-build.stamp (original)
+++ trunk/libseahorse/vala-build.stamp Thu Jul 17 01:41:51 2008
@@ -1 +1 @@
-1216160611
+1216254157
Modified: trunk/pgp/libseahorse-pgp-c.vapi
==============================================================================
--- trunk/pgp/libseahorse-pgp-c.vapi (original)
+++ trunk/pgp/libseahorse-pgp-c.vapi Thu Jul 17 01:41:51 2008
@@ -37,7 +37,7 @@
}
[CCode (cheader_filename = "seahorse-pgp-source.h")]
- public class Source : Seahorse.KeySource {
+ public class Source : Seahorse.Source {
}
Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c (original)
+++ trunk/pgp/seahorse-hkp-source.c Thu Jul 17 01:41:51 2008
@@ -81,7 +81,7 @@
}
static SoupURI*
-get_http_server_uri (SeahorseKeySource *src, const char *path)
+get_http_server_uri (SeahorseSource *src, const char *path)
{
SoupURI *uri;
gchar *server, *port;
@@ -502,25 +502,25 @@
static void
add_key (SeahorseHKPSource *ssrc, gpgme_key_t key)
{
- SeahorseKey *prev;
+ SeahorseObject *prev;
SeahorsePGPKey *pkey;
GQuark keyid;
keyid = seahorse_pgp_key_get_cannonical_id (seahorse_pgp_key_get_id (key, 0));
- prev = seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (ssrc), keyid);
+ prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
if (prev != NULL) {
g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
gpgmex_combine_keys (SEAHORSE_PGP_KEY (prev)->pubkey, key);
- seahorse_key_changed (prev, SKEY_CHANGE_UIDS);
+ seahorse_object_fire_changed (prev, SKEY_CHANGE_UIDS);
return;
}
/* A public key */
- pkey = seahorse_pgp_key_new (SEAHORSE_KEY_SOURCE (ssrc), key, NULL);
+ pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (ssrc), key, NULL);
/* Add to context */
- seahorse_context_add_key (SCTX_APP (), SEAHORSE_KEY (pkey));
+ seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
}
static void
@@ -736,7 +736,7 @@
}
static SeahorseOperation*
-seahorse_hkp_source_search (SeahorseKeySource *src, const gchar *match)
+seahorse_hkp_source_search (SeahorseSource *src, const gchar *match)
{
SeahorseHKPOperation *hop;
SoupMessage *message;
@@ -744,7 +744,7 @@
gchar *t;
SoupURI *uri;
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
g_assert (SEAHORSE_IS_HKP_SOURCE (src));
hop = setup_hkp_operation (SEAHORSE_HKP_SOURCE (src));
@@ -777,14 +777,14 @@
}
static SeahorseOperation*
-seahorse_hkp_source_load (SeahorseKeySource *src, GQuark keyid)
+seahorse_hkp_source_load (SeahorseSource *src, GQuark keyid)
{
SeahorseOperation *op;
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
g_assert (SEAHORSE_IS_HKP_SOURCE (src));
- op = SEAHORSE_KEY_SOURCE_CLASS (seahorse_hkp_source_parent_class)->load (src, keyid);
+ op = SEAHORSE_SOURCE_CLASS (seahorse_hkp_source_parent_class)->load (src, keyid);
if (op != NULL)
return op;
@@ -797,7 +797,7 @@
}
static SeahorseOperation*
-seahorse_hkp_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
{
SeahorseHKPOperation *hop;
SeahorseHKPSource *hsrc;
@@ -874,7 +874,7 @@
}
static SeahorseOperation*
-seahorse_hkp_source_export_raw (SeahorseKeySource *sksrc, GSList *keyids,
+seahorse_hkp_source_export_raw (SeahorseSource *sksrc, GSList *keyids,
GOutputStream *output)
{
SeahorseHKPOperation *hop;
@@ -947,13 +947,13 @@
seahorse_hkp_source_class_init (SeahorseHKPSourceClass *klass)
{
GObjectClass *gobject_class;
- SeahorseKeySourceClass *key_class;
+ SeahorseSourceClass *key_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = seahorse_hkp_source_get_property;
- key_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
- key_class->canonize_keyid = seahorse_pgp_key_get_cannonical_id;
+ key_class = SEAHORSE_SOURCE_CLASS (klass);
+ key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
key_class->load = seahorse_hkp_source_load;
key_class->search = seahorse_hkp_source_search;
key_class->import = seahorse_hkp_source_import;
Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c (original)
+++ trunk/pgp/seahorse-ldap-source.c Thu Jul 17 01:41:51 2008
@@ -744,26 +744,26 @@
static void
add_key (SeahorseLDAPSource *ssrc, gpgme_key_t key)
{
- SeahorseKey *prev;
+ SeahorseObject *prev;
SeahorsePGPKey *pkey;
GQuark keyid;
keyid = seahorse_pgp_key_get_cannonical_id (seahorse_pgp_key_get_id (key, 0));
- prev = seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (ssrc), keyid);
+ prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
/* TODO: This function needs reworking after we get more key types */
if (prev != NULL) {
g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
gpgmex_combine_keys (SEAHORSE_PGP_KEY (prev)->pubkey, key);
- seahorse_key_changed (prev, SKEY_CHANGE_UIDS);
+ seahorse_object_fire_changed (prev, SKEY_CHANGE_UIDS);
return;
}
/* A public key */
- pkey = seahorse_pgp_key_new (SEAHORSE_KEY_SOURCE (ssrc), key, NULL);
+ pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (ssrc), key, NULL);
/* Add to context */
- seahorse_context_add_key (SCTX_APP (), SEAHORSE_KEY (pkey));
+ seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
}
/* Add a key to the key source from an LDAP entry */
@@ -1273,15 +1273,15 @@
}
static SeahorseOperation*
-seahorse_ldap_source_load (SeahorseKeySource *src, GQuark keyid)
+seahorse_ldap_source_load (SeahorseSource *src, GQuark keyid)
{
SeahorseOperation *op;
SeahorseLDAPOperation *lop = NULL;
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
g_assert (SEAHORSE_IS_LDAP_SOURCE (src));
- op = SEAHORSE_KEY_SOURCE_CLASS (seahorse_ldap_source_parent_class)->load (src, keyid);
+ op = SEAHORSE_SOURCE_CLASS (seahorse_ldap_source_parent_class)->load (src, keyid);
if (op != NULL)
return op;
@@ -1300,11 +1300,11 @@
}
static SeahorseOperation*
-seahorse_ldap_source_search (SeahorseKeySource *src, const gchar *match)
+seahorse_ldap_source_search (SeahorseSource *src, const gchar *match)
{
SeahorseLDAPOperation *lop = NULL;
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
g_assert (SEAHORSE_IS_LDAP_SOURCE (src));
/* Search for keys */
@@ -1318,7 +1318,7 @@
}
static SeahorseOperation*
-seahorse_ldap_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_ldap_source_import (SeahorseSource *sksrc, GInputStream *input)
{
SeahorseLDAPOperation *lop;
SeahorseLDAPSource *lsrc;
@@ -1356,7 +1356,7 @@
}
static SeahorseOperation*
-seahorse_ldap_source_export_raw (SeahorseKeySource *sksrc, GSList *keyids,
+seahorse_ldap_source_export_raw (SeahorseSource *sksrc, GSList *keyids,
GOutputStream *output)
{
SeahorseLDAPOperation *lop;
@@ -1384,13 +1384,13 @@
seahorse_ldap_source_class_init (SeahorseLDAPSourceClass *klass)
{
GObjectClass *gobject_class;
- SeahorseKeySourceClass *key_class;
+ SeahorseSourceClass *key_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = seahorse_ldap_source_get_property;
- key_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
- key_class->canonize_keyid = seahorse_pgp_key_get_cannonical_id;
+ key_class = SEAHORSE_SOURCE_CLASS (klass);
+ key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
key_class->load = seahorse_ldap_source_load;
key_class->search = seahorse_ldap_source_search;
key_class->import = seahorse_ldap_source_import;
Modified: trunk/pgp/seahorse-pgp-commands.c
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.c (original)
+++ trunk/pgp/seahorse-pgp-commands.c Thu Jul 17 01:41:51 2008
@@ -25,7 +25,7 @@
#include <seahorse-pgp-key.h>
#include <seahorse-view.h>
#include <seahorse-util.h>
-#include <seahorse-key-source.h>
+#include <seahorse-source.h>
#include <config.h>
#include <common/seahorse-registry.h>
#include "seahorse-pgp.h"
@@ -44,8 +44,8 @@
SEAHORSE_PGP_COMMANDS_UI_DEFINITION,
SEAHORSE_PGP_COMMANDS_COMMAND_ACTIONS
};
-static void seahorse_pgp_commands_real_show_properties (SeahorseCommands* base, SeahorseKey* key);
-static void seahorse_pgp_commands_real_delete_keys (SeahorseCommands* base, GList* keys, GError** error);
+static void seahorse_pgp_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key);
+static void seahorse_pgp_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error);
static void seahorse_pgp_commands_on_key_sign (SeahorsePGPCommands* self, GtkAction* action);
static void seahorse_pgp_commands_on_view_selection_changed (SeahorsePGPCommands* self, SeahorseView* view);
static void _seahorse_pgp_commands_on_key_sign_gtk_action_activate (GtkAction* _sender, gpointer self);
@@ -58,16 +58,16 @@
static const char* SEAHORSE_PGP_COMMANDS_UI_DEF = "\n\t\t\t<ui>\n\t\t\t\n\t\t\t<menubar>\n\t\t\t\t<menu name='Key' action='key-menu'>\n\t\t\t\t\t<placeholder name=\"KeyCommands\">\n\t\t\t\t\t\t<menuitem action=\"key-sign\"/>\n\t\t\t\t\t</placeholder>\n\t\t\t\t</menu>\n\t\t\t</menubar>\n\t\t\t\n\t\t\t<toolbar name=\"MainToolbar\">\n\t\t\t\t<placeholder name=\"ToolItems\">\n\t\t\t\t\t<toolitem action=\"key-sign\"/>\n\t\t\t\t</placeholder>\n\t\t\t</toolbar>\n\n\t\t\t<popup name=\"KeyPopup\">\n\t\t\t\t<menuitem action=\"key-sign\"/>\n\t\t\t</popup>\n \n\t\t\t</ui>\n\t\t";
-static void seahorse_pgp_commands_real_show_properties (SeahorseCommands* base, SeahorseKey* key) {
+static void seahorse_pgp_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key) {
SeahorsePGPCommands * self;
self = SEAHORSE_PGP_COMMANDS (base);
- g_return_if_fail (SEAHORSE_IS_KEY (key));
- g_return_if_fail (seahorse_key_get_ktype (key) == SEAHORSE_PGP_TYPE);
+ g_return_if_fail (SEAHORSE_IS_OBJECT (key));
+ g_return_if_fail (seahorse_object_get_tag (key) == SEAHORSE_PGP_TYPE);
seahorse_pgp_key_properties_show (SEAHORSE_PGP_KEY (key), seahorse_view_get_window (seahorse_commands_get_view (SEAHORSE_COMMANDS (self))));
}
-static void seahorse_pgp_commands_real_delete_keys (SeahorseCommands* base, GList* keys, GError** error) {
+static void seahorse_pgp_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error) {
SeahorsePGPCommands * self;
GError * inner_error;
guint num;
@@ -83,14 +83,14 @@
if (num == 1) {
char* _tmp0;
_tmp0 = NULL;
- prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the PGP key '%s'?"), seahorse_key_get_display_name (((SeahorseKey*) (SEAHORSE_KEY (((SeahorsePGPKey*) (keys->data))))))), (prompt = (g_free (prompt), NULL)), _tmp0);
+ prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the PGP key '%s'?"), seahorse_object_get_description (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp0);
} else {
char* _tmp1;
_tmp1 = NULL;
prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete %d PGP keys?"), num), (prompt = (g_free (prompt), NULL)), _tmp1);
}
if (seahorse_util_prompt_delete (prompt)) {
- seahorse_key_source_delete_keys (keys, &inner_error);
+ seahorse_source_delete_objects (keys, &inner_error);
if (inner_error != NULL) {
g_propagate_error (error, inner_error);
prompt = (g_free (prompt), NULL);
@@ -103,14 +103,14 @@
static void seahorse_pgp_commands_on_key_sign (SeahorsePGPCommands* self, GtkAction* action) {
guint uid;
- SeahorseKey* _tmp0;
- SeahorseKey* key;
+ SeahorseObject* _tmp0;
+ SeahorseObject* key;
g_return_if_fail (SEAHORSE_PGP_IS_COMMANDS (self));
g_return_if_fail (GTK_IS_ACTION (action));
uid = 0U;
_tmp0 = NULL;
- key = (_tmp0 = seahorse_view_get_selected_key_and_uid (seahorse_commands_get_view (SEAHORSE_COMMANDS (self)), &uid), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
- if (key != NULL && seahorse_key_get_ktype (key) == SEAHORSE_PGP_TYPE) {
+ key = (_tmp0 = seahorse_view_get_selected_object_and_uid (seahorse_commands_get_view (SEAHORSE_COMMANDS (self)), &uid), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ if (key != NULL && seahorse_object_get_tag (key) == SEAHORSE_PGP_TYPE) {
seahorse_pgp_sign_prompt (SEAHORSE_PGP_KEY (key), uid, seahorse_view_get_window (seahorse_commands_get_view (SEAHORSE_COMMANDS (self))));
}
(key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
@@ -122,24 +122,20 @@
gboolean enable;
g_return_if_fail (SEAHORSE_PGP_IS_COMMANDS (self));
g_return_if_fail (SEAHORSE_IS_VIEW (view));
- keys = seahorse_view_get_selected_keys (view);
+ keys = seahorse_view_get_selected_objects (view);
enable = (keys != NULL);
{
GList* key_collection;
GList* key_it;
key_collection = keys;
for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
- SeahorsePGPKey* _tmp0;
- SeahorsePGPKey* key;
- _tmp0 = NULL;
- key = (_tmp0 = ((SeahorsePGPKey*) (key_it->data)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ SeahorseObject* key;
+ key = ((SeahorseObject*) (key_it->data));
{
- if (seahorse_key_get_ktype (SEAHORSE_KEY (key)) != SEAHORSE_PGP_TYPE) {
+ if (seahorse_object_get_tag (key) != SEAHORSE_PGP_TYPE) {
enable = FALSE;
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
break;
}
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
}
}
}
@@ -237,7 +233,7 @@
G_OBJECT_CLASS (klass)->constructor = seahorse_pgp_commands_constructor;
G_OBJECT_CLASS (klass)->dispose = seahorse_pgp_commands_dispose;
SEAHORSE_COMMANDS_CLASS (klass)->show_properties = seahorse_pgp_commands_real_show_properties;
- SEAHORSE_COMMANDS_CLASS (klass)->delete_keys = seahorse_pgp_commands_real_delete_keys;
+ SEAHORSE_COMMANDS_CLASS (klass)->delete_objects = seahorse_pgp_commands_real_delete_objects;
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_PGP_COMMANDS_KTYPE, "ktype");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_PGP_COMMANDS_UI_DEFINITION, "ui-definition");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_PGP_COMMANDS_COMMAND_ACTIONS, "command-actions");
Modified: trunk/pgp/seahorse-pgp-commands.h
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.h (original)
+++ trunk/pgp/seahorse-pgp-commands.h Thu Jul 17 01:41:51 2008
@@ -25,7 +25,7 @@
#include <glib.h>
#include <glib-object.h>
#include <seahorse-commands.h>
-#include <seahorse-key.h>
+#include <seahorse-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
Modified: trunk/pgp/seahorse-pgp-commands.vala
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.vala (original)
+++ trunk/pgp/seahorse-pgp-commands.vala Thu Jul 17 01:41:51 2008
@@ -62,38 +62,38 @@
}
}
- public override void show_properties (Seahorse.Key key) {
- return_if_fail (key.ktype == Seahorse.Pgp.TYPE);
+ public override void show_properties (Object key) {
+ return_if_fail (key.tag == Seahorse.Pgp.TYPE);
KeyProperties.show ((Pgp.Key)key, view.window);
}
- public override void delete_keys (List<Key> keys) throws GLib.Error {
+ public override void delete_objects (List<Object> keys) throws GLib.Error {
uint num = keys.length();
if (num == 0)
return;
string prompt;
if (num == 1)
- prompt = _("Are you sure you want to delete the PGP key '%s'?").printf(keys.data.display_name);
+ prompt = _("Are you sure you want to delete the PGP key '%s'?").printf(keys.data.description);
else
prompt = _("Are you sure you want to delete %d PGP keys?").printf(num);
if (Util.prompt_delete (prompt))
- KeySource.delete_keys (keys);
+ Seahorse.Source.delete_objects (keys);
}
private void on_key_sign (Action action) {
uint uid;
- var key = view.get_selected_key_and_uid (out uid);
- if (key != null && key.ktype == Seahorse.Pgp.TYPE)
+ var key = view.get_selected_object_and_uid (out uid);
+ if (key != null && key.tag == Seahorse.Pgp.TYPE)
Sign.prompt ((Pgp.Key)key, uid, view.window);
}
private void on_view_selection_changed (View view) {
- List<weak Key> keys = view.get_selected_keys ();
+ var keys = view.get_selected_objects ();
bool enable = (keys != null);
- foreach (Key key in keys) {
- if (key.ktype != Seahorse.Pgp.TYPE) {
+ foreach (var key in keys) {
+ if (key.tag != Seahorse.Pgp.TYPE) {
enable = false;
break;
}
Modified: trunk/pgp/seahorse-pgp-delete.c
==============================================================================
--- trunk/pgp/seahorse-pgp-delete.c (original)
+++ trunk/pgp/seahorse-pgp-delete.c Thu Jul 17 01:41:51 2008
@@ -101,7 +101,7 @@
void
seahorse_pgp_delete_show (GList *keys)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseKey *skey;
GError *error = NULL;
GList *list = NULL;
@@ -114,14 +114,14 @@
for (list = keys; list != NULL; list = g_list_next (list)) {
skey = SEAHORSE_KEY (list->data);
- if (seahorse_key_get_etype (skey) == SKEY_PRIVATE &&
+ if (seahorse_key_get_usage (skey) == SEAHORSE_USAGE_PRIVATE_KEY &&
!ask_key_pair (skey))
break;
sksrc = seahorse_key_get_source (skey);
g_return_if_fail (sksrc != NULL);
- if (!seahorse_key_source_remove (sksrc, skey, 0, &error)) {
+ if (!seahorse_source_remove (sksrc, SEAHORSE_OBJECT (skey), 0, &error)) {
seahorse_util_handle_error (error, _("Couldn't delete key"));
g_clear_error (&error);
}
@@ -169,7 +169,7 @@
seahorse_pgp_delete_userid_show (SeahorseKey *skey, guint index)
{
GtkWidget *question, *delete_button, *cancel_button;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
gint response;
GError *error = NULL;
gchar *userid;
@@ -205,7 +205,7 @@
sksrc = seahorse_key_get_source (skey);
g_return_if_fail (sksrc != NULL);
- if (!seahorse_key_source_remove (sksrc, skey, index, &error)) {
+ if (!seahorse_source_remove (sksrc, SEAHORSE_OBJECT (skey), index, &error)) {
seahorse_util_handle_error (error, _("Couldn't delete user id"));
g_clear_error (&error);
}
Modified: trunk/pgp/seahorse-pgp-generator.c
==============================================================================
--- trunk/pgp/seahorse-pgp-generator.c (original)
+++ trunk/pgp/seahorse-pgp-generator.c Thu Jul 17 01:41:51 2008
@@ -24,8 +24,8 @@
#include <stdlib.h>
#include <string.h>
#include <seahorse-context.h>
-#include <seahorse-key.h>
-#include <seahorse-key-source.h>
+#include <seahorse-types.h>
+#include <seahorse-source.h>
#include <seahorse-pgp-dialogs.h>
#include <seahorse-pgp-source.h>
#include <config.h>
@@ -53,12 +53,12 @@
static void seahorse_pgp_generator_on_pgp_generate (SeahorsePGPGenerator* self, GtkAction* action) {
- SeahorseKeySource* _tmp0;
- SeahorseKeySource* sksrc;
+ SeahorseSource* _tmp0;
+ SeahorseSource* sksrc;
g_return_if_fail (SEAHORSE_PGP_IS_GENERATOR (self));
g_return_if_fail (GTK_IS_ACTION (action));
_tmp0 = NULL;
- sksrc = (_tmp0 = seahorse_context_find_key_source (seahorse_context_for_app (), SEAHORSE_PGP_TYPE, SKEY_LOC_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ sksrc = (_tmp0 = seahorse_context_find_source (seahorse_context_for_app (), SEAHORSE_PGP_TYPE, SEAHORSE_LOCATION_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
g_return_if_fail (sksrc != NULL);
seahorse_pgp_generate_show (SEAHORSE_PGP_SOURCE (sksrc), NULL);
(sksrc == NULL ? NULL : (sksrc = (g_object_unref (sksrc), NULL)));
Modified: trunk/pgp/seahorse-pgp-generator.vala
==============================================================================
--- trunk/pgp/seahorse-pgp-generator.vala (original)
+++ trunk/pgp/seahorse-pgp-generator.vala Thu Jul 17 01:41:51 2008
@@ -50,7 +50,7 @@
}
private void on_pgp_generate (Action action) {
- KeySource sksrc = Context.for_app().find_key_source(Seahorse.Pgp.TYPE, Seahorse.Key.Loc.LOCAL);
+ var sksrc = Context.for_app().find_source(Seahorse.Pgp.TYPE, Location.LOCAL);
GLib.return_if_fail (sksrc != null);
Generate.show ((Pgp.Source)sksrc, null);
}
Modified: trunk/pgp/seahorse-pgp-key-op.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-op.c (original)
+++ trunk/pgp/seahorse-pgp-key-op.c Thu Jul 17 01:41:51 2008
@@ -69,7 +69,7 @@
/**
* seahorse_pgp_key_op_generate:
- * @sksrc: #SeahorseKeySource
+ * @sksrc: #SeahorseSource
* @name: User ID name, must be at least 5 characters long
* @email: Optional user ID email
* @comment: Optional user ID comment
@@ -169,7 +169,7 @@
err = gpgme_op_delete (psrc->gctx, pkey->pubkey, secret);
if (GPG_IS_OK (err))
- seahorse_key_destroy (SEAHORSE_KEY (pkey));
+ seahorse_context_remove_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
return err;
}
@@ -302,7 +302,7 @@
err = edit_gpgme_key (psrc, pkey->pubkey, parms);
if (GPG_IS_OK (err) && (change != 0))
- seahorse_key_changed (SEAHORSE_KEY (pkey), change);
+ seahorse_object_fire_changed (SEAHORSE_OBJECT (pkey), change);
return err;
}
@@ -487,7 +487,7 @@
const guint index, SeahorseSignCheck check,
SeahorseSignOptions options)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SignParm *sign_parm;
SeahorseEditParm *parms;
gpgme_error_t err;
@@ -655,7 +655,7 @@
gpgme_error_t err;
g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (seahorse_key_get_etype (SEAHORSE_KEY (pkey)) == SKEY_PRIVATE, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (seahorse_key_get_usage (SEAHORSE_KEY (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
parms = seahorse_edit_parm_new (PASS_START, edit_pass_action, edit_pass_transit, NULL);
@@ -799,7 +799,7 @@
g_return_val_if_fail (trust >= GPGME_VALIDITY_UNKNOWN, GPG_E (GPG_ERR_INV_VALUE));
g_return_val_if_fail (seahorse_key_get_trust (SEAHORSE_KEY (pkey)) != trust, GPG_E (GPG_ERR_INV_VALUE));
- if (seahorse_key_get_etype (SEAHORSE_KEY (pkey)) == SKEY_PRIVATE)
+ if (seahorse_key_get_usage (SEAHORSE_KEY (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY)
g_return_val_if_fail (trust != SEAHORSE_VALIDITY_UNKNOWN, GPG_E (GPG_ERR_INV_VALUE));
else
g_return_val_if_fail (trust != SEAHORSE_VALIDITY_ULTIMATE, GPG_E (GPG_ERR_INV_VALUE));
@@ -1067,7 +1067,7 @@
gpgme_subkey_t subkey;
g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (seahorse_key_get_etype (SEAHORSE_KEY (pkey)) == SKEY_PRIVATE, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (seahorse_key_get_usage (SEAHORSE_KEY (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
subkey = seahorse_pgp_key_get_nth_subkey (pkey, index);
@@ -1204,8 +1204,8 @@
g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (revoker), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (seahorse_key_get_etype (SEAHORSE_KEY (pkey)) == SKEY_PRIVATE, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (seahorse_key_get_etype (SEAHORSE_KEY (revoker)) == SKEY_PRIVATE, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (seahorse_key_get_usage (SEAHORSE_KEY (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (seahorse_key_get_usage (SEAHORSE_KEY (revoker)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
parms = seahorse_edit_parm_new (ADD_REVOKER_START, add_revoker_action,
add_revoker_transit, (gpointer)seahorse_pgp_key_get_id (revoker->pubkey, 0));
@@ -1356,7 +1356,7 @@
UidParm *uid_parm;
g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (seahorse_key_get_etype (SEAHORSE_KEY (pkey)) == SKEY_PRIVATE, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (seahorse_key_get_usage (SEAHORSE_KEY (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
g_return_val_if_fail (name != NULL && strlen (name) >= 5, GPG_E (GPG_ERR_INV_VALUE));
uid_parm = g_new (UidParm, 1);
@@ -1500,7 +1500,7 @@
SubkeyParm *key_parm;
g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (pkey), GPG_E (GPG_ERR_WRONG_KEY_USAGE));
- g_return_val_if_fail (seahorse_key_get_etype (SEAHORSE_KEY (pkey)) == SKEY_PRIVATE, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
+ g_return_val_if_fail (seahorse_key_get_usage (SEAHORSE_KEY (pkey)) == SEAHORSE_USAGE_PRIVATE_KEY, GPG_E (GPG_ERR_WRONG_KEY_USAGE));
/* Check length range & type */
switch (type) {
Modified: trunk/pgp/seahorse-pgp-key-properties.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-properties.c (original)
+++ trunk/pgp/seahorse-pgp-key-properties.c Thu Jul 17 01:41:51 2008
@@ -293,17 +293,21 @@
names_update_row (SeahorseKeyModel *skmodel, SeahorseKey *skey,
GtkTreeIter *iter, SeahorseWidget *swidget)
{
- const gchar *icon;
- gchar *name;
-
- /* Always use the most preferred key for this keyid */
- if (skey->preferred) {
- while (skey->preferred)
- skey = skey->preferred;
- seahorse_key_model_set_row_key (skmodel, iter, skey);
- }
+ SeahorseObject *preferred;
+ const gchar *icon;
+ gchar *name;
+
+ /* Always use the most preferred key for this keyid */
+ preferred = seahorse_object_get_preferred (SEAHORSE_OBJECT (skey));
+ if (preferred) {
+ while (SEAHORSE_IS_KEY (preferred)) {
+ skey = SEAHORSE_KEY (preferred);
+ preferred = seahorse_object_get_preferred (preferred);
+ }
+ seahorse_key_model_set_row_key (skmodel, iter, skey);
+ }
- icon = seahorse_key_get_location (skey) < SKEY_LOC_LOCAL ?
+ icon = seahorse_key_get_location (skey) < SEAHORSE_LOCATION_LOCAL ?
GTK_STOCK_DIALOG_QUESTION : SEAHORSE_STOCK_SIGN;
name = seahorse_key_get_name_markup (skey, 0);
@@ -355,7 +359,7 @@
}
/* Pass it to 'DiscoverKeys' for resolution/download */
- keys = seahorse_context_discover_keys (SCTX_APP (), SEAHORSE_PGP, rawids);
+ keys = seahorse_context_discover_objects (SCTX_APP (), SEAHORSE_PGP, rawids);
g_slist_free (rawids);
rawids = NULL;
@@ -382,7 +386,7 @@
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
pkey = SEAHORSE_PGP_KEY (skey);
- if (seahorse_key_get_etype (skey) != SKEY_PRIVATE)
+ if (seahorse_key_get_usage (skey) != SEAHORSE_USAGE_PRIVATE_KEY)
return;
/* Clear/create table store */
@@ -434,7 +438,7 @@
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
- if (seahorse_key_get_etype (skey) != SKEY_PRIVATE)
+ if (seahorse_key_get_usage (skey) != SEAHORSE_USAGE_PRIVATE_KEY)
return;
glade_xml_signal_connect_data (swidget->xml, "on_names_add",
@@ -571,26 +575,26 @@
static void
set_photoid_state(SeahorseWidget *swidget, SeahorsePGPKey *pkey)
{
- SeahorseKeyEType etype;
+ SeahorseUsage etype;
GtkWidget *photo_image;
gpgmex_photo_id_t photoid;
- etype = seahorse_key_get_etype (SEAHORSE_KEY(pkey));
+ etype = seahorse_key_get_usage (SEAHORSE_KEY(pkey));
photoid = (gpgmex_photo_id_t)g_object_get_data (G_OBJECT (swidget),
"current-photoid");
/* Show when adding a photo is possible */
show_glade_widget (swidget, "owner-photo-add-button",
- etype == SKEY_PRIVATE);
+ etype == SEAHORSE_USAGE_PRIVATE_KEY);
/* Show when we have a photo to set as primary */
show_glade_widget (swidget, "owner-photo-primary-button",
- etype == SKEY_PRIVATE && photoid);
+ etype == SEAHORSE_USAGE_PRIVATE_KEY && photoid);
/* Display this when there are any photo ids */
show_glade_widget (swidget, "owner-photo-delete-button",
- etype == SKEY_PRIVATE && photoid != NULL);
+ etype == SEAHORSE_USAGE_PRIVATE_KEY && photoid != NULL);
/* Sensitive when not the first photo id */
sensitive_glade_widget (swidget, "owner-photo-previous-button",
@@ -611,7 +615,7 @@
if (photo_image) {
if (!photoid || !photoid->photo)
gtk_image_set_from_stock (GTK_IMAGE (photo_image),
- etype == SKEY_PRIVATE ? SEAHORSE_STOCK_SECRET : SEAHORSE_STOCK_KEY, (GtkIconSize)-1);
+ etype == SEAHORSE_USAGE_PRIVATE_KEY ? SEAHORSE_STOCK_SECRET : SEAHORSE_STOCK_KEY, (GtkIconSize)-1);
else
gtk_image_set_from_pixbuf (GTK_IMAGE (photo_image), photoid->photo);
}
@@ -735,7 +739,7 @@
SeahorseKey *skey;
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
- if (seahorse_key_get_etype (skey) == SKEY_PRIVATE)
+ if (seahorse_key_get_usage (skey) == SEAHORSE_USAGE_PRIVATE_KEY)
seahorse_pgp_key_pair_op_change_pass (SEAHORSE_PGP_KEY (skey));
}
@@ -743,11 +747,11 @@
do_owner_signals (SeahorseWidget *swidget)
{
SeahorseKey *skey;
- SeahorseKeyEType etype;
+ SeahorseUsage etype;
GtkWidget *frame;
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
- etype = seahorse_key_get_etype (skey);
+ etype = seahorse_key_get_usage (skey);
glade_xml_signal_connect_data (swidget->xml, "on_owner_sign_button_clicked",
G_CALLBACK (owner_sign_button_clicked), swidget);
@@ -758,7 +762,7 @@
glade_xml_signal_connect_data(swidget->xml, "on_image_eventbox_scroll_event",
G_CALLBACK(photoid_button_pressed), swidget);
- if (etype == SKEY_PRIVATE ) {
+ if (etype == SEAHORSE_USAGE_PRIVATE_KEY ) {
glade_xml_signal_connect_data (swidget->xml, "on_owner_photo_primary_button_clicked",
G_CALLBACK (owner_photo_primary_button_clicked), swidget);
glade_xml_signal_connect_data (swidget->xml, "on_owner_photo_add_button_clicked",
@@ -1008,7 +1012,7 @@
static void
details_export_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseOperation *op;
SeahorseKey *skey;
GtkDialog *dialog;
@@ -1032,14 +1036,14 @@
return;
sksrc = seahorse_key_get_source (skey);
- g_assert (SEAHORSE_IS_KEY_SOURCE (sksrc));
+ g_assert (SEAHORSE_IS_SOURCE (sksrc));
file = g_file_new_for_uri (uri);
output = g_file_replace (file, NULL, FALSE, 0, NULL, &err);
g_object_unref (file);
if (output) {
- op = seahorse_key_source_export (sksrc, keys, TRUE, G_OUTPUT_STREAM (output));
+ op = seahorse_source_export (sksrc, keys, TRUE, G_OUTPUT_STREAM (output));
seahorse_operation_wait (op);
g_object_unref (output);
@@ -1086,7 +1090,7 @@
setup_details_trust (SeahorseWidget *swidget)
{
SeahorseKey *skey;
- SeahorseKeyEType etype;
+ SeahorseUsage etype;
GtkWidget *widget;
GtkListStore *model;
GtkTreeIter iter;
@@ -1095,7 +1099,7 @@
DBG_PRINT(("KeyProperties: Setting up Trust Combo Box Store\n"));
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
- etype = seahorse_key_get_etype (skey);
+ etype = seahorse_key_get_usage (skey);
widget = glade_xml_get_widget (swidget->xml, "details-trust-combobox");
@@ -1109,7 +1113,7 @@
/* Initialize the store */
model = gtk_list_store_newv (TRUST_N_COLUMNS, (GType*)trust_columns);
- if (etype != SKEY_PRIVATE) {
+ if (etype != SEAHORSE_USAGE_PRIVATE_KEY) {
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter,
TRUST_LABEL, _("Unknown"),
@@ -1134,7 +1138,7 @@
TRUST_LABEL, _("Full"),
TRUST_VALIDITY, SEAHORSE_VALIDITY_FULL,
-1);
- if (etype == SKEY_PRIVATE) {
+ if (etype == SEAHORSE_USAGE_PRIVATE_KEY) {
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter,
TRUST_LABEL, _("Ultimate"),
@@ -1151,16 +1155,16 @@
do_details_signals (SeahorseWidget *swidget)
{
SeahorseKey *skey;
- SeahorseKeyEType etype;
+ SeahorseUsage etype;
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
- etype = seahorse_key_get_etype (skey);
+ etype = seahorse_key_get_usage (skey);
/*
* if not the key owner, disable most everything
* if key owner, add the callbacks to the subkey buttons
*/
- if (etype == SKEY_PUBLIC ) {
+ if (etype == SEAHORSE_USAGE_PUBLIC_KEY ) {
show_glade_widget (swidget, "details-actions-label", FALSE);
show_glade_widget (swidget, "details-export-button", FALSE);
show_glade_widget (swidget, "details-add-button", FALSE);
@@ -1247,7 +1251,7 @@
widget = glade_xml_get_widget (swidget->xml, "details-expires-label");
if (widget) {
- if (seahorse_key_get_location (skey) == SKEY_LOC_REMOTE)
+ if (seahorse_key_get_location (skey) == SEAHORSE_LOCATION_REMOTE)
fp_label = NULL;
else if (subkey->expires == 0)
fp_label = g_strdup (_("Never"));
@@ -1257,7 +1261,7 @@
g_free (fp_label);
}
- show_glade_widget (swidget, "details-trust-combobox", keyloc == SKEY_LOC_LOCAL);
+ show_glade_widget (swidget, "details-trust-combobox", keyloc == SEAHORSE_LOCATION_LOCAL);
widget = glade_xml_get_widget (swidget->xml, "details-trust-combobox");
if (widget) {
@@ -1408,23 +1412,28 @@
trust_update_row (SeahorseKeyModel *skmodel, SeahorseKey *skey,
GtkTreeIter *iter, SeahorseWidget *swidget)
{
- gboolean trusted = FALSE;
- const gchar *icon;
- gchar *name;
-
- /* Always use the most preferred key for this keyid */
- if (skey->preferred) {
- while (skey->preferred)
- skey = skey->preferred;
- seahorse_key_model_set_row_key (skmodel, iter, skey);
- }
+ SeahorseObject *preferred;
+ gboolean trusted = FALSE;
+ const gchar *icon;
+ gchar *name;
+
+ /* Always use the most preferred key for this keyid */
+ preferred = seahorse_object_get_preferred (SEAHORSE_OBJECT (skey));
+ if (SEAHORSE_IS_KEY (preferred)) {
+ while (SEAHORSE_IS_KEY (preferred)) {
+ skey = SEAHORSE_KEY (preferred);
+ preferred = seahorse_object_get_preferred (preferred);
+ }
+ seahorse_key_model_set_row_key (skmodel, iter, skey);
+ }
- if (seahorse_key_get_etype (skey) == SKEY_PRIVATE)
+
+ if (seahorse_key_get_usage (skey) == SEAHORSE_USAGE_PRIVATE_KEY)
trusted = TRUE;
else if (seahorse_key_get_flags (skey) & SKEY_FLAG_TRUSTED)
trusted = TRUE;
- icon = seahorse_key_get_location (skey) < SKEY_LOC_LOCAL ?
+ icon = seahorse_key_get_location (skey) < SEAHORSE_LOCATION_LOCAL ?
GTK_STOCK_DIALOG_QUESTION : SEAHORSE_STOCK_SIGN;
name = seahorse_key_get_display_name (skey);
@@ -1477,7 +1486,7 @@
rawids = unique_slist_strings (rawids);
/* Pass it to 'DiscoverKeys' for resolution/download */
- keys = seahorse_context_discover_keys (SCTX_APP (), SEAHORSE_PGP, rawids);
+ keys = seahorse_context_discover_objects (SCTX_APP (), SEAHORSE_PGP, rawids);
g_slist_free (rawids);
rawids = NULL;
@@ -1516,13 +1525,13 @@
do_trust_signals (SeahorseWidget *swidget)
{
SeahorseKey *skey;
- SeahorseKeyEType etype;
+ SeahorseUsage etype;
gchar *user;
skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
- etype = seahorse_key_get_etype (skey);
+ etype = seahorse_key_get_usage (skey);
- if (etype != SKEY_PUBLIC)
+ if (etype != SEAHORSE_USAGE_PUBLIC_KEY)
return;
set_glade_image (swidget, "image-good1", "seahorse-sign-ok");
@@ -1532,7 +1541,7 @@
G_CALLBACK (trust_sign_clicked), swidget);
/* TODO: Hookup revoke handler */
- if (etype == SKEY_PUBLIC ) {
+ if (etype == SEAHORSE_USAGE_PUBLIC_KEY ) {
show_glade_widget (swidget, "signatures-revoke-button", FALSE);
show_glade_widget (swidget, "signatures-delete-button", FALSE);
@@ -1587,11 +1596,11 @@
pkey = SEAHORSE_PGP_KEY (skey);
keyloc = seahorse_key_get_location (skey);
- if (seahorse_key_get_etype (skey) != SKEY_PUBLIC)
+ if (seahorse_key_get_usage (skey) != SEAHORSE_USAGE_PUBLIC_KEY)
return;
/* Remote keys */
- if (keyloc < SKEY_LOC_LOCAL) {
+ if (keyloc < SEAHORSE_LOCATION_LOCAL) {
show_glade_widget (swidget, "manual-trust-area", FALSE);
show_glade_widget (swidget, "manage-trust-area", TRUE);
@@ -1805,7 +1814,7 @@
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 (pkey, "changed", G_CALLBACK (key_changed), swidget);
g_signal_connect_after (pkey, "destroy", G_CALLBACK (key_destroyed), swidget);
@@ -1842,7 +1851,7 @@
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 (pkey, "changed", G_CALLBACK (key_changed), swidget);
g_signal_connect_after (pkey, "destroy", G_CALLBACK (key_destroyed), swidget);
@@ -1868,26 +1877,26 @@
void
seahorse_pgp_key_properties_show (SeahorsePGPKey *pkey, GtkWindow *parent)
{
- SeahorseKey *skey = SEAHORSE_KEY (pkey);
- SeahorseKeySource *sksrc;
+ SeahorseObject *sobj = SEAHORSE_OBJECT (pkey);
+ SeahorseSource *sksrc;
SeahorseWidget *swidget;
gboolean remote;
- remote = seahorse_key_get_location (skey) == SKEY_LOC_REMOTE;
+ remote = seahorse_object_get_location (sobj) == SEAHORSE_LOCATION_REMOTE;
/* Reload the key to make sure to get all the props */
- sksrc = seahorse_key_get_source (skey);
+ sksrc = seahorse_object_get_source (sobj);
g_return_if_fail (sksrc != NULL);
/* Don't trigger the import of remote keys if possible */
if (!remote) {
/* This causes the key source to get any specific info about the key */
- seahorse_key_source_load_sync (sksrc, seahorse_key_get_keyid (skey));
- skey = seahorse_context_get_key (SCTX_APP(), sksrc, seahorse_key_get_keyid (skey));
- g_return_if_fail (skey != NULL);
+ seahorse_source_load_sync (sksrc, seahorse_object_get_id (sobj));
+ sobj = seahorse_context_get_object (SCTX_APP(), sksrc, seahorse_object_get_id (sobj));
+ g_return_if_fail (sobj != NULL);
}
- if (seahorse_key_get_etype (skey) == SKEY_PUBLIC)
+ if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PUBLIC_KEY)
swidget = setup_public_properties (pkey, parent);
else
swidget = setup_private_properties (pkey, parent);
Modified: trunk/pgp/seahorse-pgp-key.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key.c (original)
+++ trunk/pgp/seahorse-pgp-key.c Thu Jul 17 01:41:51 2008
@@ -25,7 +25,7 @@
#include <glib/gi18n.h>
#include "seahorse-context.h"
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#include "seahorse-gtkstock.h"
#include "pgp/seahorse-gpgmex.h"
@@ -131,16 +131,17 @@
changed_key (SeahorsePGPKey *pkey)
{
SeahorseKey *skey = SEAHORSE_KEY (pkey);
+ SeahorseObject *obj = SEAHORSE_OBJECT (pkey);
- skey->keyid = 0;
- skey->ktype = SEAHORSE_PGP;
+ obj->_id = 0;
+ obj->_tag = SEAHORSE_PGP;
if (!pkey->pubkey) {
- 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;
@@ -148,25 +149,25 @@
/* The key id */
if (pkey->pubkey->subkeys) {
- skey->keyid = seahorse_pgp_key_get_cannonical_id (pkey->pubkey->subkeys->keyid);
+ obj->_id = seahorse_pgp_key_get_cannonical_id (pkey->pubkey->subkeys->keyid);
skey->rawid = pkey->pubkey->subkeys->keyid;
}
/* The location */
if (pkey->pubkey->keylist_mode & GPGME_KEYLIST_MODE_EXTERN &&
- skey->location <= SKEY_LOC_REMOTE)
- skey->location = SKEY_LOC_REMOTE;
+ obj->_location <= SEAHORSE_LOCATION_REMOTE)
+ obj->_location = SEAHORSE_LOCATION_REMOTE;
- else if (skey->location <= SKEY_LOC_LOCAL)
- skey->location = SKEY_LOC_LOCAL;
+ else if (obj->_location <= SEAHORSE_LOCATION_LOCAL)
+ obj->_location = SEAHORSE_LOCATION_LOCAL;
/* The type */
if (pkey->seckey) {
- skey->etype = SKEY_PRIVATE;
- skey->keydesc = _("Public PGP Key");
- } else {
- skey->etype = SKEY_PUBLIC;
+ obj->_usage = SEAHORSE_USAGE_PRIVATE_KEY;
skey->keydesc = _("Private PGP Key");
+ } else {
+ obj->_usage = SEAHORSE_USAGE_PUBLIC_KEY;
+ skey->keydesc = _("Public PGP Key");
}
/* The info loaded */
@@ -177,38 +178,38 @@
skey->loaded = SKEY_INFO_BASIC;
/* The flags */
- skey->flags = 0;
+ obj->_flags = 0;
if (!pkey->pubkey->disabled && !pkey->pubkey->expired &&
!pkey->pubkey->revoked && !pkey->pubkey->invalid)
{
if (calc_validity (pkey) >= SEAHORSE_VALIDITY_MARGINAL)
- skey->flags |= SKEY_FLAG_IS_VALID;
+ obj->_flags |= SKEY_FLAG_IS_VALID;
if (pkey->pubkey->can_encrypt)
- skey->flags |= SKEY_FLAG_CAN_ENCRYPT;
+ obj->_flags |= SKEY_FLAG_CAN_ENCRYPT;
if (pkey->seckey && pkey->pubkey->can_sign)
- skey->flags |= SKEY_FLAG_CAN_SIGN;
+ obj->_flags |= SKEY_FLAG_CAN_SIGN;
}
if (pkey->pubkey->expired)
- skey->flags |= SKEY_FLAG_EXPIRED;
+ obj->_flags |= SKEY_FLAG_EXPIRED;
if (pkey->pubkey->revoked)
- skey->flags |= SKEY_FLAG_REVOKED;
+ obj->_flags |= SKEY_FLAG_REVOKED;
if (pkey->pubkey->disabled)
- skey->flags |= SKEY_FLAG_DISABLED;
+ obj->_flags |= SKEY_FLAG_DISABLED;
if (calc_trust (pkey) >= SEAHORSE_VALIDITY_MARGINAL &&
!pkey->pubkey->revoked && !pkey->pubkey->disabled &&
!pkey->pubkey->expired)
- skey->flags |= SKEY_FLAG_TRUSTED;
+ obj->_flags |= SKEY_FLAG_TRUSTED;
}
- if (!skey->keyid)
- skey->keyid = g_quark_from_string (SEAHORSE_PGP_STR ":UNKNOWN UNKNOWN ");
+ if (!obj->_id)
+ obj->_id = g_quark_from_string (SEAHORSE_PGP_STR ":UNKNOWN UNKNOWN ");
- seahorse_key_changed (skey, SKEY_CHANGE_ALL);
+ seahorse_object_fire_changed (obj, SEAHORSE_OBJECT_CHANGE_ALL);
}
@@ -374,7 +375,7 @@
case PROP_STOCK_ID:
/* We use a pointer so we don't copy the string every time */
g_value_set_pointer (value,
- skey->etype == SKEY_PRIVATE ? SEAHORSE_STOCK_SECRET : SEAHORSE_STOCK_KEY);
+ SEAHORSE_OBJECT (skey)->_usage == SEAHORSE_USAGE_PRIVATE_KEY ? SEAHORSE_STOCK_SECRET : SEAHORSE_STOCK_KEY);
break;
}
}
@@ -505,16 +506,12 @@
* Returns: A new #SeahorsePGPKey
**/
SeahorsePGPKey*
-seahorse_pgp_key_new (SeahorseKeySource *sksrc, gpgme_key_t pubkey,
+seahorse_pgp_key_new (SeahorseSource *sksrc, gpgme_key_t pubkey,
gpgme_key_t seckey)
{
SeahorsePGPKey *pkey;
pkey = g_object_new (SEAHORSE_TYPE_PGP_KEY, "key-source", sksrc,
"pubkey", pubkey, "seckey", seckey, NULL);
-
- /* We don't care about this floating business */
- g_object_ref (GTK_OBJECT (pkey));
- gtk_object_sink (GTK_OBJECT (pkey));
return pkey;
}
@@ -835,16 +832,16 @@
guint
seahorse_pgp_key_get_sigtype (SeahorsePGPKey *pkey, gpgme_key_sig_t signature)
{
- SeahorseKey *skey;
- GQuark keyid;
+ SeahorseObject *sobj;
+ GQuark id;
- keyid = seahorse_pgp_key_get_cannonical_id (signature->keyid);
- skey = seahorse_context_find_key (SCTX_APP (), keyid, SKEY_LOC_LOCAL);
+ id = seahorse_pgp_key_get_cannonical_id (signature->keyid);
+ sobj = seahorse_context_find_object (SCTX_APP (), id, SEAHORSE_LOCATION_LOCAL);
- if (skey) {
- if (seahorse_key_get_etype (skey) == SKEY_PRIVATE)
+ if (sobj) {
+ if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY)
return SKEY_PGPSIG_TRUSTED | SKEY_PGPSIG_PERSONAL;
- if (seahorse_key_get_flags (skey) & SKEY_FLAG_TRUSTED)
+ if (seahorse_object_get_flags (sobj) & SKEY_FLAG_TRUSTED)
return SKEY_PGPSIG_TRUSTED;
}
Modified: trunk/pgp/seahorse-pgp-key.h
==============================================================================
--- trunk/pgp/seahorse-pgp-key.h (original)
+++ trunk/pgp/seahorse-pgp-key.h Thu Jul 17 01:41:51 2008
@@ -82,7 +82,7 @@
SeahorseKeyClass parent_class;
};
-SeahorsePGPKey* seahorse_pgp_key_new (SeahorseKeySource *sksrc,
+SeahorsePGPKey* seahorse_pgp_key_new (SeahorseSource *sksrc,
gpgme_key_t pubkey,
gpgme_key_t seckey);
Modified: trunk/pgp/seahorse-pgp-keysets.c
==============================================================================
--- trunk/pgp/seahorse-pgp-keysets.c (original)
+++ trunk/pgp/seahorse-pgp-keysets.c Thu Jul 17 01:41:51 2008
@@ -22,6 +22,7 @@
#include "config.h"
#include "seahorse-gconf.h"
+#include "seahorse-key.h"
#include "seahorse-pgp-module.h"
#include "seahorse-pgp-keysets.h"
@@ -32,16 +33,22 @@
static void
pgp_signers_gconf_notify (GConfClient *client, guint id, GConfEntry *entry,
- SeahorseKeyset *skset)
+ SeahorseSet *skset)
{
/* Default key changed, refresh */
- seahorse_keyset_refresh (skset);
+ seahorse_set_refresh (skset);
}
static gboolean
-pgp_signers_match (SeahorseKey *key, gpointer data)
+pgp_signers_match (SeahorseObject *obj, gpointer data)
{
- SeahorseKey *defkey = seahorse_context_get_default_key (SCTX_APP ());
+ SeahorseKey *key, *defkey;
+
+ if (!SEAHORSE_IS_KEY (obj))
+ return FALSE;
+
+ key = SEAHORSE_KEY (obj);
+ defkey = seahorse_context_get_default_key (SCTX_APP ());
/* Default key overrides all, and becomes the only signer available*/
if (defkey && seahorse_key_get_keyid (key) != seahorse_key_get_keyid (defkey))
@@ -50,20 +57,20 @@
return TRUE;
}
-SeahorseKeyset*
+SeahorseSet*
seahorse_keyset_pgp_signers_new ()
{
- SeahorseKeyPredicate *pred = g_new0(SeahorseKeyPredicate, 1);
- SeahorseKeyset *skset;
+ SeahorseObjectPredicate *pred = g_new0(SeahorseObjectPredicate, 1);
+ SeahorseSet *skset;
- pred->location = SKEY_LOC_LOCAL;
- pred->ktype = SEAHORSE_PGP;
- pred->etype = SKEY_PRIVATE;
+ pred->location = SEAHORSE_LOCATION_LOCAL;
+ pred->id = SEAHORSE_PGP;
+ pred->usage = SEAHORSE_USAGE_PRIVATE_KEY;
pred->flags = SKEY_FLAG_CAN_SIGN;
pred->nflags = SKEY_FLAG_EXPIRED | SKEY_FLAG_REVOKED | SKEY_FLAG_DISABLED;
pred->custom = pgp_signers_match;
- skset = seahorse_keyset_new_full (pred);
+ skset = seahorse_set_new_full (pred);
g_object_set_data_full (G_OBJECT (skset), "pgp-signers-predicate", pred, g_free);
seahorse_gconf_notify_lazy (SEAHORSE_DEFAULT_KEY,
Modified: trunk/pgp/seahorse-pgp-keysets.h
==============================================================================
--- trunk/pgp/seahorse-pgp-keysets.h (original)
+++ trunk/pgp/seahorse-pgp-keysets.h Thu Jul 17 01:41:51 2008
@@ -22,12 +22,12 @@
#ifndef SEAPGPKEYSETS_H_
#define SEAPGPKEYSETS_H_
-#include "seahorse-keyset.h"
+#include "seahorse-set.h"
/* -----------------------------------------------------------------------------
* SOME COMMON KEYSETS
*/
-SeahorseKeyset* seahorse_keyset_pgp_signers_new ();
+SeahorseSet* seahorse_keyset_pgp_signers_new ();
#endif /*SEAPGPKEYSETS_H_*/
Modified: trunk/pgp/seahorse-pgp-sign.c
==============================================================================
--- trunk/pgp/seahorse-pgp-sign.c (original)
+++ trunk/pgp/seahorse-pgp-sign.c Thu Jul 17 01:41:51 2008
@@ -26,7 +26,7 @@
#include "seahorse-key-widget.h"
#include "seahorse-util.h"
-#include "seahorse-keyset.h"
+#include "seahorse-set.h"
#include "seahorse-gtkstock.h"
#include "seahorse-combo-keys.h"
#include "seahorse-gconf.h"
@@ -87,7 +87,7 @@
signer = seahorse_combo_keys_get_active (GTK_COMBO_BOX (w));
g_assert (!signer || (SEAHORSE_IS_PGP_KEY (signer) &&
- seahorse_key_get_etype (signer) == SKEY_PRIVATE));
+ seahorse_key_get_usage (signer) == SEAHORSE_USAGE_PRIVATE_KEY));
err = seahorse_pgp_key_op_sign (SEAHORSE_PGP_KEY (skey),
SEAHORSE_PGP_KEY (signer),
@@ -110,9 +110,9 @@
}
static void
-keyset_changed (SeahorseKeyset *skset, GtkWidget *widget)
+keyset_changed (SeahorseSet *skset, GtkWidget *widget)
{
- if (seahorse_keyset_get_count (skset) <= 1)
+ if (seahorse_set_get_count (skset) <= 1)
gtk_widget_hide (widget);
else
gtk_widget_show (widget);
@@ -141,7 +141,7 @@
void
seahorse_pgp_sign_prompt (SeahorsePGPKey *pkey, guint uid, GtkWindow *parent)
{
- SeahorseKeyset *skset;
+ SeahorseSet *skset;
GtkWidget *w;
gint response;
SeahorseWidget *swidget;
@@ -153,7 +153,7 @@
skset = seahorse_keyset_pgp_signers_new ();
/* If no signing keys then we can't sign */
- if (seahorse_keyset_get_count (skset) == 0) {
+ if (seahorse_set_get_count (skset) == 0) {
/* TODO: We should be giving an error message that allows them to
generate or import a key */
seahorse_util_show_error (NULL, _("No keys usable for signing"),
Modified: trunk/pgp/seahorse-pgp-source.c
==============================================================================
--- trunk/pgp/seahorse-pgp-source.c (original)
+++ trunk/pgp/seahorse-pgp-source.c Thu Jul 17 01:41:51 2008
@@ -249,7 +249,7 @@
GList *orphan_secret; /* Orphan secret keys */
};
-G_DEFINE_TYPE (SeahorsePGPSource, seahorse_pgp_source, SEAHORSE_TYPE_KEY_SOURCE);
+G_DEFINE_TYPE (SeahorsePGPSource, seahorse_pgp_source, SEAHORSE_TYPE_SOURCE);
/* GObject handlers */
static void seahorse_pgp_source_dispose (GObject *gobject);
@@ -259,17 +259,17 @@
static void seahorse_pgp_source_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
-/* SeahorseKeySource methods */
-static SeahorseOperation* seahorse_pgp_source_load (SeahorseKeySource *src,
+/* SeahorseSource methods */
+static SeahorseOperation* seahorse_pgp_source_load (SeahorseSource *src,
GQuark keyid);
-static SeahorseOperation* seahorse_pgp_source_import (SeahorseKeySource *sksrc,
+static SeahorseOperation* seahorse_pgp_source_import (SeahorseSource *sksrc,
GInputStream *input);
-static SeahorseOperation* seahorse_pgp_source_export (SeahorseKeySource *sksrc,
+static SeahorseOperation* seahorse_pgp_source_export (SeahorseSource *sksrc,
GList *keys,
gboolean complete,
GOutputStream *output);
-static gboolean seahorse_pgp_source_remove (SeahorseKeySource *sksrc,
- SeahorseKey *skey,
+static gboolean seahorse_pgp_source_remove (SeahorseSource *sksrc,
+ SeahorseObject *sobj,
guint name,
GError **error);
@@ -288,7 +288,7 @@
seahorse_pgp_source_class_init (SeahorsePGPSourceClass *klass)
{
GObjectClass *gobject_class;
- SeahorseKeySourceClass *key_class;
+ SeahorseSourceClass *key_class;
g_message ("init gpgme version %s", gpgme_check_version (NULL));
@@ -304,8 +304,8 @@
gobject_class->set_property = seahorse_pgp_source_set_property;
gobject_class->get_property = seahorse_pgp_source_get_property;
- key_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
- key_class->canonize_keyid = seahorse_pgp_key_get_cannonical_id;
+ key_class = SEAHORSE_SOURCE_CLASS (klass);
+ key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
key_class->load = seahorse_pgp_source_load;
key_class->import = seahorse_pgp_source_import;
key_class->export = seahorse_pgp_source_export;
@@ -320,8 +320,8 @@
NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseKeyLoc",
- 0, G_MAXUINT, SKEY_LOC_INVALID, G_PARAM_READABLE));
+ g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
+ 0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));
seahorse_registry_register_type (NULL, SEAHORSE_TYPE_PGP_SOURCE, "key-source", "local", SEAHORSE_PGP_STR, NULL);
@@ -444,7 +444,7 @@
g_value_set_string (value, _("PGP Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SKEY_LOC_LOCAL);
+ g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
break;
}
}
@@ -455,11 +455,11 @@
static void
-key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseKeySource *sksrc)
+key_changed (SeahorseKey *skey, SeahorseKeyChange change, SeahorseSource *sksrc)
{
SeahorsePGPKey *pkey;
SeahorsePGPSource *psrc;
- SeahorseKeyEType etype;
+ SeahorseUsage etype;
SeahorseLoadOperation *lop;
const gchar *patterns[2];
guint parts;
@@ -471,7 +471,7 @@
if (change == SKEY_CHANGE_ALL)
return;
- etype = seahorse_key_get_etype (skey);
+ etype = seahorse_key_get_usage (skey);
g_return_if_fail (SEAHORSE_IS_PGP_KEY (skey));
pkey = SEAHORSE_PGP_KEY (skey);
@@ -498,14 +498,14 @@
lop = seahorse_load_operation_start (psrc, patterns, parts, FALSE);
seahorse_multi_operation_take (psrc->pv->operations, SEAHORSE_OPERATION (lop));
- if (etype == SKEY_PRIVATE) {
+ if (etype == SEAHORSE_USAGE_PRIVATE_KEY) {
lop = seahorse_load_operation_start (psrc, patterns, parts, TRUE);
seahorse_multi_operation_take (psrc->pv->operations, SEAHORSE_OPERATION (lop));
}
}
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);
@@ -517,11 +517,11 @@
{
/* This function gets called as a GHRFunc on the lctx->checks hashtable. */
GQuark keyid = GPOINTER_TO_UINT (kt);
- SeahorseKey *skey;
+ SeahorseObject *sobj;
- skey = seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (psrc), keyid);
- if (skey != NULL)
- seahorse_context_remove_key (SCTX_APP (), skey);
+ sobj = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (psrc), keyid);
+ if (sobj != NULL)
+ seahorse_context_remove_object (SCTX_APP (), sobj);
}
/* Add a key to the context */
@@ -539,7 +539,7 @@
g_return_val_if_fail (keyid, NULL);
g_assert (SEAHORSE_IS_PGP_SOURCE (psrc));
- prev = SEAHORSE_PGP_KEY (seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (psrc), keyid));
+ prev = SEAHORSE_PGP_KEY (seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (psrc), keyid));
/* Check if we can just replace the key on the object */
if (prev != NULL) {
@@ -557,7 +557,7 @@
/* Create a new key with secret */
if (key->secret) {
- pkey = seahorse_pgp_key_new (SEAHORSE_KEY_SOURCE (psrc), NULL, key);
+ pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (psrc), NULL, key);
/* Since we don't have a public key yet, save this away */
psrc->pv->orphan_secret = g_list_append (psrc->pv->orphan_secret, pkey);
@@ -589,14 +589,14 @@
}
if (pkey == NULL)
- pkey = seahorse_pgp_key_new (SEAHORSE_KEY_SOURCE (psrc), key, NULL);
+ pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (psrc), key, NULL);
/* We listen in to get notified of changes on this key */
- g_signal_connect (pkey, "changed", G_CALLBACK (key_changed), SEAHORSE_KEY_SOURCE (psrc));
- g_signal_connect (pkey, "destroy", G_CALLBACK (key_destroyed), SEAHORSE_KEY_SOURCE (psrc));
+ g_signal_connect (pkey, "changed", G_CALLBACK (key_changed), SEAHORSE_SOURCE (psrc));
+ g_signal_connect (pkey, "destroy", G_CALLBACK (key_destroyed), SEAHORSE_SOURCE (psrc));
/* Add to context */
- seahorse_context_take_key (SCTX_APP (), SEAHORSE_KEY (pkey));
+ seahorse_context_take_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
if (pkey->photoids)
gpgmex_photo_id_free_all (pkey->photoids);
@@ -616,7 +616,7 @@
DEBUG_REFRESH ("scheduled refresh event ocurring now\n");
cancel_scheduled_refresh (psrc);
- seahorse_key_source_load_async (SEAHORSE_KEY_SOURCE (psrc), 0);
+ seahorse_source_load_async (SEAHORSE_SOURCE (psrc), 0);
return FALSE; /* don't run again */
}
@@ -816,7 +816,7 @@
SeahorseLoadOperation *lop;
gpgme_error_t err;
GList *keys, *l;
- SeahorseKey *skey;
+ SeahorseObject *sobj;
g_assert (SEAHORSE_IS_PGP_SOURCE (psrc));
priv = psrc->pv;
@@ -843,12 +843,12 @@
if (!pattern) {
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 (psrc));
+ keys = seahorse_context_get_objects (SCTX_APP (), SEAHORSE_SOURCE (psrc));
for (l = keys; l; l = g_list_next (l)) {
- skey = SEAHORSE_KEY (l->data);
- if (secret && seahorse_key_get_etype (skey) != SKEY_PRIVATE)
+ sobj = SEAHORSE_OBJECT (l->data);
+ if (secret && seahorse_object_get_usage (sobj) != SEAHORSE_USAGE_PRIVATE_KEY)
continue;
- 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);
@@ -867,11 +867,11 @@
static void
prepare_import_results (SeahorsePGPOperation *pop, SeahorsePGPSource *psrc)
{
- SeahorseKey *skey;
+ SeahorseObject *sobj;
SeahorseLoadOperation *lop;
gpgme_import_result_t results;
gpgme_import_status_t import;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
GList *keys = NULL;
const gchar **patterns = NULL;
GError *err = NULL;
@@ -879,7 +879,7 @@
GQuark keyid;
guint i;
- sksrc = SEAHORSE_KEY_SOURCE (psrc);
+ sksrc = SEAHORSE_SOURCE (psrc);
/* Figure out which keys were imported */
results = gpgme_op_import_result (pop->gctx);
@@ -929,14 +929,14 @@
continue;
}
- skey = seahorse_context_get_key (SCTX_APP (), sksrc, keyid);
- if (skey == NULL) {
+ sobj = seahorse_context_get_object (SCTX_APP (), sksrc, keyid);
+ if (sobj == NULL) {
g_warning ("imported key but then couldn't find it in keyring: %s",
import->fpr);
continue;
}
- keys = g_list_prepend (keys, skey);
+ keys = g_list_prepend (keys, sobj);
}
}
@@ -949,14 +949,14 @@
*/
static SeahorseOperation*
-seahorse_pgp_source_load (SeahorseKeySource *src, GQuark keyid)
+seahorse_pgp_source_load (SeahorseSource *src, GQuark keyid)
{
SeahorsePGPSource *psrc;
SeahorseLoadOperation *lop;
const gchar *match = NULL;
const gchar *patterns[2];
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
psrc = SEAHORSE_PGP_SOURCE (src);
/* Schedule a dummy refresh. This blocks all monitoring for a while */
@@ -987,7 +987,7 @@
}
static SeahorseOperation*
-seahorse_pgp_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_pgp_source_import (SeahorseSource *sksrc, GInputStream *input)
{
SeahorsePGPOperation *pop;
SeahorsePGPSource *psrc;
@@ -1019,7 +1019,7 @@
}
static SeahorseOperation*
-seahorse_pgp_source_export (SeahorseKeySource *sksrc, GList *keys,
+seahorse_pgp_source_export (SeahorseSource *sksrc, GList *keys,
gboolean complete, GOutputStream *output)
{
SeahorsePGPOperation *pop;
@@ -1063,14 +1063,14 @@
pkey = SEAHORSE_PGP_KEY (l->data);
skey = SEAHORSE_KEY (l->data);
- g_return_val_if_fail (skey->sksrc == sksrc, NULL);
+ g_return_val_if_fail (seahorse_object_get_source (SEAHORSE_OBJECT (skey)) == sksrc, NULL);
/* Building list */
keyid = seahorse_pgp_key_get_id (pkey->pubkey, 0);
g_array_append_val (ctx->keyids, keyid);
/* Exporting of secret keys is synchronous */
- if (complete && skey->etype == SKEY_PRIVATE) {
+ if (complete && SEAHORSE_OBJECT (skey)->_usage == SEAHORSE_USAGE_PRIVATE_KEY) {
gerr = gpgmex_op_export_secret (pop->gctx,
seahorse_pgp_key_get_id (pkey->seckey, 0), data);
@@ -1092,27 +1092,27 @@
}
static gboolean
-seahorse_pgp_source_remove (SeahorseKeySource *sksrc, SeahorseKey *skey,
+seahorse_pgp_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
guint name, GError **error)
{
gpgme_error_t gerr;
g_assert (!error || !*error);
- g_assert (seahorse_key_get_source (skey) == sksrc);
+ g_assert (seahorse_object_get_source (sobj) == sksrc);
if (name > 0)
- gerr = seahorse_pgp_key_op_del_uid (SEAHORSE_PGP_KEY (skey), name);
- else if (seahorse_key_get_etype (skey) == SKEY_PRIVATE)
- gerr = seahorse_pgp_key_pair_op_delete (SEAHORSE_PGP_KEY (skey));
+ gerr = seahorse_pgp_key_op_del_uid (SEAHORSE_PGP_KEY (sobj), name);
+ else if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY)
+ gerr = seahorse_pgp_key_pair_op_delete (SEAHORSE_PGP_KEY (sobj));
else
- gerr = seahorse_pgp_key_op_delete (SEAHORSE_PGP_KEY (skey));
+ gerr = seahorse_pgp_key_op_delete (SEAHORSE_PGP_KEY (sobj));
if (!GPG_IS_OK (gerr)) {
seahorse_gpgme_to_error (gerr, error);
return FALSE;
}
- seahorse_key_source_load_async (sksrc, 0);
+ seahorse_source_load_async (sksrc, 0);
return TRUE;
}
Modified: trunk/pgp/seahorse-pgp-source.h
==============================================================================
--- trunk/pgp/seahorse-pgp-source.h (original)
+++ trunk/pgp/seahorse-pgp-source.h Thu Jul 17 01:41:51 2008
@@ -22,7 +22,7 @@
/**
* SeahorsePGPSource: A key source for PGP keys retrieved from GPGME.
*
- * - Derived from SeahorseKeySource
+ * - Derived from SeahorseSource
* - Since GPGME represents secret keys as seperate from public keys, this
* class takes care to combine them into one logical SeahorsePGPKey object.
* - Adds the keys it loads to the SeahorseContext.
@@ -33,14 +33,14 @@
* Properties:
* ktype: (GQuark) The ktype (ie: SEAHORSE_PGP) of keys originating from this
key source.
- * location: (SeahorseKeyLoc) The location of keys that come from this
- * source. (ie: SKEY_LOC_LOCAL, SKEY_LOC_REMOTE)
+ * location: (SeahorseLocation) The location of keys that come from this
+ * source. (ie: SEAHORSE_LOCATION_LOCAL, SEAHORSE_LOCATION_REMOTE)
*/
#ifndef __SEAHORSE_PGP_SOURCE_H__
#define __SEAHORSE_PGP_SOURCE_H__
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#include <gpgme.h>
@@ -56,7 +56,7 @@
typedef struct _SeahorsePGPSourcePrivate SeahorsePGPSourcePrivate;
struct _SeahorsePGPSource {
- SeahorseKeySource parent;
+ SeahorseSource parent;
/*< public >*/
gpgme_ctx_t gctx;
@@ -66,7 +66,7 @@
};
struct _SeahorsePGPSourceClass {
- SeahorseKeySourceClass parent_class;
+ SeahorseSourceClass parent_class;
};
GType seahorse_pgp_source_get_type (void);
Modified: trunk/pgp/seahorse-server-source.c
==============================================================================
--- trunk/pgp/seahorse-server-source.c (original)
+++ trunk/pgp/seahorse-server-source.c Thu Jul 17 01:41:51 2008
@@ -53,7 +53,7 @@
gchar *uri;
};
-G_DEFINE_TYPE (SeahorseServerSource, seahorse_server_source, SEAHORSE_TYPE_KEY_SOURCE);
+G_DEFINE_TYPE (SeahorseServerSource, seahorse_server_source, SEAHORSE_TYPE_SOURCE);
/* GObject handlers */
static void seahorse_server_source_dispose (GObject *gobject);
@@ -63,8 +63,8 @@
static void seahorse_server_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
-/* SeahorseKeySource methods */
-static SeahorseOperation* seahorse_server_source_load (SeahorseKeySource *src, GQuark keyid);
+/* SeahorseSource methods */
+static SeahorseOperation* seahorse_server_source_load (SeahorseSource *src, GQuark keyid);
static GObjectClass *parent_class = NULL;
@@ -73,14 +73,14 @@
seahorse_server_source_class_init (SeahorseServerSourceClass *klass)
{
GObjectClass *gobject_class;
- SeahorseKeySourceClass *key_class;
+ SeahorseSourceClass *key_class;
parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
- key_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
+ key_class = SEAHORSE_SOURCE_CLASS (klass);
- key_class->canonize_keyid = seahorse_pgp_key_get_cannonical_id;
+ key_class->canonize_id = seahorse_pgp_key_get_cannonical_id;
key_class->load = seahorse_server_source_load;
gobject_class->dispose = seahorse_server_source_dispose;
@@ -97,8 +97,8 @@
NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseKeyLoc",
- 0, G_MAXUINT, SKEY_LOC_INVALID, G_PARAM_READABLE));
+ g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
+ 0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_KEY_SERVER,
g_param_spec_string ("key-server", "Key Server",
@@ -125,7 +125,7 @@
seahorse_server_source_dispose (GObject *gobject)
{
SeahorseServerSource *ssrc;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
/*
* Note that after this executes the rest of the object should
@@ -136,7 +136,7 @@
*/
ssrc = SEAHORSE_SERVER_SOURCE (gobject);
- sksrc = SEAHORSE_KEY_SOURCE (gobject);
+ sksrc = SEAHORSE_SOURCE (gobject);
g_assert (ssrc->priv);
/* Clear out all the operations */
@@ -209,7 +209,7 @@
g_value_set_string (value, _("PGP Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SKEY_LOC_REMOTE);
+ g_value_set_uint (value, SEAHORSE_LOCATION_REMOTE);
break;
}
}
@@ -272,28 +272,28 @@
void
seahorse_server_source_add_key (SeahorseServerSource *ssrc, gpgme_key_t key)
{
- SeahorseKey *prev;
+ SeahorseObject *prev;
SeahorsePGPKey *pkey;
GQuark keyid;
g_return_if_fail (SEAHORSE_IS_SERVER_SOURCE (ssrc));
keyid = seahorse_pgp_key_get_cannonical_id (seahorse_pgp_key_get_id (key, 0));
- prev = seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (ssrc), keyid);
+ prev = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
/* TODO: This function needs reworking after we get more key types */
if (prev != NULL) {
g_return_if_fail (SEAHORSE_IS_PGP_KEY (prev));
combine_keys (ssrc, SEAHORSE_PGP_KEY (prev)->pubkey, key);
- seahorse_key_changed (prev, SKEY_CHANGE_UIDS);
+ seahorse_object_fire_changed (prev, SKEY_CHANGE_UIDS);
return;
}
/* A public key */
- pkey = seahorse_pgp_key_new (SEAHORSE_KEY_SOURCE (ssrc), key, NULL);
+ pkey = seahorse_pgp_key_new (SEAHORSE_SOURCE (ssrc), key, NULL);
/* Add to context */
- seahorse_context_add_key (SCTX_APP (), SEAHORSE_KEY (pkey));
+ seahorse_context_add_object (SCTX_APP (), SEAHORSE_OBJECT (pkey));
}
void
@@ -310,11 +310,11 @@
*/
static SeahorseOperation*
-seahorse_server_source_load (SeahorseKeySource *src, GQuark keyid)
+seahorse_server_source_load (SeahorseSource *src, GQuark keyid)
{
SeahorseServerSource *ssrc;
- g_assert (SEAHORSE_IS_KEY_SOURCE (src));
+ g_assert (SEAHORSE_IS_SOURCE (src));
ssrc = SEAHORSE_SERVER_SOURCE (src);
/* We should never be called directly */
Modified: trunk/pgp/seahorse-server-source.h
==============================================================================
--- trunk/pgp/seahorse-server-source.h (original)
+++ trunk/pgp/seahorse-server-source.h Thu Jul 17 01:41:51 2008
@@ -23,7 +23,7 @@
* SeahorseServerSoruce: A base class for key sources that retrieve keys
* from remote key servers.
*
- * - Derived from SeahorseKeySource.
+ * - Derived from SeahorseSource.
* - Also includes functions for parsing keyserver URIs and mapping them
* to the appropriate key sources (such as SeahorseHKPSource)
* - There's some GPGME specific stuff in here that may eventually need to be
@@ -31,7 +31,7 @@
*
* Properties:
* key-type: (GQuark) The type of keys generated (ie: SKEY_PGP)
- * location: (gchar*) The location of keys from this key source (ie: SKEY_LOC_REMOTE)
+ * location: (gchar*) The location of keys from this key source (ie: SEAHORSE_LOCATION_REMOTE)
* key-server: (gchar*) The host:port of the keyserver to search.
* uri: (gchar*) Only for remote key sources. The full URI of the keyserver
* being used.
@@ -40,7 +40,7 @@
#ifndef __SEAHORSE_SERVER_SOURCE_H__
#define __SEAHORSE_SERVER_SOURCE_H__
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#include "seahorse-operation.h"
#define SEAHORSE_TYPE_SERVER_SOURCE (seahorse_server_source_get_type ())
@@ -55,14 +55,14 @@
typedef struct _SeahorseServerSourcePrivate SeahorseServerSourcePrivate;
struct _SeahorseServerSource {
- SeahorseKeySource parent;
+ SeahorseSource parent;
/*< private >*/
SeahorseServerSourcePrivate *priv;
};
struct _SeahorseServerSourceClass {
- SeahorseKeySourceClass parent_class;
+ SeahorseSourceClass parent_class;
};
GType seahorse_server_source_get_type (void);
Modified: trunk/pgp/seahorse-signer.c
==============================================================================
--- trunk/pgp/seahorse-signer.c (original)
+++ trunk/pgp/seahorse-signer.c Thu Jul 17 01:41:51 2008
@@ -41,7 +41,7 @@
seahorse_signer_get (GtkWindow *parent)
{
SeahorseWidget *swidget;
- SeahorseKeyset *skset;
+ SeahorseSet *skset;
SeahorseKey *skey = NULL;
GtkWidget *combo;
GtkWidget *widget;
@@ -52,7 +52,7 @@
guint nkeys;
skset = seahorse_keyset_pgp_signers_new ();
- nkeys = seahorse_keyset_get_count (skset);
+ nkeys = seahorse_set_get_count (skset);
/* If no signing keys then we can't sign */
if (nkeys == 0) {
@@ -65,7 +65,7 @@
/* If only one key (probably default) then return it immediately */
if (nkeys == 1) {
- GList *keys = seahorse_keyset_get_keys (skset);
+ GList *keys = seahorse_set_get_objects (skset);
skey = SEAHORSE_KEY (keys->data);
g_list_free (keys);
Modified: trunk/pgp/vala-build.stamp
==============================================================================
--- trunk/pgp/vala-build.stamp (original)
+++ trunk/pgp/vala-build.stamp Thu Jul 17 01:41:51 2008
@@ -1 +1 @@
-1216229823
+1216254293
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Thu Jul 17 01:41:51 2008
@@ -78,7 +78,7 @@
/* Make the default SeahorseContext */
seahorse_context_new (SEAHORSE_CONTEXT_APP, 0);
- op = seahorse_context_load_local_keys (SCTX_APP ());
+ op = seahorse_context_load_local_objects (SCTX_APP ());
/* Load these components after loading local keys */
seahorse_registry_load_types (NULL, SEAHORSE_GKR_REGISTRY);
Modified: trunk/src/seahorse-key-manager-store.c
==============================================================================
--- trunk/src/seahorse-key-manager-store.c (original)
+++ trunk/src/seahorse-key-manager-store.c Thu Jul 17 01:41:51 2008
@@ -274,7 +274,7 @@
static gboolean
refilter_now (SeahorseKeyManagerStore* skstore)
{
- seahorse_keyset_refresh (skstore->skset);
+ seahorse_set_refresh (skstore->skset);
gtk_tree_model_filter_refilter (skstore->priv->filter);
skstore->priv->filter_stag = 0;
return FALSE;
@@ -295,8 +295,8 @@
GtkTreeIter *iter)
{
SeahorseValidity validity, trust;
- SeahorseKeyPredicate *pred;
- SeahorseKeySource *sksrc;
+ SeahorseObjectPredicate *pred;
+ SeahorseSource *sksrc;
const gchar *stockid;
gulong expires_date;
gchar *markup;
@@ -305,7 +305,7 @@
gchar *type;
markup = seahorse_key_get_name_markup (skey, uid);
- sec = seahorse_key_get_etype (skey) == SKEY_PRIVATE;
+ sec = seahorse_key_get_usage (skey) == SEAHORSE_USAGE_PRIVATE_KEY;
stockid = seahorse_key_get_stock_id (skey);
validity = seahorse_key_get_name_validity (skey, uid);
@@ -331,7 +331,7 @@
g_object_get (skstore->skset, "predicate", &pred, NULL);
/* If mixed etypes, then get specific description */
- if (pred->etype == 0 || pred->etype == SKEY_CREDENTIALS) {
+ if (pred->usage == 0 || pred->usage == SEAHORSE_USAGE_CREDENTIALS) {
type = g_strdup (seahorse_key_get_desc (skey));
/* Otherwise general description */
@@ -394,7 +394,7 @@
}
static void
-key_added (SeahorseKeyset *skset, SeahorseKey *skey, SeahorseKeyManagerStore *skstore)
+key_added (SeahorseSet *skset, SeahorseKey *skey, SeahorseKeyManagerStore *skstore)
{
GtkTreeIter iter = { 0, };
guint i, uids = seahorse_key_get_num_names (skey);
@@ -406,14 +406,14 @@
}
static void
-key_removed (SeahorseKeyset *skset, SeahorseKey *skey, gpointer closure,
+key_removed (SeahorseSet *skset, SeahorseKey *skey, gpointer closure,
SeahorseKeyManagerStore *skstore)
{
seahorse_key_model_remove_rows_for_key (SEAHORSE_KEY_MODEL (skstore), skey);
}
static void
-key_changed (SeahorseKeyset *skset, SeahorseKey *skey, SeahorseKeyChange change,
+key_changed (SeahorseSet *skset, SeahorseKey *skey, SeahorseKeyChange change,
gpointer closure, SeahorseKeyManagerStore *skstore)
{
guint i, uid, old_uids, num_uids;
@@ -461,7 +461,7 @@
GList *keys, *list = NULL;
SeahorseKey *skey;
- keys = list = seahorse_keyset_get_keys (skstore->skset);
+ keys = list = seahorse_set_get_objects (skstore->skset);
while (list != NULL && (skey = list->data) != NULL) {
key_added (skstore->skset, skey, skstore);
list = g_list_next (list);
@@ -666,18 +666,18 @@
{
SeahorseMultiOperation *mop = NULL;
SeahorseOperation *op;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseKey *skey;
GList *next;
gboolean ret;
- keys = seahorse_util_keylist_sort (keys);
+ keys = seahorse_util_objects_sort (keys);
DBG_PRINT (("exporting %d keys\n", g_list_length (keys)));
while (keys) {
/* Break off one set (same keysource) */
- next = seahorse_util_keylist_splice (keys);
+ next = seahorse_util_objects_splice (keys);
g_assert (SEAHORSE_IS_KEY (keys->data));
skey = SEAHORSE_KEY (keys->data);
@@ -690,7 +690,7 @@
mop = seahorse_multi_operation_new ();
/* We pass our own data object, to which data is appended */
- op = seahorse_key_source_export (sksrc, keys, FALSE, output);
+ op = seahorse_source_export (sksrc, keys, FALSE, output);
g_return_val_if_fail (op != NULL, FALSE);
seahorse_multi_operation_take (mop, op);
@@ -1020,7 +1020,7 @@
g_object_class_install_property (gobject_class, PROP_KEYSET,
g_param_spec_object ("keyset", "Seahorse Keyset", "Current Seahorse Key Source to use",
- SEAHORSE_TYPE_KEYSET, G_PARAM_READWRITE));
+ SEAHORSE_TYPE_SET, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_MODE,
g_param_spec_uint ("mode", "Key Store Mode", "Key store mode controls which keys to display",
@@ -1036,11 +1036,11 @@
*/
SeahorseKeyManagerStore*
-seahorse_key_manager_store_new (SeahorseKeyset *skset, GtkTreeView *view)
+seahorse_key_manager_store_new (SeahorseSet *skset, GtkTreeView *view)
{
SeahorseKeyManagerStore *skstore;
GtkTreeViewColumn *col;
- SeahorseKeyPredicate *pred;
+ SeahorseObjectPredicate *pred;
GtkCellRenderer *renderer;
gchar *sort;
@@ -1074,13 +1074,13 @@
g_object_get (skset, "predicate", &pred, NULL);
/* Key ID column, don't show for passwords */
- if (pred->etype != SKEY_CREDENTIALS) {
+ if (pred->usage != SEAHORSE_USAGE_CREDENTIALS) {
col = append_text_column (skstore, view, _("Key ID"), COL_KEYID);
gtk_tree_view_column_set_sort_column_id (col, COL_KEYID);
}
/* Public keys show validity */
- if (pred->etype == SKEY_PUBLIC) {
+ if (pred->usage == SEAHORSE_USAGE_PUBLIC_KEY) {
col = append_text_column (skstore, view, _("Validity"), COL_VALIDITY_STR);
g_object_set_data (G_OBJECT (col), "gconf-key", SHOW_VALIDITY_KEY);
gtk_tree_view_column_set_visible (col, seahorse_gconf_get_boolean (SHOW_VALIDITY_KEY));
@@ -1151,7 +1151,7 @@
g_return_val_if_fail (GTK_IS_TREE_VIEW (view), NULL);
skstore = key_store_from_model (gtk_tree_view_get_model (view));
- return seahorse_keyset_get_keys (skstore->skset);
+ return seahorse_set_get_objects (skstore->skset);
}
GList*
Modified: trunk/src/seahorse-key-manager-store.h
==============================================================================
--- trunk/src/seahorse-key-manager-store.h (original)
+++ trunk/src/seahorse-key-manager-store.h Thu Jul 17 01:41:51 2008
@@ -26,7 +26,7 @@
#include <gtk/gtk.h>
#include "seahorse-context.h"
-#include "seahorse-keyset.h"
+#include "seahorse-set.h"
#include "seahorse-key-model.h"
#define SEAHORSE_TYPE_KEY_MANAGER_STORE (seahorse_key_manager_store_get_type ())
@@ -49,7 +49,7 @@
SeahorseKeyModel parent;
/*< public >*/
- SeahorseKeyset *skset;
+ SeahorseSet *skset;
/*< private >*/
SeahorseKeyManagerStorePriv *priv;
@@ -59,7 +59,7 @@
SeahorseKeyModelClass parent_class;
};
-SeahorseKeyManagerStore* seahorse_key_manager_store_new (SeahorseKeyset *skset,
+SeahorseKeyManagerStore* seahorse_key_manager_store_new (SeahorseSet *skset,
GtkTreeView *view);
SeahorseKey* seahorse_key_manager_store_get_key_from_path (GtkTreeView *view,
Modified: trunk/src/seahorse-key-manager.c
==============================================================================
--- trunk/src/seahorse-key-manager.c (original)
+++ trunk/src/seahorse-key-manager.c Thu Jul 17 01:41:51 2008
@@ -20,17 +20,19 @@
*/
#include "seahorse-key-manager.h"
+#include <seahorse-types.h>
+#include <seahorse-key.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>
#include <seahorse-widget.h>
#include <seahorse-progress.h>
#include <seahorse-key-manager-store.h>
-#include <seahorse-keyset.h>
+#include <seahorse-set.h>
#include <seahorse-context.h>
#include <gdk/gdk.h>
#include <seahorse-util.h>
-#include <seahorse-key-source.h>
+#include <seahorse-source.h>
#include <gio/gio.h>
#include <seahorse-windows.h>
#include <seahorse-gconf.h>
@@ -64,7 +66,7 @@
guint id;
gint page;
GtkTreeView* view;
- SeahorseKeyset* keyset;
+ SeahorseSet* objects;
GtkWidget* widget;
SeahorseKeyManagerStore* store;
};
@@ -75,7 +77,7 @@
GtkNotebook* _notebook;
GtkActionGroup* _view_actions;
GtkEntry* _filter_entry;
- GQuark _track_selected_key;
+ GQuark _track_selected_id;
guint _track_selected_tab;
gboolean _loaded_gnome_keyring;
SeahorseKeyManagerTabInfo* _tabs;
@@ -85,15 +87,15 @@
#define SEAHORSE_KEY_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_KEY_MANAGER, SeahorseKeyManagerPrivate))
enum {
SEAHORSE_KEY_MANAGER_DUMMY_PROPERTY,
- SEAHORSE_KEY_MANAGER_SELECTED_KEY
+ SEAHORSE_KEY_MANAGER_SELECTED
};
GType seahorse_key_manager_targets_get_type (void);
GType seahorse_key_manager_tabs_get_type (void);
static SeahorseKeyManager* seahorse_key_manager_new (const char* ident);
-static GList* seahorse_key_manager_real_get_selected_keys (SeahorseView* base);
-static void seahorse_key_manager_real_set_selected_keys (SeahorseView* base, GList* keys);
-static SeahorseKey* seahorse_key_manager_real_get_selected_key_and_uid (SeahorseView* base, guint* uid);
-static SeahorseKeyManagerTabInfo* seahorse_key_manager_get_tab_for_key (SeahorseKeyManager* self, SeahorseKey* key);
+static GList* seahorse_key_manager_real_get_selected_objects (SeahorseView* base);
+static void seahorse_key_manager_real_set_selected_objects (SeahorseView* base, GList* objects);
+static SeahorseObject* seahorse_key_manager_real_get_selected_object_and_uid (SeahorseView* base, guint* uid);
+static SeahorseKeyManagerTabInfo* seahorse_key_manager_get_tab_for_object (SeahorseKeyManager* self, SeahorseObject* obj);
static GtkTreeView* seahorse_key_manager_get_current_view (SeahorseKeyManager* self);
static guint seahorse_key_manager_get_tab_id (SeahorseKeyManager* self, SeahorseKeyManagerTabInfo* tab);
static SeahorseKeyManagerTabInfo* seahorse_key_manager_get_tab_info (SeahorseKeyManager* self, gint page);
@@ -102,7 +104,7 @@
static void _seahorse_key_manager_on_row_activated_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self);
static gboolean _seahorse_key_manager_on_key_list_button_pressed_gtk_widget_button_press_event (GtkTreeView* _sender, GdkEventButton* event, gpointer self);
static gboolean _seahorse_key_manager_on_key_list_popup_menu_gtk_widget_popup_menu (GtkTreeView* _sender, gpointer self);
-static void seahorse_key_manager_initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, const char* viewwidget, SeahorseKeyPredicate* pred);
+static void seahorse_key_manager_initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, const char* viewwidget, SeahorseObjectPredicate* pred);
static gboolean seahorse_key_manager_on_first_timer (SeahorseKeyManager* self);
static void seahorse_key_manager_on_filter_changed (SeahorseKeyManager* self, GtkEntry* entry);
static gboolean _seahorse_key_manager_fire_selection_changed_gsource_func (gpointer self);
@@ -160,10 +162,10 @@
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static int _vala_strcmp0 (const char * str1, const char * str2);
-static const SeahorseKeyPredicate SEAHORSE_KEY_MANAGER_PRED_PUBLIC = {((GQuark) (0)), ((GQuark) (0)), SKEY_LOC_LOCAL, SKEY_PUBLIC, ((guint) (0)), ((guint) (SKEY_FLAG_TRUSTED | SKEY_FLAG_IS_VALID)), NULL};
-static const SeahorseKeyPredicate SEAHORSE_KEY_MANAGER_PRED_TRUSTED = {((GQuark) (0)), ((GQuark) (0)), SKEY_LOC_LOCAL, SKEY_PUBLIC, ((guint) (SKEY_FLAG_TRUSTED | SKEY_FLAG_IS_VALID)), ((guint) (0)), NULL};
-static const SeahorseKeyPredicate SEAHORSE_KEY_MANAGER_PRED_PRIVATE = {((GQuark) (0)), ((GQuark) (0)), SKEY_LOC_LOCAL, SKEY_PRIVATE, ((guint) (0)), ((guint) (0)), NULL};
-static const SeahorseKeyPredicate SEAHORSE_KEY_MANAGER_PRED_PASSWORD = {((GQuark) (0)), ((GQuark) (0)), SKEY_LOC_LOCAL, SKEY_CREDENTIALS, ((guint) (0)), ((guint) (0)), NULL};
+static const SeahorseObjectPredicate SEAHORSE_KEY_MANAGER_PRED_PUBLIC = {((GQuark) (0)), ((GQuark) (0)), SEAHORSE_LOCATION_LOCAL, SEAHORSE_USAGE_PUBLIC_KEY, ((guint) (0)), ((guint) (SKEY_FLAG_TRUSTED | SKEY_FLAG_IS_VALID)), NULL};
+static const SeahorseObjectPredicate SEAHORSE_KEY_MANAGER_PRED_TRUSTED = {((GQuark) (0)), ((GQuark) (0)), SEAHORSE_LOCATION_LOCAL, SEAHORSE_USAGE_PUBLIC_KEY, ((guint) (SKEY_FLAG_TRUSTED | SKEY_FLAG_IS_VALID)), ((guint) (0)), NULL};
+static const SeahorseObjectPredicate SEAHORSE_KEY_MANAGER_PRED_PRIVATE = {((GQuark) (0)), ((GQuark) (0)), SEAHORSE_LOCATION_LOCAL, SEAHORSE_USAGE_PRIVATE_KEY, ((guint) (0)), ((guint) (0)), NULL};
+static const SeahorseObjectPredicate SEAHORSE_KEY_MANAGER_PRED_PASSWORD = {((GQuark) (0)), ((GQuark) (0)), SEAHORSE_LOCATION_LOCAL, SEAHORSE_USAGE_CREDENTIALS, ((guint) (0)), ((guint) (0)), NULL};
static const GtkActionEntry SEAHORSE_KEY_MANAGER_GENERAL_ENTRIES[] = {{"remote-menu", NULL, N_ ("_Remote")}, {"app-quit", GTK_STOCK_QUIT, N_ ("_Quit"), "<control>Q", N_ ("Close this program"), ((GCallback) (NULL))}, {"key-generate", GTK_STOCK_NEW, N_ ("_Create New Key..."), "<control>N", N_ ("Create a new personal key"), ((GCallback) (NULL))}, {"key-import-file", GTK_STOCK_OPEN, N_ ("_Import..."), "<control>I", N_ ("Import keys into your key ring from a file"), ((GCallback) (NULL))}, {"key-import-clipboard", GTK_STOCK_PASTE, N_ ("Paste _Keys"), "<control>V", N_ ("Import keys from the clipboard"), ((GCallback) (NULL))}};
static const GtkActionEntry SEAHORSE_KEY_MANAGER_SERVER_ENTRIES[] = {{"remote-find", GTK_STOCK_FIND, N_ ("_Find Remote Keys..."), "", N_ ("Search for keys on a key server"), ((GCallback) (NULL))}, {"remote-sync", GTK_STOCK_REFRESH, N_ ("_Sync and Publish Keys..."), "", N_ ("Publish and/or synchronize your keys with those online."), ((GCallback) (NULL))}};
static const GtkToggleActionEntry SEAHORSE_KEY_MANAGER_VIEW_ENTRIES[] = {{"view-type", NULL, N_ ("T_ypes"), NULL, N_ ("Show type column"), NULL, FALSE}, {"view-expires", NULL, N_ ("_Expiry"), NULL, N_ ("Show expiry column"), NULL, FALSE}, {"view-trust", NULL, N_ ("_Trust"), NULL, N_ ("Show owner trust column"), NULL, FALSE}, {"view-validity", NULL, N_ ("_Validity"), NULL, N_ ("Show validity column"), NULL, FALSE}};
@@ -225,7 +227,7 @@
}
-static GList* seahorse_key_manager_real_get_selected_keys (SeahorseView* base) {
+static GList* seahorse_key_manager_real_get_selected_objects (SeahorseView* base) {
SeahorseKeyManager * self;
SeahorseKeyManagerTabInfo* tab;
self = SEAHORSE_KEY_MANAGER (base);
@@ -237,7 +239,7 @@
}
-static void seahorse_key_manager_real_set_selected_keys (SeahorseView* base, GList* keys) {
+static void seahorse_key_manager_real_set_selected_objects (SeahorseView* base, GList* objects) {
SeahorseKeyManager * self;
GList** _tmp1;
gint tab_lists_length1;
@@ -246,29 +248,29 @@
guint highest_matched;
SeahorseKeyManagerTabInfo* highest_tab;
self = SEAHORSE_KEY_MANAGER (base);
- g_return_if_fail (keys != NULL);
+ g_return_if_fail (objects != NULL);
_tmp1 = NULL;
tab_lists = (_tmp1 = g_new0 (GList*, (_tmp0 = ((gint) (SEAHORSE_KEY_MANAGER_TABS_NUM_TABS))) + 1), tab_lists_length1 = _tmp0, _tmp1);
- /* Break keys into what's on each tab */
+ /* Break objects into what's on each tab */
{
- GList* key_collection;
- GList* key_it;
- key_collection = keys;
- for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
- SeahorseKey* _tmp2;
- SeahorseKey* key;
+ GList* obj_collection;
+ GList* obj_it;
+ obj_collection = objects;
+ for (obj_it = obj_collection; obj_it != NULL; obj_it = obj_it->next) {
+ SeahorseObject* _tmp2;
+ SeahorseObject* obj;
_tmp2 = NULL;
- key = (_tmp2 = ((SeahorseKey*) (key_it->data)), (_tmp2 == NULL ? NULL : g_object_ref (_tmp2)));
+ obj = (_tmp2 = ((SeahorseObject*) (obj_it->data)), (_tmp2 == NULL ? NULL : g_object_ref (_tmp2)));
{
SeahorseKeyManagerTabInfo* tab;
- tab = seahorse_key_manager_get_tab_for_key (self, key);
+ tab = seahorse_key_manager_get_tab_for_object (self, obj);
if (tab == NULL) {
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
+ (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL)));
continue;
}
g_assert ((*tab).id < ((gint) (SEAHORSE_KEY_MANAGER_TABS_NUM_TABS)));
- tab_lists[(*tab).id] = g_list_prepend (tab_lists[(*tab).id], key);
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
+ tab_lists[(*tab).id] = g_list_prepend (tab_lists[(*tab).id], obj);
+ (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL)));
}
}
}
@@ -283,17 +285,17 @@
guint num;
list = tab_lists[i];
tab = &self->priv->_tabs[i];
- /* Save away the tab that had the most keys */
+ /* Save away the tab that had the most objects */
num = g_list_length (list);
if (num > highest_matched) {
highest_matched = num;
highest_tab = tab;
}
- /* Select the keys on that tab */
+ /* Select the objects on that tab */
seahorse_key_manager_store_set_selected_keys ((*tab).view, list);
}
}
- /* Change to the tab with the most keys */
+ /* Change to the tab with the most objects */
if (highest_tab != NULL) {
seahorse_key_manager_set_tab_current (self, highest_tab);
}
@@ -301,7 +303,7 @@
}
-static SeahorseKey* seahorse_key_manager_real_get_selected_key_and_uid (SeahorseView* base, guint* uid) {
+static SeahorseObject* seahorse_key_manager_real_get_selected_object_and_uid (SeahorseView* base, guint* uid) {
SeahorseKeyManager * self;
SeahorseKeyManagerTabInfo* tab;
self = SEAHORSE_KEY_MANAGER (base);
@@ -309,20 +311,20 @@
if (tab == NULL) {
return NULL;
}
- return seahorse_key_manager_store_get_selected_key ((*tab).view, &(*uid));
+ return SEAHORSE_OBJECT (seahorse_key_manager_store_get_selected_key ((*tab).view, &(*uid)));
}
-static SeahorseKeyManagerTabInfo* seahorse_key_manager_get_tab_for_key (SeahorseKeyManager* self, SeahorseKey* key) {
+static SeahorseKeyManagerTabInfo* seahorse_key_manager_get_tab_for_object (SeahorseKeyManager* self, SeahorseObject* obj) {
g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER (self), NULL);
- g_return_val_if_fail (SEAHORSE_IS_KEY (key), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (obj), NULL);
{
gint i;
i = 0;
for (; i < ((gint) (SEAHORSE_KEY_MANAGER_TABS_NUM_TABS)); (i = i + 1)) {
SeahorseKeyManagerTabInfo* tab;
tab = &self->priv->_tabs[i];
- if (seahorse_keyset_has_key ((*tab).keyset, key)) {
+ if (seahorse_set_has_object ((*tab).objects, obj)) {
return tab;
}
}
@@ -401,8 +403,8 @@
}
-static void seahorse_key_manager_initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, const char* viewwidget, SeahorseKeyPredicate* pred) {
- SeahorseKeyset* keyset;
+static void seahorse_key_manager_initialize_tab (SeahorseKeyManager* self, const char* tabwidget, guint tabid, const char* viewwidget, SeahorseObjectPredicate* pred) {
+ SeahorseSet* objects;
GtkTreeView* _tmp0;
GtkTreeView* view;
SeahorseKeyManagerStore* _tmp1;
@@ -415,8 +417,8 @@
g_return_if_fail (self->priv->_tabs[tabid].widget != NULL);
self->priv->_tabs[tabid].page = gtk_notebook_page_num (self->priv->_notebook, self->priv->_tabs[tabid].widget);
g_return_if_fail (self->priv->_tabs[tabid].page >= 0);
- keyset = seahorse_keyset_new_full (&(*pred));
- self->priv->_tabs[tabid].keyset = keyset;
+ objects = seahorse_set_new_full (&(*pred));
+ self->priv->_tabs[tabid].objects = objects;
/* init key list & selection settings */
_tmp0 = NULL;
view = (_tmp0 = GTK_TREE_VIEW (seahorse_widget_get_widget (SEAHORSE_WIDGET (self), viewwidget)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
@@ -430,8 +432,8 @@
gtk_widget_realize (GTK_WIDGET (view));
/* Add new key store and associate it */
_tmp1 = NULL;
- self->priv->_tabs[tabid].store = (_tmp1 = seahorse_key_manager_store_new (keyset, view), (self->priv->_tabs[tabid].store == NULL ? NULL : (self->priv->_tabs[tabid].store = (g_object_unref (self->priv->_tabs[tabid].store), NULL))), _tmp1);
- (keyset == NULL ? NULL : (keyset = (g_object_unref (keyset), NULL)));
+ self->priv->_tabs[tabid].store = (_tmp1 = seahorse_key_manager_store_new (objects, view), (self->priv->_tabs[tabid].store == NULL ? NULL : (self->priv->_tabs[tabid].store = (g_object_unref (self->priv->_tabs[tabid].store), NULL))), _tmp1);
+ (objects == NULL ? NULL : (objects = (g_object_unref (objects), NULL)));
(view == NULL ? NULL : (view = (g_object_unref (view), NULL)));
}
@@ -492,7 +494,7 @@
_tmp0 = NULL;
key = (_tmp0 = seahorse_key_manager_store_get_key_from_path (view, path, NULL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
if (key != NULL) {
- seahorse_viewer_show_properties (SEAHORSE_VIEWER (self), key);
+ seahorse_viewer_show_properties (SEAHORSE_VIEWER (self), SEAHORSE_OBJECT (key));
}
(key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
}
@@ -509,19 +511,19 @@
static gboolean seahorse_key_manager_on_key_list_popup_menu (SeahorseKeyManager* self, GtkTreeView* view) {
- SeahorseKey* _tmp0;
- SeahorseKey* key;
+ SeahorseObject* _tmp0;
+ SeahorseObject* obj;
gboolean _tmp2;
g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER (self), FALSE);
g_return_val_if_fail (GTK_IS_TREE_VIEW (view), FALSE);
_tmp0 = NULL;
- key = (_tmp0 = seahorse_viewer_get_selected_key (SEAHORSE_VIEWER (self)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
- if (key != NULL) {
+ obj = (_tmp0 = seahorse_viewer_get_selected (SEAHORSE_VIEWER (self)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ if (obj != NULL) {
gboolean _tmp1;
seahorse_viewer_show_context_menu (SEAHORSE_VIEWER (self), ((guint) (0)), gtk_get_current_event_time ());
- return (_tmp1 = TRUE, (key == NULL ? NULL : (key = (g_object_unref (key), NULL))), _tmp1);
+ return (_tmp1 = TRUE, (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL))), _tmp1);
}
- return (_tmp2 = FALSE, (key == NULL ? NULL : (key = (g_object_unref (key), NULL))), _tmp2);
+ return (_tmp2 = FALSE, (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL))), _tmp2);
}
@@ -576,8 +578,8 @@
uri = (_tmp1 = uri_collection[uri_it], (_tmp1 == NULL ? NULL : g_strdup (_tmp1)));
{
GQuark ktype;
- SeahorseKeySource* _tmp0;
- SeahorseKeySource* sksrc;
+ SeahorseSource* _tmp0;
+ SeahorseSource* sksrc;
if (g_utf8_strlen (uri, -1) == 0) {
uri = (g_free (uri), NULL);
continue;
@@ -589,9 +591,9 @@
uri = (g_free (uri), NULL);
continue;
}
- /* All our supported key types have a local key source */
+ /* All our supported key types have a local source */
_tmp0 = NULL;
- sksrc = (_tmp0 = seahorse_context_find_key_source (seahorse_context_for_app (), ktype, SKEY_LOC_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ sksrc = (_tmp0 = seahorse_context_find_source (seahorse_context_for_app (), ktype, SEAHORSE_LOCATION_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
g_return_if_fail (sksrc != NULL);
{
GFile* file;
@@ -602,7 +604,7 @@
if (inner_error != NULL) {
goto __catch4_g_error;
}
- op = seahorse_key_source_import (sksrc, G_INPUT_STREAM (input));
+ op = seahorse_source_import (sksrc, G_INPUT_STREAM (input));
seahorse_multi_operation_take (mop, op);
(file == NULL ? NULL : (file = (g_object_unref (file), NULL)));
(input == NULL ? NULL : (input = (g_object_unref (input), NULL)));
@@ -685,8 +687,8 @@
static void seahorse_key_manager_import_text (SeahorseKeyManager* self, const char* text) {
glong len;
GQuark ktype;
- SeahorseKeySource* _tmp0;
- SeahorseKeySource* sksrc;
+ SeahorseSource* _tmp0;
+ SeahorseSource* sksrc;
GMemoryInputStream* input;
SeahorseOperation* op;
g_return_if_fail (SEAHORSE_IS_KEY_MANAGER (self));
@@ -699,14 +701,14 @@
}
/* All our supported key types have a local key source */
_tmp0 = NULL;
- sksrc = (_tmp0 = seahorse_context_find_key_source (seahorse_context_for_app (), ktype, SKEY_LOC_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ sksrc = (_tmp0 = seahorse_context_find_source (seahorse_context_for_app (), ktype, SEAHORSE_LOCATION_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
g_return_if_fail (sksrc != NULL);
/*
* BUG: We cast to get around this bug:
* http://bugzilla.gnome.org/show_bug.cgi?id=540662
*/
input = G_MEMORY_INPUT_STREAM (g_memory_input_stream_new_from_data (text, len, g_free));
- op = seahorse_key_source_import (sksrc, G_INPUT_STREAM (input));
+ op = seahorse_source_import (sksrc, G_INPUT_STREAM (input));
seahorse_progress_show (op, _ ("Importing Keys"), TRUE);
seahorse_operation_watch (op, _seahorse_key_manager_imported_keys_seahorse_done_func, self, NULL, NULL);
(sksrc == NULL ? NULL : (sksrc = (g_object_unref (sksrc), NULL)));
@@ -787,17 +789,17 @@
static void seahorse_key_manager_on_remote_sync (SeahorseKeyManager* self, GtkAction* action) {
- GList* keys;
+ GList* objects;
g_return_if_fail (SEAHORSE_IS_KEY_MANAGER (self));
g_return_if_fail (GTK_IS_ACTION (action));
- keys = seahorse_viewer_get_selected_keys (SEAHORSE_VIEWER (self));
- if (keys == NULL) {
+ objects = seahorse_viewer_get_selected_objects (SEAHORSE_VIEWER (self));
+ if (objects == NULL) {
GList* _tmp0;
_tmp0 = NULL;
- keys = (_tmp0 = seahorse_context_find_keys (seahorse_context_for_app (), ((GQuark) (0)), 0, SKEY_LOC_LOCAL), (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL))), _tmp0);
+ objects = (_tmp0 = seahorse_context_find_objects (seahorse_context_for_app (), ((GQuark) (0)), 0, SEAHORSE_LOCATION_LOCAL), (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL))), _tmp0);
}
- seahorse_keyserver_sync_show (keys, seahorse_view_get_window (SEAHORSE_VIEW (self)));
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ seahorse_keyserver_sync_show (objects, seahorse_view_get_window (SEAHORSE_VIEW (self)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
}
@@ -929,36 +931,36 @@
self->priv->_track_selected_tab = tabid;
}
/* Retrieve currently tracked, and reset tracking */
- keyid = self->priv->_track_selected_key;
- self->priv->_track_selected_key = ((GQuark) (0));
+ keyid = self->priv->_track_selected_id;
+ self->priv->_track_selected_id = ((GQuark) (0));
/* no selection, see if selected key moved to another tab */
if (dotracking && rows == 0 && keyid != 0) {
- SeahorseKey* _tmp2;
- SeahorseKey* key;
+ SeahorseObject* _tmp2;
+ SeahorseObject* obj;
/* Find it */
_tmp2 = NULL;
- key = (_tmp2 = seahorse_context_find_key (seahorse_context_for_app (), keyid, SKEY_LOC_LOCAL), (_tmp2 == NULL ? NULL : g_object_ref (_tmp2)));
- if (key != NULL) {
+ obj = (_tmp2 = seahorse_context_find_object (seahorse_context_for_app (), keyid, SEAHORSE_LOCATION_LOCAL), (_tmp2 == NULL ? NULL : g_object_ref (_tmp2)));
+ if (obj != NULL) {
SeahorseKeyManagerTabInfo* tab;
/* If it's still around, then select it */
- tab = seahorse_key_manager_get_tab_for_key (self, key);
+ tab = seahorse_key_manager_get_tab_for_object (self, obj);
if (tab != NULL && tab != seahorse_key_manager_get_tab_info (self, -1)) {
/* Make sure we don't end up in a loop */
- g_assert (self->priv->_track_selected_key == 0);
- seahorse_viewer_set_selected_key (SEAHORSE_VIEWER (self), key);
+ g_assert (self->priv->_track_selected_id == 0);
+ seahorse_viewer_set_selected (SEAHORSE_VIEWER (self), obj);
}
}
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
+ (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL)));
}
if (selected) {
- GList* keys;
+ GList* objects;
seahorse_viewer_set_numbered_status (SEAHORSE_VIEWER (self), ngettext ("Selected %d key", "Selected %d keys", rows), rows);
- keys = seahorse_viewer_get_selected_keys (SEAHORSE_VIEWER (self));
+ objects = seahorse_viewer_get_selected_objects (SEAHORSE_VIEWER (self));
/* If one key is selected then mark it down for following across tabs */
- if (((SeahorseKey*) (keys->data)) != NULL) {
- self->priv->_track_selected_key = seahorse_key_get_keyid (((SeahorseKey*) (((SeahorseKey*) (keys->data)))));
+ if (((SeahorseObject*) (objects->data)) != NULL) {
+ self->priv->_track_selected_id = seahorse_object_get_id (((SeahorseObject*) (((SeahorseObject*) (objects->data)))));
}
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
}
/* Fire the signal */
g_signal_emit_by_name (G_OBJECT (SEAHORSE_VIEW (self)), "selection-changed");
@@ -972,7 +974,7 @@
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
gtk_entry_set_text (self->priv->_filter_entry, "");
/* Don't track the selected key when tab is changed on purpose */
- self->priv->_track_selected_key = ((GQuark) (0));
+ self->priv->_track_selected_id = ((GQuark) (0));
seahorse_key_manager_fire_selection_changed (self);
/*
* Because gnome-keyring can throw prompts etc... we delay loading
@@ -986,7 +988,7 @@
static void seahorse_key_manager_load_gnome_keyring_items (SeahorseKeyManager* self) {
GType type;
- SeahorseKeySource* sksrc;
+ SeahorseSource* sksrc;
SeahorseOperation* op;
g_return_if_fail (SEAHORSE_IS_KEY_MANAGER (self));
if (self->priv->_loaded_gnome_keyring) {
@@ -994,9 +996,9 @@
}
type = seahorse_registry_find_type (seahorse_registry_get (), "gnome-keyring", "local", "key-source", NULL, NULL);
g_return_if_fail (type != 0);
- sksrc = SEAHORSE_KEY_SOURCE (g_object_new (type, NULL, NULL));
- seahorse_context_add_key_source (seahorse_context_for_app (), sksrc);
- op = seahorse_key_source_load (sksrc, ((GQuark) (0)));
+ sksrc = SEAHORSE_SOURCE (g_object_new (type, NULL, NULL));
+ seahorse_context_add_source (seahorse_context_for_app (), sksrc);
+ op = seahorse_source_load (sksrc, ((GQuark) (0)));
/* Monitor loading progress */
seahorse_progress_status_set_operation (SEAHORSE_WIDGET (self), op);
(sksrc == NULL ? NULL : (sksrc = (g_object_unref (sksrc), NULL)));
@@ -1004,24 +1006,24 @@
}
-static SeahorseKey* seahorse_key_manager_real_get_selected_key (SeahorseKeyManager* self) {
+static SeahorseObject* seahorse_key_manager_real_get_selected (SeahorseKeyManager* self) {
SeahorseKeyManagerTabInfo* tab;
g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER (self), NULL);
tab = seahorse_key_manager_get_tab_info (self, -1);
if (tab == NULL) {
return NULL;
}
- return seahorse_key_manager_store_get_selected_key ((*tab).view, NULL);
+ return SEAHORSE_OBJECT (seahorse_key_manager_store_get_selected_key ((*tab).view, NULL));
}
-static void seahorse_key_manager_real_set_selected_key (SeahorseKeyManager* self, SeahorseKey* value) {
- GList* keys;
+static void seahorse_key_manager_real_set_selected (SeahorseKeyManager* self, SeahorseObject* value) {
+ GList* objects;
g_return_if_fail (SEAHORSE_IS_KEY_MANAGER (self));
- keys = NULL;
- keys = g_list_prepend (keys, value);
- seahorse_viewer_set_selected_keys (SEAHORSE_VIEWER (self), keys);
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ objects = NULL;
+ objects = g_list_prepend (objects, value);
+ seahorse_viewer_set_selected_objects (SEAHORSE_VIEWER (self), objects);
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
}
@@ -1299,8 +1301,8 @@
SeahorseKeyManager * self;
self = SEAHORSE_KEY_MANAGER (object);
switch (property_id) {
- case SEAHORSE_KEY_MANAGER_SELECTED_KEY:
- g_value_set_object (value, seahorse_key_manager_real_get_selected_key (self));
+ case SEAHORSE_KEY_MANAGER_SELECTED:
+ g_value_set_object (value, seahorse_key_manager_real_get_selected (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1313,8 +1315,8 @@
SeahorseKeyManager * self;
self = SEAHORSE_KEY_MANAGER (object);
switch (property_id) {
- case SEAHORSE_KEY_MANAGER_SELECTED_KEY:
- seahorse_key_manager_real_set_selected_key (self, g_value_get_object (value));
+ case SEAHORSE_KEY_MANAGER_SELECTED:
+ seahorse_key_manager_real_set_selected (self, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1330,18 +1332,18 @@
G_OBJECT_CLASS (klass)->set_property = seahorse_key_manager_set_property;
G_OBJECT_CLASS (klass)->constructor = seahorse_key_manager_constructor;
G_OBJECT_CLASS (klass)->dispose = seahorse_key_manager_dispose;
- SEAHORSE_VIEWER_CLASS (klass)->get_selected_keys = seahorse_key_manager_real_get_selected_keys;
- SEAHORSE_VIEWER_CLASS (klass)->set_selected_keys = seahorse_key_manager_real_set_selected_keys;
- SEAHORSE_VIEWER_CLASS (klass)->get_selected_key_and_uid = seahorse_key_manager_real_get_selected_key_and_uid;
- g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_KEY_MANAGER_SELECTED_KEY, "selected-key");
+ SEAHORSE_VIEWER_CLASS (klass)->get_selected_objects = seahorse_key_manager_real_get_selected_objects;
+ SEAHORSE_VIEWER_CLASS (klass)->set_selected_objects = seahorse_key_manager_real_set_selected_objects;
+ SEAHORSE_VIEWER_CLASS (klass)->get_selected_object_and_uid = seahorse_key_manager_real_get_selected_object_and_uid;
+ g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_KEY_MANAGER_SELECTED, "selected");
}
static void seahorse_key_manager_seahorse_view_interface_init (SeahorseViewIface * iface) {
seahorse_key_manager_seahorse_view_parent_iface = g_type_interface_peek_parent (iface);
- iface->get_selected_keys = seahorse_key_manager_real_get_selected_keys;
- iface->set_selected_keys = seahorse_key_manager_real_set_selected_keys;
- iface->get_selected_key_and_uid = seahorse_key_manager_real_get_selected_key_and_uid;
+ iface->get_selected_objects = seahorse_key_manager_real_get_selected_objects;
+ iface->set_selected_objects = seahorse_key_manager_real_set_selected_objects;
+ iface->get_selected_object_and_uid = seahorse_key_manager_real_get_selected_object_and_uid;
}
Modified: trunk/src/seahorse-key-manager.h
==============================================================================
--- trunk/src/seahorse-key-manager.h (original)
+++ trunk/src/seahorse-key-manager.h Thu Jul 17 01:41:51 2008
@@ -27,7 +27,7 @@
#include <seahorse-view.h>
#include <gtk/gtk.h>
#include <seahorse-operation.h>
-#include <seahorse-key.h>
+#include <seahorse-object.h>
#include "seahorse-viewer.h"
G_BEGIN_DECLS
Modified: trunk/src/seahorse-key-manager.vala
==============================================================================
--- trunk/src/seahorse-key-manager.vala (original)
+++ trunk/src/seahorse-key-manager.vala Thu Jul 17 01:41:51 2008
@@ -29,7 +29,7 @@
private Gtk.Notebook _notebook;
private Gtk.ActionGroup _view_actions;
private Gtk.Entry _filter_entry;
- private Quark _track_selected_key;
+ private Quark _track_selected_id;
private uint _track_selected_tab;
private bool _loaded_gnome_keyring;
@@ -54,48 +54,48 @@
public uint id;
public int page;
public weak Gtk.TreeView view;
- public weak Keyset keyset;
+ public weak Set objects;
public weak Gtk.Widget widget;
public KeyManagerStore store;
}
private TabInfo[] _tabs;
- private static const KeyPredicate PRED_PUBLIC = {
+ private static const Object.Predicate PRED_PUBLIC = {
0, /* ktype */
- 0, /* keyid */
- Key.Loc.LOCAL, /* location */
- Key.EType.PUBLIC, /* etype */
+ 0, /* id */
+ Location.LOCAL, /* location */
+ Usage.PUBLIC_KEY, /* usage */
0, /* flags */
Key.Flag.TRUSTED | Key.Flag.IS_VALID, /* nflags */
null /* sksrc */
};
- private static const KeyPredicate PRED_TRUSTED = {
+ private static const Object.Predicate PRED_TRUSTED = {
0, /* ktype */
- 0, /* keyid */
- Key.Loc.LOCAL, /* location */
- Key.EType.PUBLIC, /* etype */
+ 0, /* id */
+ Location.LOCAL, /* location */
+ Usage.PUBLIC_KEY, /* usage */
Key.Flag.TRUSTED | Key.Flag.IS_VALID, /* flags */
0, /* nflags */
null /* sksrc */
};
- private static const KeyPredicate PRED_PRIVATE = {
+ private static const Object.Predicate PRED_PRIVATE = {
0, /* ktype */
- 0, /* keyid */
- Key.Loc.LOCAL, /* location */
- Key.EType.PRIVATE, /* etype */
+ 0, /* id */
+ Location.LOCAL, /* location */
+ Usage.PRIVATE_KEY, /* usage */
0, /* flags */
0, /* nflags */
null /* sksrc */
};
- private static const KeyPredicate PRED_PASSWORD = {
+ private static const Object.Predicate PRED_PASSWORD = {
0, /* ktype */
- 0, /* keyid */
- Key.Loc.LOCAL, /* location */
- Key.EType.CREDENTIALS, /* etype */
+ 0, /* id */
+ Location.LOCAL, /* location */
+ Usage.CREDENTIALS, /* usage */
0, /* flags */
0, /* nflags */
null /* sksrc */
@@ -274,49 +274,49 @@
return (Gtk.Window)man.get_toplevel();
}
- public override List<weak Key> get_selected_keys () {
+ public override List<weak Object> get_selected_objects () {
TabInfo* tab = get_tab_info ();
if (tab == null)
- return new List<weak Key>();
+ return new List<weak Object>();
return KeyManagerStore.get_selected_keys (tab->view);
}
- public override void set_selected_keys (List<Key> keys) {
- List<weak Key>[] tab_lists = new List<weak Key>[(int)Tabs.NUM_TABS];
+ public override void set_selected_objects (List<Object> objects) {
+ List<weak Object>[] tab_lists = new List<weak Object>[(int)Tabs.NUM_TABS];
- /* Break keys into what's on each tab */
- foreach (Key key in keys) {
- TabInfo* tab = get_tab_for_key (key);
+ /* Break objects into what's on each tab */
+ foreach (Object obj in objects) {
+ TabInfo* tab = get_tab_for_object (obj);
if (tab == null)
continue;
assert (tab->id < (int)Tabs.NUM_TABS);
- tab_lists[tab->id].prepend (key);
+ tab_lists[tab->id].prepend (obj);
}
uint highest_matched = 0;
TabInfo* highest_tab = null;
for (int i = 0; i < (int)Tabs.NUM_TABS; ++i) {
- weak List<weak Key> list = tab_lists[i];
+ weak List<weak Object> list = tab_lists[i];
TabInfo* tab = &_tabs[i];
- /* Save away the tab that had the most keys */
+ /* Save away the tab that had the most objects */
uint num = list.length();
if (num > highest_matched) {
highest_matched = num;
highest_tab = tab;
}
- /* Select the keys on that tab */
+ /* Select the objects on that tab */
KeyManagerStore.set_selected_keys (tab->view, list);
}
- /* Change to the tab with the most keys */
+ /* Change to the tab with the most objects */
if (highest_tab != null)
set_tab_current (highest_tab);
}
- public override weak Key? selected_key {
+ public override weak Object? selected {
get {
TabInfo* tab = get_tab_info ();
if (tab == null)
@@ -324,23 +324,23 @@
return KeyManagerStore.get_selected_key (tab->view, null);
}
set {
- List<weak Key> keys = new List<weak Key>();
- keys.prepend (value);
- set_selected_keys (keys);
+ List<weak Object> objects = new List<weak Object>();
+ objects.prepend (value);
+ set_selected_objects (objects);
}
}
- public override weak Key? get_selected_key_and_uid (out uint uid) {
+ public override weak Object? get_selected_object_and_uid (out uint uid) {
TabInfo* tab = get_tab_info ();
if (tab == null)
return null;
return KeyManagerStore.get_selected_key (tab->view, out uid);
}
- private TabInfo* get_tab_for_key (Key key) {
+ private TabInfo* get_tab_for_object (Object obj) {
for (int i = 0; i < (int)Tabs.NUM_TABS; ++i) {
TabInfo* tab = &_tabs[i];
- if (tab->keyset.has_key (key))
+ if (tab->objects.has_object (obj))
return tab;
}
return null;
@@ -380,7 +380,7 @@
}
private void initialize_tab (string tabwidget, uint tabid,
- string viewwidget, KeyPredicate pred) {
+ string viewwidget, Object.Predicate pred) {
assert (tabid < (int)Tabs.NUM_TABS);
@@ -391,8 +391,8 @@
_tabs[tabid].page = Bugs.notebook_page_num (_notebook, _tabs[tabid].widget);
return_if_fail (_tabs[tabid].page >= 0);
- Keyset keyset = new Keyset.full (ref pred);
- _tabs[tabid].keyset = keyset;
+ Set objects = new Set.full (ref pred);
+ _tabs[tabid].objects = objects;
/* init key list & selection settings */
Gtk.TreeView view = (Gtk.TreeView)get_widget (viewwidget);
@@ -406,7 +406,7 @@
view.realize();
/* Add new key store and associate it */
- _tabs[tabid].store = new KeyManagerStore(keyset, view);
+ _tabs[tabid].store = new KeyManagerStore(objects, view);
}
private bool on_first_timer () {
@@ -447,8 +447,8 @@
}
private bool on_key_list_popup_menu (Gtk.TreeView view) {
- Key key = this.selected_key;
- if (key != null) {
+ Object obj = this.selected;
+ if (obj != null) {
show_context_menu (0, Gtk.get_current_event_time ());
return true;
}
@@ -490,8 +490,8 @@
continue;
}
- /* All our supported key types have a local key source */
- KeySource sksrc = Context.for_app().find_key_source (ktype, Key.Loc.LOCAL);
+ /* All our supported key types have a local source */
+ Source sksrc = Context.for_app().find_source (ktype, Location.LOCAL);
return_if_fail (sksrc != null);
try {
@@ -546,7 +546,7 @@
}
/* All our supported key types have a local key source */
- KeySource sksrc = Context.for_app().find_key_source (ktype, Key.Loc.LOCAL);
+ Source sksrc = Context.for_app().find_source (ktype, Location.LOCAL);
return_if_fail (sksrc != null);
/*
@@ -591,10 +591,10 @@
private void on_remote_sync (Action action) {
- var keys = get_selected_keys ();
- if (keys == null)
- keys = Context.for_app().find_keys (0, 0, Key.Loc.LOCAL);
- KeyserverSync.show (keys, window);
+ var objects = get_selected_objects ();
+ if (objects == null)
+ objects = Context.for_app().find_objects (0, 0, Location.LOCAL);
+ KeyserverSync.show (objects, window);
}
private void on_app_quit (Action? action) {
@@ -667,23 +667,23 @@
}
/* Retrieve currently tracked, and reset tracking */
- Quark keyid = _track_selected_key;
- _track_selected_key = 0;
+ Quark keyid = _track_selected_id;
+ _track_selected_id = 0;
/* no selection, see if selected key moved to another tab */
if (dotracking && rows == 0 && keyid != 0) {
/* Find it */
- Key key = Context.for_app().find_key (keyid, Key.Loc.LOCAL);
- if (key != null) {
+ Object obj = Context.for_app().find_object (keyid, Location.LOCAL);
+ if (obj != null) {
/* If it's still around, then select it */
- TabInfo* tab = get_tab_for_key (key);
+ TabInfo* tab = get_tab_for_object (obj);
if (tab != null && tab != get_tab_info ()) {
/* Make sure we don't end up in a loop */
- assert (_track_selected_key == 0);
- this.selected_key = key;
+ assert (_track_selected_id == 0);
+ this.selected = obj;
}
}
}
@@ -692,11 +692,11 @@
set_numbered_status (Bugs.ngettext ("Selected %d key",
"Selected %d keys", rows), rows);
- List<weak Key> keys = get_selected_keys ();
+ List<weak Object> objects = get_selected_objects ();
/* If one key is selected then mark it down for following across tabs */
- if (keys.data != null)
- _track_selected_key = keys.data.keyid;
+ if (objects.data != null)
+ _track_selected_id = objects.data.id;
}
@@ -712,7 +712,7 @@
_filter_entry.set_text ("");
/* Don't track the selected key when tab is changed on purpose */
- _track_selected_key = 0;
+ _track_selected_id = 0;
fire_selection_changed ();
/*
@@ -732,8 +732,8 @@
GLib.Type type = Registry.get().find_type ("gnome-keyring", "local", "key-source", null);
return_if_fail (type != 0);
- KeySource sksrc = (KeySource)GLib.Object.new (type, null);
- Context.for_app().add_key_source (sksrc);
+ var sksrc = (Source)GLib.Object.new (type, null);
+ Context.for_app().add_source (sksrc);
Operation op = sksrc.load (0);
/* Monitor loading progress */
Modified: trunk/src/seahorse-keyserver-results.c
==============================================================================
--- trunk/src/seahorse-keyserver-results.c (original)
+++ trunk/src/seahorse-keyserver-results.c Thu Jul 17 01:41:51 2008
@@ -21,15 +21,17 @@
#include "seahorse-keyserver-results.h"
#include <seahorse-key-manager-store.h>
-#include <seahorse-keyset.h>
+#include <seahorse-set.h>
#include <glib/gi18n-lib.h>
#include <seahorse-widget.h>
#include <seahorse-progress.h>
+#include <seahorse-key.h>
#include <gdk/gdk.h>
#include <seahorse-context.h>
-#include <seahorse-key-source.h>
+#include <seahorse-source.h>
#include <seahorse-windows.h>
#include <config.h>
+#include <seahorse-types.h>
@@ -39,21 +41,21 @@
GtkTreeView* _view;
GtkActionGroup* _key_actions;
SeahorseKeyManagerStore* _store;
- SeahorseKeyset* _keyset;
- SeahorseKeyPredicate _pred;
+ SeahorseSet* _objects;
+ SeahorseObjectPredicate _pred;
};
#define SEAHORSE_KEYSERVER_RESULTS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_KEYSERVER_RESULTS, SeahorseKeyserverResultsPrivate))
enum {
SEAHORSE_KEYSERVER_RESULTS_DUMMY_PROPERTY,
SEAHORSE_KEYSERVER_RESULTS_SEARCH,
- SEAHORSE_KEYSERVER_RESULTS_SELECTED_KEY
+ SEAHORSE_KEYSERVER_RESULTS_SELECTED
};
static SeahorseKeyserverResults* seahorse_keyserver_results_new (const char* search_text);
-static GList* seahorse_keyserver_results_real_get_selected_keys (SeahorseView* base);
-static void seahorse_keyserver_results_real_set_selected_keys (SeahorseView* base, GList* keys);
-static SeahorseKey* seahorse_keyserver_results_real_get_selected_key_and_uid (SeahorseView* base, guint* uid);
-static gboolean seahorse_keyserver_results_on_filter_keyset (SeahorseKeyserverResults* self, SeahorseKey* key);
+static GList* seahorse_keyserver_results_real_get_selected_objects (SeahorseView* base);
+static void seahorse_keyserver_results_real_set_selected_objects (SeahorseView* base, GList* keys);
+static SeahorseObject* seahorse_keyserver_results_real_get_selected_object_and_uid (SeahorseView* base, guint* uid);
+static gboolean seahorse_keyserver_results_on_filter_objects (SeahorseKeyserverResults* self, SeahorseObject* obj);
static gboolean _seahorse_keyserver_results_fire_selection_changed_gsource_func (gpointer self);
static void seahorse_keyserver_results_on_view_selection_changed (SeahorseKeyserverResults* self, GtkTreeSelection* selection);
static void seahorse_keyserver_results_on_row_activated (SeahorseKeyserverResults* self, GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn* column);
@@ -78,7 +80,7 @@
static void _seahorse_keyserver_results_on_row_activated_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self);
static gboolean _seahorse_keyserver_results_on_key_list_button_pressed_gtk_widget_button_press_event (GtkTreeView* _sender, GdkEventButton* event, gpointer self);
static gboolean _seahorse_keyserver_results_on_key_list_popup_menu_gtk_widget_popup_menu (GtkTreeView* _sender, gpointer self);
-static gboolean _seahorse_keyserver_results_on_filter_keyset_seahorse_key_predicate_func (SeahorseKey* key, gpointer self);
+static gboolean _seahorse_keyserver_results_on_filter_objects_seahorse_object_predicate_func (SeahorseObject* obj, gpointer self);
static GObject * seahorse_keyserver_results_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static gpointer seahorse_keyserver_results_parent_class = NULL;
static SeahorseViewIface* seahorse_keyserver_results_seahorse_view_parent_iface = NULL;
@@ -135,14 +137,14 @@
}
-static GList* seahorse_keyserver_results_real_get_selected_keys (SeahorseView* base) {
+static GList* seahorse_keyserver_results_real_get_selected_objects (SeahorseView* base) {
SeahorseKeyserverResults * self;
self = SEAHORSE_KEYSERVER_RESULTS (base);
return seahorse_key_manager_store_get_selected_keys (self->priv->_view);
}
-static void seahorse_keyserver_results_real_set_selected_keys (SeahorseView* base, GList* keys) {
+static void seahorse_keyserver_results_real_set_selected_objects (SeahorseView* base, GList* keys) {
SeahorseKeyserverResults * self;
self = SEAHORSE_KEYSERVER_RESULTS (base);
g_return_if_fail (keys != NULL);
@@ -150,26 +152,26 @@
}
-static SeahorseKey* seahorse_keyserver_results_real_get_selected_key_and_uid (SeahorseView* base, guint* uid) {
+static SeahorseObject* seahorse_keyserver_results_real_get_selected_object_and_uid (SeahorseView* base, guint* uid) {
SeahorseKeyserverResults * self;
self = SEAHORSE_KEYSERVER_RESULTS (base);
- return seahorse_key_manager_store_get_selected_key (self->priv->_view, &(*uid));
+ return SEAHORSE_OBJECT (seahorse_key_manager_store_get_selected_key (self->priv->_view, &(*uid)));
}
-static gboolean seahorse_keyserver_results_on_filter_keyset (SeahorseKeyserverResults* self, SeahorseKey* key) {
+static gboolean seahorse_keyserver_results_on_filter_objects (SeahorseKeyserverResults* self, SeahorseObject* obj) {
const char* _tmp1;
char* name;
char* _tmp2;
gboolean _tmp3;
gboolean _tmp4;
g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), FALSE);
- g_return_val_if_fail (SEAHORSE_IS_KEY (key), FALSE);
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (obj), FALSE);
if (g_utf8_strlen (self->priv->_search_string, -1) == 0) {
return TRUE;
}
_tmp1 = NULL;
- name = (_tmp1 = seahorse_key_get_display_name (key), (_tmp1 == NULL ? NULL : g_strdup (_tmp1)));
+ name = (_tmp1 = seahorse_key_get_display_name ((SEAHORSE_KEY (obj))), (_tmp1 == NULL ? NULL : g_strdup (_tmp1)));
_tmp2 = NULL;
return (_tmp4 = (_tmp3 = (strstr ((_tmp2 = g_utf8_casefold (name, -1)), self->priv->_search_string) != NULL), (_tmp2 = (g_free (_tmp2), NULL)), _tmp3), (name = (g_free (name), NULL)), _tmp4);
}
@@ -197,7 +199,7 @@
_tmp0 = NULL;
key = (_tmp0 = seahorse_key_manager_store_get_key_from_path (view, path, NULL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
if (key != NULL) {
- seahorse_viewer_show_properties (SEAHORSE_VIEWER (self), key);
+ seahorse_viewer_show_properties (SEAHORSE_VIEWER (self), SEAHORSE_OBJECT (key));
}
(key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
}
@@ -214,13 +216,13 @@
static gboolean seahorse_keyserver_results_on_key_list_popup_menu (SeahorseKeyserverResults* self, GtkTreeView* view) {
- SeahorseKey* _tmp0;
- SeahorseKey* key;
+ SeahorseObject* _tmp0;
+ SeahorseObject* key;
gboolean _tmp2;
g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), FALSE);
g_return_val_if_fail (GTK_IS_TREE_VIEW (view), FALSE);
_tmp0 = NULL;
- key = (_tmp0 = seahorse_viewer_get_selected_key (SEAHORSE_VIEWER (self)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ key = (_tmp0 = seahorse_viewer_get_selected (SEAHORSE_VIEWER (self)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
if (key == NULL) {
gboolean _tmp1;
return (_tmp1 = FALSE, (key == NULL ? NULL : (key = (g_object_unref (key), NULL))), _tmp1);
@@ -272,13 +274,13 @@
SeahorseOperation* op;
g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
g_return_if_fail (GTK_IS_ACTION (action));
- keys = seahorse_viewer_get_selected_keys (SEAHORSE_VIEWER (self));
+ keys = seahorse_viewer_get_selected_objects (SEAHORSE_VIEWER (self));
/* No keys, nothing to do */
if (keys == NULL) {
(keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
return;
}
- op = seahorse_context_transfer_keys (seahorse_context_for_app (), keys, NULL);
+ op = seahorse_context_transfer_objects (seahorse_context_for_app (), keys, NULL);
seahorse_progress_show (op, _ ("Importing keys from key servers"), TRUE);
seahorse_operation_watch (op, _seahorse_keyserver_results_imported_keys_seahorse_done_func, self, NULL, NULL);
(keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
@@ -339,18 +341,20 @@
}
-static SeahorseKey* seahorse_keyserver_results_real_get_selected_key (SeahorseKeyserverResults* self) {
+static SeahorseObject* seahorse_keyserver_results_real_get_selected (SeahorseKeyserverResults* self) {
g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), NULL);
- return seahorse_key_manager_store_get_selected_key (self->priv->_view, NULL);
+ return SEAHORSE_OBJECT (seahorse_key_manager_store_get_selected_key (self->priv->_view, NULL));
}
-static void seahorse_keyserver_results_real_set_selected_key (SeahorseKeyserverResults* self, SeahorseKey* value) {
+static void seahorse_keyserver_results_real_set_selected (SeahorseKeyserverResults* self, SeahorseObject* value) {
GList* keys;
g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
keys = NULL;
- keys = g_list_prepend (keys, value);
- seahorse_viewer_set_selected_keys (SEAHORSE_VIEWER (self), keys);
+ if (value != NULL) {
+ keys = g_list_prepend (keys, value);
+ }
+ seahorse_viewer_set_selected_objects (SEAHORSE_VIEWER (self), keys);
(keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
}
@@ -400,8 +404,8 @@
}
-static gboolean _seahorse_keyserver_results_on_filter_keyset_seahorse_key_predicate_func (SeahorseKey* key, gpointer self) {
- return seahorse_keyserver_results_on_filter_keyset (self, key);
+static gboolean _seahorse_keyserver_results_on_filter_objects_seahorse_object_predicate_func (SeahorseObject* obj, gpointer self) {
+ return seahorse_keyserver_results_on_filter_objects (self, obj);
}
@@ -422,8 +426,8 @@
gboolean _tmp5;
GtkTreeView* _tmp7;
GtkTreeView* _tmp6;
- SeahorseKeyPredicateFunc _tmp8;
- SeahorseKeyset* _tmp9;
+ SeahorseObjectPredicateFunc _tmp8;
+ SeahorseSet* _tmp9;
SeahorseKeyManagerStore* _tmp10;
title = NULL;
if (g_utf8_strlen (self->priv->_search_string, -1) == 0) {
@@ -478,15 +482,15 @@
seahorse_viewer_ensure_updated (SEAHORSE_VIEWER (self));
seahorse_widget_show (SEAHORSE_WIDGET (SEAHORSE_VIEWER (self)));
/* Our predicate for filtering keys */
- self->priv->_pred.ktype = g_quark_from_string ("openpgp");
- self->priv->_pred.etype = SKEY_PUBLIC;
- self->priv->_pred.location = SKEY_LOC_REMOTE;
- self->priv->_pred.custom = (_tmp8 = _seahorse_keyserver_results_on_filter_keyset_seahorse_key_predicate_func, self->priv->_pred.custom_target = self, _tmp8);
- /* Our keyset all nicely filtered */
+ self->priv->_pred.tag = g_quark_from_string ("openpgp");
+ self->priv->_pred.usage = SEAHORSE_USAGE_PUBLIC_KEY;
+ self->priv->_pred.location = SEAHORSE_LOCATION_REMOTE;
+ self->priv->_pred.custom = (_tmp8 = _seahorse_keyserver_results_on_filter_objects_seahorse_object_predicate_func, self->priv->_pred.custom_target = self, _tmp8);
+ /* Our set all nicely filtered */
_tmp9 = NULL;
- self->priv->_keyset = (_tmp9 = seahorse_keyset_new_full (&self->priv->_pred), (self->priv->_keyset == NULL ? NULL : (self->priv->_keyset = (g_object_unref (self->priv->_keyset), NULL))), _tmp9);
+ self->priv->_objects = (_tmp9 = seahorse_set_new_full (&self->priv->_pred), (self->priv->_objects == NULL ? NULL : (self->priv->_objects = (g_object_unref (self->priv->_objects), NULL))), _tmp9);
_tmp10 = NULL;
- self->priv->_store = (_tmp10 = seahorse_key_manager_store_new (self->priv->_keyset, self->priv->_view), (self->priv->_store == NULL ? NULL : (self->priv->_store = (g_object_unref (self->priv->_store), NULL))), _tmp10);
+ self->priv->_store = (_tmp10 = seahorse_key_manager_store_new (self->priv->_objects, self->priv->_view), (self->priv->_store == NULL ? NULL : (self->priv->_store = (g_object_unref (self->priv->_store), NULL))), _tmp10);
seahorse_keyserver_results_on_view_selection_changed (self, gtk_tree_view_get_selection (self->priv->_view));
title = (g_free (title), NULL);
(actions == NULL ? NULL : (actions = (g_object_unref (actions), NULL)));
@@ -502,8 +506,8 @@
case SEAHORSE_KEYSERVER_RESULTS_SEARCH:
g_value_set_string (value, seahorse_keyserver_results_get_search (self));
break;
- case SEAHORSE_KEYSERVER_RESULTS_SELECTED_KEY:
- g_value_set_object (value, seahorse_keyserver_results_real_get_selected_key (self));
+ case SEAHORSE_KEYSERVER_RESULTS_SELECTED:
+ g_value_set_object (value, seahorse_keyserver_results_real_get_selected (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -519,8 +523,8 @@
case SEAHORSE_KEYSERVER_RESULTS_SEARCH:
seahorse_keyserver_results_set_search (self, g_value_get_string (value));
break;
- case SEAHORSE_KEYSERVER_RESULTS_SELECTED_KEY:
- seahorse_keyserver_results_real_set_selected_key (self, g_value_get_object (value));
+ case SEAHORSE_KEYSERVER_RESULTS_SELECTED:
+ seahorse_keyserver_results_real_set_selected (self, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -536,19 +540,19 @@
G_OBJECT_CLASS (klass)->set_property = seahorse_keyserver_results_set_property;
G_OBJECT_CLASS (klass)->constructor = seahorse_keyserver_results_constructor;
G_OBJECT_CLASS (klass)->dispose = seahorse_keyserver_results_dispose;
- SEAHORSE_VIEWER_CLASS (klass)->get_selected_keys = seahorse_keyserver_results_real_get_selected_keys;
- SEAHORSE_VIEWER_CLASS (klass)->set_selected_keys = seahorse_keyserver_results_real_set_selected_keys;
- SEAHORSE_VIEWER_CLASS (klass)->get_selected_key_and_uid = seahorse_keyserver_results_real_get_selected_key_and_uid;
+ SEAHORSE_VIEWER_CLASS (klass)->get_selected_objects = seahorse_keyserver_results_real_get_selected_objects;
+ SEAHORSE_VIEWER_CLASS (klass)->set_selected_objects = seahorse_keyserver_results_real_set_selected_objects;
+ SEAHORSE_VIEWER_CLASS (klass)->get_selected_object_and_uid = seahorse_keyserver_results_real_get_selected_object_and_uid;
g_object_class_install_property (G_OBJECT_CLASS (klass), SEAHORSE_KEYSERVER_RESULTS_SEARCH, g_param_spec_string ("search", "search", "search", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_KEYSERVER_RESULTS_SELECTED_KEY, "selected-key");
+ g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_KEYSERVER_RESULTS_SELECTED, "selected");
}
static void seahorse_keyserver_results_seahorse_view_interface_init (SeahorseViewIface * iface) {
seahorse_keyserver_results_seahorse_view_parent_iface = g_type_interface_peek_parent (iface);
- iface->get_selected_keys = seahorse_keyserver_results_real_get_selected_keys;
- iface->set_selected_keys = seahorse_keyserver_results_real_set_selected_keys;
- iface->get_selected_key_and_uid = seahorse_keyserver_results_real_get_selected_key_and_uid;
+ iface->get_selected_objects = seahorse_keyserver_results_real_get_selected_objects;
+ iface->set_selected_objects = seahorse_keyserver_results_real_set_selected_objects;
+ iface->get_selected_object_and_uid = seahorse_keyserver_results_real_get_selected_object_and_uid;
}
@@ -564,7 +568,7 @@
(self->priv->_view == NULL ? NULL : (self->priv->_view = (g_object_unref (self->priv->_view), NULL)));
(self->priv->_key_actions == NULL ? NULL : (self->priv->_key_actions = (g_object_unref (self->priv->_key_actions), NULL)));
(self->priv->_store == NULL ? NULL : (self->priv->_store = (g_object_unref (self->priv->_store), NULL)));
- (self->priv->_keyset == NULL ? NULL : (self->priv->_keyset = (g_object_unref (self->priv->_keyset), NULL)));
+ (self->priv->_objects == NULL ? NULL : (self->priv->_objects = (g_object_unref (self->priv->_objects), NULL)));
G_OBJECT_CLASS (seahorse_keyserver_results_parent_class)->dispose (obj);
}
Modified: trunk/src/seahorse-keyserver-results.h
==============================================================================
--- trunk/src/seahorse-keyserver-results.h (original)
+++ trunk/src/seahorse-keyserver-results.h Thu Jul 17 01:41:51 2008
@@ -29,7 +29,7 @@
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
-#include <seahorse-key.h>
+#include <seahorse-object.h>
#include "seahorse-viewer.h"
G_BEGIN_DECLS
Modified: trunk/src/seahorse-keyserver-results.vala
==============================================================================
--- trunk/src/seahorse-keyserver-results.vala (original)
+++ trunk/src/seahorse-keyserver-results.vala Thu Jul 17 01:41:51 2008
@@ -30,8 +30,8 @@
private Gtk.TreeView _view;
private Gtk.ActionGroup _key_actions;
private KeyManagerStore _store;
- private Keyset _keyset;
- private KeyPredicate _pred;
+ private Set _objects;
+ private Object.Predicate _pred;
private static const Gtk.ActionEntry[] GENERAL_ENTRIES = {
{ "remote-menu", null, N_("_Remote") },
@@ -111,14 +111,14 @@
base.show ();
/* Our predicate for filtering keys */
- _pred.ktype = Quark.from_string ("openpgp");
- _pred.etype = Key.EType.PUBLIC;
- _pred.location = Key.Loc.REMOTE;
- _pred.custom = on_filter_keyset;
+ _pred.tag = Quark.from_string ("openpgp");
+ _pred.usage = Usage.PUBLIC_KEY;
+ _pred.location = Location.REMOTE;
+ _pred.custom = on_filter_objects;
- /* Our keyset all nicely filtered */
- _keyset = new Keyset.full (ref _pred);
- _store = new KeyManagerStore (_keyset, _view);
+ /* Our set all nicely filtered */
+ _objects = new Set.full (ref _pred);
+ _store = new KeyManagerStore (_objects, _view);
on_view_selection_changed (_view.get_selection ());
}
@@ -142,31 +142,32 @@
}
}
- public override List<weak Key> get_selected_keys () {
+ public override List<weak Object> get_selected_objects () {
return KeyManagerStore.get_selected_keys (_view);
}
- public override void set_selected_keys (List<Key> keys) {
+ public override void set_selected_objects (List<Object> keys) {
KeyManagerStore.set_selected_keys (_view, keys);
}
- public override weak Key? selected_key {
+ public override weak Object? selected {
get { return KeyManagerStore.get_selected_key (_view, null); }
set {
- List<weak Key> keys = new List<weak Key>();
- keys.prepend (value);
- set_selected_keys (keys);
+ List<weak Object> keys = new List<weak Object>();
+ if (value != null)
+ keys.prepend (value);
+ set_selected_objects (keys);
}
}
- public override weak Key? get_selected_key_and_uid (out uint uid) {
+ public override weak Object? get_selected_object_and_uid (out uint uid) {
return KeyManagerStore.get_selected_key (_view, out uid);
}
- private bool on_filter_keyset (Key key) {
+ private bool on_filter_objects (Object obj) {
if (_search_string.len() == 0)
return true;
- string name = key.display_name;
+ string name = ((Key)obj).display_name;
return (name.casefold().str(_search_string) != null);
}
@@ -189,7 +190,7 @@
}
private bool on_key_list_popup_menu (Gtk.TreeView view) {
- Key key = this.selected_key;
+ var key = this.selected;
if (key == null)
return false;
show_context_menu (0, Gtk.get_current_event_time ());
@@ -219,13 +220,13 @@
}
private void on_key_import_keyring (Action action) {
- List<weak Key> keys = get_selected_keys();
+ List<weak Object> keys = get_selected_objects();
/* No keys, nothing to do */
if (keys == null)
return;
- Operation op = Context.for_app().transfer_keys (keys, null);
+ Operation op = Context.for_app().transfer_objects (keys, null);
Progress.show (op, _("Importing keys from key servers"), true);
op.watch (imported_keys, null);
}
Modified: trunk/src/seahorse-keyserver-search.c
==============================================================================
--- trunk/src/seahorse-keyserver-search.c (original)
+++ trunk/src/seahorse-keyserver-search.c Thu Jul 17 01:41:51 2008
@@ -312,7 +312,7 @@
seahorse_gconf_set_string_list (LASTSERVERS_KEY,
selection->all ? NULL : selection->names);
- op = seahorse_context_load_remote_keys (SCTX_APP(), search);
+ op = seahorse_context_load_remote_objects (SCTX_APP(), search);
/* Open the new result window */
seahorse_keyserver_results_show (op,
Modified: trunk/src/seahorse-keyserver-sync.c
==============================================================================
--- trunk/src/seahorse-keyserver-sync.c (original)
+++ trunk/src/seahorse-keyserver-sync.c Thu Jul 17 01:41:51 2008
@@ -25,6 +25,7 @@
#include "seahorse-context.h"
#include "seahorse-gconf.h"
+#include "seahorse-key.h"
#include "seahorse-keyserver-sync.h"
#include "seahorse-progress.h"
#include "seahorse-preferences.h"
@@ -35,7 +36,7 @@
#include "seahorse-windows.h"
static void
-sync_import_complete (SeahorseOperation *op, SeahorseKeySource *sksrc)
+sync_import_complete (SeahorseOperation *op, SeahorseSource *sksrc)
{
GError *err = NULL;
@@ -48,7 +49,7 @@
}
static void
-sync_export_complete (SeahorseOperation *op, SeahorseKeySource *sksrc)
+sync_export_complete (SeahorseOperation *op, SeahorseSource *sksrc)
{
GError *err = NULL;
gchar *keyserver;
@@ -181,8 +182,8 @@
void
seahorse_keyserver_sync (GList *keys)
{
- SeahorseKeySource *sksrc;
- SeahorseKeySource *lsksrc;
+ SeahorseSource *sksrc;
+ SeahorseSource *lsksrc;
SeahorseMultiOperation *mop;
SeahorseOperation *op;
gchar *keyserver;
@@ -207,14 +208,14 @@
for (l = ks; l; l = g_slist_next (l)) {
- sksrc = seahorse_context_remote_key_source (SCTX_APP (), (const gchar*)(l->data));
+ sksrc = seahorse_context_remote_source (SCTX_APP (), (const gchar*)(l->data));
/* This can happen if the URI scheme is not supported */
if (sksrc == NULL)
continue;
- lsksrc = seahorse_context_find_key_source (SCTX_APP (),
- seahorse_key_source_get_ktype (sksrc), SKEY_LOC_LOCAL);
+ lsksrc = seahorse_context_find_source (SCTX_APP (),
+ seahorse_source_get_ktype (sksrc), SEAHORSE_LOCATION_LOCAL);
if (lsksrc) {
op = seahorse_transfer_operation_new (_("Synchronizing keys"), sksrc, lsksrc, keyids);
@@ -231,12 +232,12 @@
keyserver = seahorse_gconf_get_string (PUBLISH_TO_KEY);
if (keyserver && keyserver[0]) {
- sksrc = seahorse_context_remote_key_source (SCTX_APP (), keyserver);
+ sksrc = seahorse_context_remote_source (SCTX_APP (), keyserver);
/* This can happen if the URI scheme is not supported */
if (sksrc != NULL) {
- op = seahorse_context_transfer_keys (SCTX_APP (), keys, sksrc);
+ op = seahorse_context_transfer_objects (SCTX_APP (), keys, sksrc);
g_return_if_fail (sksrc != NULL);
seahorse_multi_operation_take (mop, op);
Modified: trunk/src/seahorse-viewer.c
==============================================================================
--- trunk/src/seahorse-viewer.c (original)
+++ trunk/src/seahorse-viewer.c Thu Jul 17 01:41:51 2008
@@ -26,9 +26,10 @@
#include <gio/gio.h>
#include <seahorse-commands.h>
#include <seahorse-util.h>
+#include <seahorse-types.h>
#include <seahorse-operation.h>
#include <gdk/gdk.h>
-#include <seahorse-key-source.h>
+#include <seahorse-source.h>
#include <seahorse-progress.h>
#include <common/seahorse-registry.h>
@@ -37,15 +38,15 @@
struct _SeahorseViewerPrivate {
GtkUIManager* _ui_manager;
- GtkActionGroup* _key_actions;
+ GtkActionGroup* _object_actions;
GHashTable* _commands;
};
#define SEAHORSE_VIEWER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SEAHORSE_TYPE_VIEWER, SeahorseViewerPrivate))
enum {
SEAHORSE_VIEWER_DUMMY_PROPERTY,
- SEAHORSE_VIEWER_SELECTED_KEY,
- SEAHORSE_VIEWER_CURRENT_KEYSET,
+ SEAHORSE_VIEWER_SELECTED,
+ SEAHORSE_VIEWER_CURRENT_SET,
SEAHORSE_VIEWER_WINDOW
};
static gboolean seahorse_viewer__about_initialized;
@@ -57,9 +58,9 @@
static void _seahorse_viewer_on_key_export_clipboard_gtk_action_activate (GtkAction* _sender, gpointer self);
static void _seahorse_viewer_on_key_delete_gtk_action_activate (GtkAction* _sender, gpointer self);
static void seahorse_viewer_include_basic_actions (SeahorseViewer* self);
-static GList* seahorse_viewer_real_get_selected_keys (SeahorseViewer* self);
-static void seahorse_viewer_real_set_selected_keys (SeahorseViewer* self, GList* keys);
-static SeahorseKey* seahorse_viewer_real_get_selected_key_and_uid (SeahorseViewer* self, guint* uid);
+static GList* seahorse_viewer_real_get_selected_objects (SeahorseViewer* self);
+static void seahorse_viewer_real_set_selected_objects (SeahorseViewer* self, GList* objects);
+static SeahorseObject* seahorse_viewer_real_get_selected_object_and_uid (SeahorseViewer* self, guint* uid);
static void seahorse_viewer_on_ui_add_widget (SeahorseViewer* self, GtkUIManager* ui, GtkWidget* widget);
static void seahorse_viewer_on_app_preferences (SeahorseViewer* self, GtkAction* action);
static void _seahorse_viewer_on_about_link_clicked_gtk_about_dialog_activate_link_func (GtkAboutDialog* about, const char* link_, gpointer self);
@@ -67,8 +68,8 @@
static void seahorse_viewer_on_about_link_clicked (GtkAboutDialog* about, const char* url);
static void seahorse_viewer_on_help_show (SeahorseViewer* self, GtkAction* action);
static void seahorse_viewer_on_key_properties (SeahorseViewer* self, GtkAction* action);
-static gint seahorse_viewer_compare_by_ktype (SeahorseViewer* self, SeahorseKey* one, SeahorseKey* two);
-static void seahorse_viewer_delete_key_batch (SeahorseViewer* self, GList* keys);
+static gint seahorse_viewer_compare_by_tag (SeahorseViewer* self, SeahorseObject* one, SeahorseObject* two);
+static void seahorse_viewer_delete_object_batch (SeahorseViewer* self, GList* objects);
static void seahorse_viewer_on_key_delete (SeahorseViewer* self, GtkAction* action);
static void seahorse_viewer_on_copy_complete (SeahorseViewer* self, SeahorseOperation* op);
static void* _g_realloc_grealloc_func (void* data, gulong size);
@@ -143,16 +144,16 @@
g_signal_connect_object (gtk_action_group_get_action (actions, "help-show"), "activate", ((GCallback) (_seahorse_viewer_on_help_show_gtk_action_activate)), self, 0);
seahorse_viewer_include_actions (self, actions);
_tmp0 = NULL;
- self->priv->_key_actions = (_tmp0 = gtk_action_group_new ("key"), (self->priv->_key_actions == NULL ? NULL : (self->priv->_key_actions = (g_object_unref (self->priv->_key_actions), NULL))), _tmp0);
- gtk_action_group_set_translation_domain (self->priv->_key_actions, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (self->priv->_key_actions, SEAHORSE_VIEWER_KEY_ENTRIES, G_N_ELEMENTS (SEAHORSE_VIEWER_KEY_ENTRIES), self);
- g_signal_connect_object (gtk_action_group_get_action (self->priv->_key_actions, "key-properties"), "activate", ((GCallback) (_seahorse_viewer_on_key_properties_gtk_action_activate)), self, 0);
- g_signal_connect_object (gtk_action_group_get_action (self->priv->_key_actions, "key-export-file"), "activate", ((GCallback) (_seahorse_viewer_on_key_export_file_gtk_action_activate)), self, 0);
- g_signal_connect_object (gtk_action_group_get_action (self->priv->_key_actions, "key-export-clipboard"), "activate", ((GCallback) (_seahorse_viewer_on_key_export_clipboard_gtk_action_activate)), self, 0);
- g_signal_connect_object (gtk_action_group_get_action (self->priv->_key_actions, "key-delete"), "activate", ((GCallback) (_seahorse_viewer_on_key_delete_gtk_action_activate)), self, 0);
+ self->priv->_object_actions = (_tmp0 = gtk_action_group_new ("key"), (self->priv->_object_actions == NULL ? NULL : (self->priv->_object_actions = (g_object_unref (self->priv->_object_actions), NULL))), _tmp0);
+ gtk_action_group_set_translation_domain (self->priv->_object_actions, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (self->priv->_object_actions, SEAHORSE_VIEWER_KEY_ENTRIES, G_N_ELEMENTS (SEAHORSE_VIEWER_KEY_ENTRIES), self);
+ g_signal_connect_object (gtk_action_group_get_action (self->priv->_object_actions, "key-properties"), "activate", ((GCallback) (_seahorse_viewer_on_key_properties_gtk_action_activate)), self, 0);
+ g_signal_connect_object (gtk_action_group_get_action (self->priv->_object_actions, "key-export-file"), "activate", ((GCallback) (_seahorse_viewer_on_key_export_file_gtk_action_activate)), self, 0);
+ g_signal_connect_object (gtk_action_group_get_action (self->priv->_object_actions, "key-export-clipboard"), "activate", ((GCallback) (_seahorse_viewer_on_key_export_clipboard_gtk_action_activate)), self, 0);
+ g_signal_connect_object (gtk_action_group_get_action (self->priv->_object_actions, "key-delete"), "activate", ((GCallback) (_seahorse_viewer_on_key_delete_gtk_action_activate)), self, 0);
/* Mark the properties toolbar button as important */
- g_object_set (gtk_action_group_get_action (self->priv->_key_actions, "key-properties"), "is-important", TRUE, NULL);
- seahorse_viewer_include_actions (self, self->priv->_key_actions);
+ g_object_set (gtk_action_group_get_action (self->priv->_object_actions, "key-properties"), "is-important", TRUE, NULL);
+ seahorse_viewer_include_actions (self, self->priv->_object_actions);
(actions == NULL ? NULL : (actions = (g_object_unref (actions), NULL)));
}
@@ -170,37 +171,37 @@
}
-static GList* seahorse_viewer_real_get_selected_keys (SeahorseViewer* self) {
+static GList* seahorse_viewer_real_get_selected_objects (SeahorseViewer* self) {
g_return_val_if_fail (SEAHORSE_IS_VIEWER (self), NULL);
return NULL;
}
-GList* seahorse_viewer_get_selected_keys (SeahorseViewer* self) {
- return SEAHORSE_VIEWER_GET_CLASS (self)->get_selected_keys (self);
+GList* seahorse_viewer_get_selected_objects (SeahorseViewer* self) {
+ return SEAHORSE_VIEWER_GET_CLASS (self)->get_selected_objects (self);
}
-static void seahorse_viewer_real_set_selected_keys (SeahorseViewer* self, GList* keys) {
+static void seahorse_viewer_real_set_selected_objects (SeahorseViewer* self, GList* objects) {
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
- g_return_if_fail (keys != NULL);
+ g_return_if_fail (objects != NULL);
}
-void seahorse_viewer_set_selected_keys (SeahorseViewer* self, GList* keys) {
- SEAHORSE_VIEWER_GET_CLASS (self)->set_selected_keys (self, keys);
+void seahorse_viewer_set_selected_objects (SeahorseViewer* self, GList* objects) {
+ SEAHORSE_VIEWER_GET_CLASS (self)->set_selected_objects (self, objects);
}
-static SeahorseKey* seahorse_viewer_real_get_selected_key_and_uid (SeahorseViewer* self, guint* uid) {
+static SeahorseObject* seahorse_viewer_real_get_selected_object_and_uid (SeahorseViewer* self, guint* uid) {
g_return_val_if_fail (SEAHORSE_IS_VIEWER (self), NULL);
/* Must be overridden */
return NULL;
}
-SeahorseKey* seahorse_viewer_get_selected_key_and_uid (SeahorseViewer* self, guint* uid) {
- return SEAHORSE_VIEWER_GET_CLASS (self)->get_selected_key_and_uid (self, uid);
+SeahorseObject* seahorse_viewer_get_selected_object_and_uid (SeahorseViewer* self, guint* uid) {
+ return SEAHORSE_VIEWER_GET_CLASS (self)->get_selected_object_and_uid (self, uid);
}
@@ -350,15 +351,15 @@
}
-void seahorse_viewer_show_properties (SeahorseViewer* self, SeahorseKey* key) {
+void seahorse_viewer_show_properties (SeahorseViewer* self, SeahorseObject* obj) {
SeahorseCommands* _tmp0;
SeahorseCommands* commands;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
- g_return_if_fail (SEAHORSE_IS_KEY (key));
+ g_return_if_fail (SEAHORSE_IS_OBJECT (obj));
_tmp0 = NULL;
- commands = (_tmp0 = ((SeahorseCommands*) (g_hash_table_lookup (self->priv->_commands, GINT_TO_POINTER (seahorse_key_get_ktype (key))))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ commands = (_tmp0 = ((SeahorseCommands*) (g_hash_table_lookup (self->priv->_commands, GINT_TO_POINTER (seahorse_object_get_tag (obj))))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
if (commands != NULL) {
- seahorse_commands_show_properties (commands, key);
+ seahorse_commands_show_properties (commands, obj);
}
(commands == NULL ? NULL : (commands = (g_object_unref (commands), NULL)));
}
@@ -367,20 +368,20 @@
static void seahorse_viewer_on_key_properties (SeahorseViewer* self, GtkAction* action) {
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (GTK_IS_ACTION (action));
- if (seahorse_viewer_get_selected_key (self) != NULL) {
- seahorse_viewer_show_properties (self, seahorse_viewer_get_selected_key (self));
+ if (seahorse_viewer_get_selected (self) != NULL) {
+ seahorse_viewer_show_properties (self, seahorse_viewer_get_selected (self));
}
}
-static gint seahorse_viewer_compare_by_ktype (SeahorseViewer* self, SeahorseKey* one, SeahorseKey* two) {
+static gint seahorse_viewer_compare_by_tag (SeahorseViewer* self, SeahorseObject* one, SeahorseObject* two) {
GQuark kone;
GQuark ktwo;
g_return_val_if_fail (SEAHORSE_IS_VIEWER (self), 0);
- g_return_val_if_fail (SEAHORSE_IS_KEY (one), 0);
- g_return_val_if_fail (SEAHORSE_IS_KEY (two), 0);
- kone = seahorse_key_get_ktype (one);
- ktwo = seahorse_key_get_ktype (two);
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (one), 0);
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (two), 0);
+ kone = seahorse_object_get_tag (one);
+ ktwo = seahorse_object_get_tag (two);
if (kone < ktwo) {
return -1;
}
@@ -391,19 +392,19 @@
}
-static void seahorse_viewer_delete_key_batch (SeahorseViewer* self, GList* keys) {
+static void seahorse_viewer_delete_object_batch (SeahorseViewer* self, GList* objects) {
GError * inner_error;
SeahorseCommands* _tmp0;
SeahorseCommands* commands;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
- g_return_if_fail (keys != NULL);
+ g_return_if_fail (objects != NULL);
inner_error = NULL;
- g_assert (keys != NULL);
+ g_assert (objects != NULL);
_tmp0 = NULL;
- commands = (_tmp0 = ((SeahorseCommands*) (g_hash_table_lookup (self->priv->_commands, GINT_TO_POINTER (seahorse_key_get_ktype (((SeahorseKey*) (((SeahorseKey*) (keys->data))))))))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ commands = (_tmp0 = ((SeahorseCommands*) (g_hash_table_lookup (self->priv->_commands, GINT_TO_POINTER (seahorse_object_get_tag (((SeahorseObject*) (((SeahorseObject*) (objects->data))))))))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
{
if (commands != NULL) {
- seahorse_commands_delete_keys (commands, keys, &inner_error);
+ seahorse_commands_delete_objects (commands, objects, &inner_error);
if (inner_error != NULL) {
goto __catch1_g_error;
}
@@ -416,7 +417,7 @@
ex = inner_error;
inner_error = NULL;
{
- seahorse_util_handle_error (ex, _ ("Couldn't delete keys."), seahorse_view_get_window (SEAHORSE_VIEW (self)), NULL);
+ seahorse_util_handle_error (ex, _ ("Couldn't delete."), seahorse_view_get_window (SEAHORSE_VIEW (self)), NULL);
(ex == NULL ? NULL : (ex = (g_error_free (ex), NULL)));
}
}
@@ -427,7 +428,7 @@
static void seahorse_viewer_on_key_delete (SeahorseViewer* self, GtkAction* action) {
- GList* keys;
+ GList* objects;
GList* batch;
GList* _tmp0;
guint num;
@@ -435,34 +436,34 @@
GList* _tmp4;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (GTK_IS_ACTION (action));
- keys = NULL;
+ objects = NULL;
batch = NULL;
- /* Get the selected keys and sort them by ktype */
+ /* Get the selected objects and sort them by ktype */
_tmp0 = NULL;
- keys = (_tmp0 = seahorse_viewer_get_selected_keys (self), (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL))), _tmp0);
- keys = g_list_sort (keys, ((GCompareFunc) (seahorse_viewer_compare_by_ktype)));
- num = g_list_length (keys);
+ objects = (_tmp0 = seahorse_viewer_get_selected_objects (self), (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL))), _tmp0);
+ objects = g_list_sort (objects, ((GCompareFunc) (seahorse_viewer_compare_by_tag)));
+ num = g_list_length (objects);
if (num == 0) {
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(batch == NULL ? NULL : (batch = (g_list_free (batch), NULL)));
return;
}
- /* Check for private keys */
+ /* Check for private objects */
{
- GList* key_collection;
- GList* key_it;
- key_collection = keys;
- for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
- SeahorseKey* key;
- key = ((SeahorseKey*) (key_it->data));
+ GList* object_collection;
+ GList* object_it;
+ object_collection = objects;
+ for (object_it = object_collection; object_it != NULL; object_it = object_it->next) {
+ SeahorseObject* object;
+ object = ((SeahorseObject*) (object_it->data));
{
- if (seahorse_key_get_etype (key) == SKEY_PRIVATE) {
+ if (seahorse_object_get_usage (object) == SEAHORSE_USAGE_PRIVATE_KEY) {
char* prompt;
prompt = NULL;
if (num == 1) {
char* _tmp1;
_tmp1 = NULL;
- prompt = (_tmp1 = g_strdup_printf (_ ("%s is a private key. Are you sure you want to proceed?"), seahorse_key_get_display_name (((SeahorseKey*) (((SeahorseKey*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp1);
+ prompt = (_tmp1 = g_strdup_printf (_ ("%s is a private key. Are you sure you want to proceed?"), seahorse_object_get_description (((SeahorseObject*) (((SeahorseObject*) (objects->data)))))), (prompt = (g_free (prompt), NULL)), _tmp1);
} else {
char* _tmp3;
const char* _tmp2;
@@ -472,7 +473,7 @@
}
if (!seahorse_util_prompt_delete (prompt)) {
prompt = (g_free (prompt), NULL);
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(batch == NULL ? NULL : (batch = (g_list_free (batch), NULL)));
return;
}
@@ -485,33 +486,33 @@
_tmp4 = NULL;
batch = (_tmp4 = NULL, (batch == NULL ? NULL : (batch = (g_list_free (batch), NULL))), _tmp4);
{
- GList* key_collection;
- GList* key_it;
- key_collection = keys;
- for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
- SeahorseKey* _tmp6;
- SeahorseKey* key;
+ GList* object_collection;
+ GList* object_it;
+ object_collection = objects;
+ for (object_it = object_collection; object_it != NULL; object_it = object_it->next) {
+ SeahorseObject* _tmp6;
+ SeahorseObject* object;
_tmp6 = NULL;
- key = (_tmp6 = ((SeahorseKey*) (key_it->data)), (_tmp6 == NULL ? NULL : g_object_ref (_tmp6)));
+ object = (_tmp6 = ((SeahorseObject*) (object_it->data)), (_tmp6 == NULL ? NULL : g_object_ref (_tmp6)));
{
/* Process that batch */
- if (ktype != seahorse_key_get_ktype (key) && batch != NULL) {
+ if (ktype != seahorse_object_get_tag (object) && batch != NULL) {
GList* _tmp5;
- seahorse_viewer_delete_key_batch (self, batch);
+ seahorse_viewer_delete_object_batch (self, batch);
_tmp5 = NULL;
batch = (_tmp5 = NULL, (batch == NULL ? NULL : (batch = (g_list_free (batch), NULL))), _tmp5);
}
/* Add to the batch */
- batch = g_list_prepend (batch, key);
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
+ batch = g_list_prepend (batch, object);
+ (object == NULL ? NULL : (object = (g_object_unref (object), NULL)));
}
}
}
/* Process last batch */
if (batch != NULL) {
- seahorse_viewer_delete_key_batch (self, batch);
+ seahorse_viewer_delete_object_batch (self, batch);
}
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(batch == NULL ? NULL : (batch = (g_list_free (batch), NULL)));
}
@@ -568,21 +569,21 @@
static void seahorse_viewer_on_key_export_clipboard (SeahorseViewer* self, GtkAction* action) {
- GList* keys;
+ GList* objects;
GOutputStream* output;
SeahorseOperation* op;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (GTK_IS_ACTION (action));
- keys = seahorse_viewer_get_selected_keys (self);
- if (keys == NULL) {
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ objects = seahorse_viewer_get_selected_objects (self);
+ if (objects == NULL) {
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
return;
}
output = G_OUTPUT_STREAM (g_memory_output_stream_new (NULL, ((gulong) (0)), _g_realloc_grealloc_func, _g_free_gdestroy_notify));
- op = seahorse_key_source_export_keys (keys, output);
+ op = seahorse_source_export_objects (objects, output);
seahorse_progress_show (op, _ ("Retrieving keys"), TRUE);
seahorse_operation_watch (op, _seahorse_viewer_on_copy_complete_seahorse_done_func, self, NULL, NULL);
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(output == NULL ? NULL : (output = (g_object_unref (output), NULL)));
(op == NULL ? NULL : (op = (g_object_unref (op), NULL)));
}
@@ -604,22 +605,22 @@
static void seahorse_viewer_on_key_export_file (SeahorseViewer* self, GtkAction* action) {
GError * inner_error;
- GList* keys;
+ GList* objects;
GtkDialog* _tmp0;
GtkDialog* dialog;
char* uri;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (GTK_IS_ACTION (action));
inner_error = NULL;
- keys = seahorse_viewer_get_selected_keys (self);
- if (keys == NULL) {
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ objects = seahorse_viewer_get_selected_objects (self);
+ if (objects == NULL) {
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
return;
}
_tmp0 = NULL;
dialog = (_tmp0 = seahorse_util_chooser_save_new (_ ("Export public key"), seahorse_view_get_window (SEAHORSE_VIEW (self))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
seahorse_util_chooser_show_key_files (dialog);
- seahorse_util_chooser_set_filename (dialog, keys);
+ seahorse_util_chooser_set_filename (dialog, objects);
uri = seahorse_util_chooser_save_prompt (dialog);
if (uri != NULL) {
{
@@ -631,7 +632,7 @@
if (inner_error != NULL) {
goto __catch2_g_error;
}
- op = seahorse_key_source_export_keys (keys, output);
+ op = seahorse_source_export_objects (objects, output);
seahorse_progress_show (op, _ ("Exporting keys"), TRUE);
seahorse_operation_watch (op, _seahorse_viewer_on_export_done_seahorse_done_func, self, NULL, NULL);
(file == NULL ? NULL : (file = (g_object_unref (file), NULL)));
@@ -650,7 +651,7 @@
seahorse_util_handle_error (ex, _ ("Couldn't export key to \"%s\""), (_tmp1 = seahorse_util_uri_get_last (uri)), NULL);
_tmp1 = (g_free (_tmp1), NULL);
(ex == NULL ? NULL : (ex = (g_error_free (ex), NULL)));
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(dialog == NULL ? NULL : (dialog = (g_object_unref (dialog), NULL)));
uri = (g_free (uri), NULL);
return;
@@ -659,7 +660,7 @@
__finally2:
;
}
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(dialog == NULL ? NULL : (dialog = (g_object_unref (dialog), NULL)));
uri = (g_free (uri), NULL);
}
@@ -668,7 +669,7 @@
static void seahorse_viewer_on_selection_changed (SeahorseViewer* self, SeahorseView* view) {
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (SEAHORSE_IS_VIEW (view));
- gtk_action_group_set_sensitive (self->priv->_key_actions, seahorse_view_get_selected_key (view) != NULL);
+ gtk_action_group_set_sensitive (self->priv->_object_actions, seahorse_view_get_selected (view) != NULL);
}
@@ -703,9 +704,9 @@
}
-SeahorseKey* seahorse_viewer_get_selected_key (SeahorseViewer* self) {
- SeahorseKey* value;
- g_object_get (G_OBJECT (self), "selected-key", &value, NULL);
+SeahorseObject* seahorse_viewer_get_selected (SeahorseViewer* self) {
+ SeahorseObject* value;
+ g_object_get (G_OBJECT (self), "selected", &value, NULL);
if (value != NULL) {
g_object_unref (value);
}
@@ -713,31 +714,31 @@
}
-static SeahorseKey* seahorse_viewer_real_get_selected_key (SeahorseViewer* self) {
+static SeahorseObject* seahorse_viewer_real_get_selected (SeahorseViewer* self) {
g_return_val_if_fail (SEAHORSE_IS_VIEWER (self), NULL);
/* Must be overridden */
return NULL;
}
-void seahorse_viewer_set_selected_key (SeahorseViewer* self, SeahorseKey* value) {
- g_object_set (G_OBJECT (self), "selected-key", value, NULL);
+void seahorse_viewer_set_selected (SeahorseViewer* self, SeahorseObject* value) {
+ g_object_set (G_OBJECT (self), "selected", value, NULL);
}
-static void seahorse_viewer_real_set_selected_key (SeahorseViewer* self, SeahorseKey* value) {
- GList* keys;
+static void seahorse_viewer_real_set_selected (SeahorseViewer* self, SeahorseObject* value) {
+ GList* objects;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
- keys = NULL;
- keys = g_list_prepend (keys, value);
- seahorse_viewer_set_selected_keys (self, keys);
- (keys == NULL ? NULL : (keys = (g_list_free (keys), NULL)));
+ objects = NULL;
+ objects = g_list_prepend (objects, value);
+ seahorse_viewer_set_selected_objects (self, objects);
+ (objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
}
-SeahorseKeyset* seahorse_viewer_get_current_keyset (SeahorseViewer* self) {
- SeahorseKeyset* value;
- g_object_get (G_OBJECT (self), "current-keyset", &value, NULL);
+SeahorseSet* seahorse_viewer_get_current_set (SeahorseViewer* self) {
+ SeahorseSet* value;
+ g_object_get (G_OBJECT (self), "current-set", &value, NULL);
if (value != NULL) {
g_object_unref (value);
}
@@ -745,7 +746,7 @@
}
-static SeahorseKeyset* seahorse_viewer_real_get_current_keyset (SeahorseViewer* self) {
+static SeahorseSet* seahorse_viewer_real_get_current_set (SeahorseViewer* self) {
g_return_val_if_fail (SEAHORSE_IS_VIEWER (self), NULL);
/* Must be overridden */
return NULL;
@@ -872,11 +873,11 @@
SeahorseViewer * self;
self = SEAHORSE_VIEWER (object);
switch (property_id) {
- case SEAHORSE_VIEWER_SELECTED_KEY:
- g_value_set_object (value, seahorse_viewer_real_get_selected_key (self));
+ case SEAHORSE_VIEWER_SELECTED:
+ g_value_set_object (value, seahorse_viewer_real_get_selected (self));
break;
- case SEAHORSE_VIEWER_CURRENT_KEYSET:
- g_value_set_object (value, seahorse_viewer_real_get_current_keyset (self));
+ case SEAHORSE_VIEWER_CURRENT_SET:
+ g_value_set_object (value, seahorse_viewer_real_get_current_set (self));
break;
case SEAHORSE_VIEWER_WINDOW:
g_value_set_object (value, seahorse_viewer_real_get_window (self));
@@ -892,8 +893,8 @@
SeahorseViewer * self;
self = SEAHORSE_VIEWER (object);
switch (property_id) {
- case SEAHORSE_VIEWER_SELECTED_KEY:
- seahorse_viewer_real_set_selected_key (self, g_value_get_object (value));
+ case SEAHORSE_VIEWER_SELECTED:
+ seahorse_viewer_real_set_selected (self, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -909,20 +910,20 @@
G_OBJECT_CLASS (klass)->set_property = seahorse_viewer_set_property;
G_OBJECT_CLASS (klass)->constructor = seahorse_viewer_constructor;
G_OBJECT_CLASS (klass)->dispose = seahorse_viewer_dispose;
- SEAHORSE_VIEWER_CLASS (klass)->get_selected_keys = seahorse_viewer_real_get_selected_keys;
- SEAHORSE_VIEWER_CLASS (klass)->set_selected_keys = seahorse_viewer_real_set_selected_keys;
- SEAHORSE_VIEWER_CLASS (klass)->get_selected_key_and_uid = seahorse_viewer_real_get_selected_key_and_uid;
- g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_VIEWER_SELECTED_KEY, "selected-key");
- g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_VIEWER_CURRENT_KEYSET, "current-keyset");
+ SEAHORSE_VIEWER_CLASS (klass)->get_selected_objects = seahorse_viewer_real_get_selected_objects;
+ SEAHORSE_VIEWER_CLASS (klass)->set_selected_objects = seahorse_viewer_real_set_selected_objects;
+ SEAHORSE_VIEWER_CLASS (klass)->get_selected_object_and_uid = seahorse_viewer_real_get_selected_object_and_uid;
+ g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_VIEWER_SELECTED, "selected");
+ g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_VIEWER_CURRENT_SET, "current-set");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_VIEWER_WINDOW, "window");
}
static void seahorse_viewer_seahorse_view_interface_init (SeahorseViewIface * iface) {
seahorse_viewer_seahorse_view_parent_iface = g_type_interface_peek_parent (iface);
- iface->get_selected_keys = seahorse_viewer_get_selected_keys;
- iface->set_selected_keys = seahorse_viewer_set_selected_keys;
- iface->get_selected_key_and_uid = seahorse_viewer_get_selected_key_and_uid;
+ iface->get_selected_objects = seahorse_viewer_get_selected_objects;
+ iface->set_selected_objects = seahorse_viewer_set_selected_objects;
+ iface->get_selected_object_and_uid = seahorse_viewer_get_selected_object_and_uid;
}
@@ -935,7 +936,7 @@
SeahorseViewer * self;
self = SEAHORSE_VIEWER (obj);
(self->priv->_ui_manager == NULL ? NULL : (self->priv->_ui_manager = (g_object_unref (self->priv->_ui_manager), NULL)));
- (self->priv->_key_actions == NULL ? NULL : (self->priv->_key_actions = (g_object_unref (self->priv->_key_actions), NULL)));
+ (self->priv->_object_actions == NULL ? NULL : (self->priv->_object_actions = (g_object_unref (self->priv->_object_actions), NULL)));
(self->priv->_commands == NULL ? NULL : (self->priv->_commands = (g_hash_table_unref (self->priv->_commands), NULL)));
G_OBJECT_CLASS (seahorse_viewer_parent_class)->dispose (obj);
}
Modified: trunk/src/seahorse-viewer.h
==============================================================================
--- trunk/src/seahorse-viewer.h (original)
+++ trunk/src/seahorse-viewer.h Thu Jul 17 01:41:51 2008
@@ -27,10 +27,10 @@
#include <seahorse-widget.h>
#include <seahorse-view.h>
#include <gtk/gtk.h>
-#include <seahorse-key.h>
+#include <seahorse-object.h>
#include <stdlib.h>
#include <string.h>
-#include <seahorse-keyset.h>
+#include <seahorse-set.h>
G_BEGIN_DECLS
@@ -53,24 +53,24 @@
struct _SeahorseViewerClass {
SeahorseWidgetClass parent_class;
- GList* (*get_selected_keys) (SeahorseViewer* self);
- void (*set_selected_keys) (SeahorseViewer* self, GList* keys);
- SeahorseKey* (*get_selected_key_and_uid) (SeahorseViewer* self, guint* uid);
+ GList* (*get_selected_objects) (SeahorseViewer* self);
+ void (*set_selected_objects) (SeahorseViewer* self, GList* objects);
+ SeahorseObject* (*get_selected_object_and_uid) (SeahorseViewer* self, guint* uid);
};
void seahorse_viewer_ensure_updated (SeahorseViewer* self);
void seahorse_viewer_include_actions (SeahorseViewer* self, GtkActionGroup* actions);
-GList* seahorse_viewer_get_selected_keys (SeahorseViewer* self);
-void seahorse_viewer_set_selected_keys (SeahorseViewer* self, GList* keys);
-SeahorseKey* seahorse_viewer_get_selected_key_and_uid (SeahorseViewer* self, guint* uid);
+GList* seahorse_viewer_get_selected_objects (SeahorseViewer* self);
+void seahorse_viewer_set_selected_objects (SeahorseViewer* self, GList* objects);
+SeahorseObject* seahorse_viewer_get_selected_object_and_uid (SeahorseViewer* self, guint* uid);
void seahorse_viewer_show_context_menu (SeahorseViewer* self, guint button, guint time);
-void seahorse_viewer_show_properties (SeahorseViewer* self, SeahorseKey* key);
+void seahorse_viewer_show_properties (SeahorseViewer* self, SeahorseObject* obj);
void seahorse_viewer_set_status (SeahorseViewer* self, const char* text);
void seahorse_viewer_set_numbered_status (SeahorseViewer* self, const char* text, gint num);
-SeahorseKey* seahorse_viewer_get_selected_key (SeahorseViewer* self);
-void seahorse_viewer_set_selected_key (SeahorseViewer* self, SeahorseKey* value);
-SeahorseKeyset* seahorse_viewer_get_current_keyset (SeahorseViewer* self);
+SeahorseObject* seahorse_viewer_get_selected (SeahorseViewer* self);
+void seahorse_viewer_set_selected (SeahorseViewer* self, SeahorseObject* value);
+SeahorseSet* seahorse_viewer_get_current_set (SeahorseViewer* self);
GType seahorse_viewer_get_type (void);
Modified: trunk/src/seahorse-viewer.vala
==============================================================================
--- trunk/src/seahorse-viewer.vala (original)
+++ trunk/src/seahorse-viewer.vala Thu Jul 17 01:41:51 2008
@@ -26,7 +26,7 @@
public abstract class Viewer : Widget, View {
private UIManager _ui_manager;
- private ActionGroup _key_actions;
+ private ActionGroup _object_actions;
private HashTable<Quark, Commands> _commands;
private static bool _about_initialized;
@@ -112,18 +112,18 @@
actions.get_action("help-show").activate += on_help_show;
include_actions (actions);
- _key_actions = new Gtk.ActionGroup ("key");
- _key_actions.set_translation_domain (Config.GETTEXT_PACKAGE);
- _key_actions.add_actions (KEY_ENTRIES, this);
- _key_actions.get_action("key-properties").activate += on_key_properties;
- _key_actions.get_action("key-export-file").activate += on_key_export_file;
- _key_actions.get_action("key-export-clipboard").activate += on_key_export_clipboard;
- _key_actions.get_action("key-delete").activate += on_key_delete;
+ _object_actions = new Gtk.ActionGroup ("key");
+ _object_actions.set_translation_domain (Config.GETTEXT_PACKAGE);
+ _object_actions.add_actions (KEY_ENTRIES, this);
+ _object_actions.get_action("key-properties").activate += on_key_properties;
+ _object_actions.get_action("key-export-file").activate += on_key_export_file;
+ _object_actions.get_action("key-export-clipboard").activate += on_key_export_clipboard;
+ _object_actions.get_action("key-delete").activate += on_key_delete;
/* Mark the properties toolbar button as important */
- _key_actions.get_action("key-properties").is_important = true;
+ _object_actions.get_action("key-properties").is_important = true;
- include_actions (_key_actions);
+ include_actions (_object_actions);
}
protected void ensure_updated () {
@@ -134,34 +134,34 @@
_ui_manager.insert_action_group (actions, -1);
}
- public virtual List<weak Key> get_selected_keys () {
- return new List<weak Key>();
+ public virtual List<weak Object> get_selected_objects () {
+ return new List<weak Object>();
}
- public virtual void set_selected_keys (List<Key> keys) {
+ public virtual void set_selected_objects (List<Object> objects) {
/* Must be overridden */
}
- public virtual weak Key? selected_key {
+ public virtual weak Object? selected {
get {
/* Must be overridden */
return null;
}
set {
- List<weak Key> keys = new List<weak Key>();
- keys.prepend(value);
- set_selected_keys (keys);
+ List<weak Object> objects = new List<weak Object>();
+ objects.prepend(value);
+ set_selected_objects (objects);
}
}
- public virtual weak Keyset? current_keyset {
+ public virtual weak Set? current_set {
get {
/* Must be overridden */
return null;
}
}
- public virtual weak Key? get_selected_key_and_uid (out uint uid) {
+ public virtual weak Object? get_selected_object_and_uid (out uint uid) {
/* Must be overridden */
return null;
}
@@ -256,20 +256,20 @@
menu.show ();
}
- protected void show_properties (Key key) {
- var commands = _commands.lookup(key.ktype);
+ protected void show_properties (Object obj) {
+ var commands = _commands.lookup(obj.tag);
if (commands != null)
- commands.show_properties (key);
+ commands.show_properties (obj);
}
private void on_key_properties (Action action) {
- if (this.selected_key != null)
- show_properties (this.selected_key);
+ if (this.selected != null)
+ show_properties (this.selected);
}
- private int compare_by_ktype (Key one, Key two) {
- Quark kone = one.ktype;
- Quark ktwo = two.ktype;
+ private int compare_by_tag (Object one, Object two) {
+ Quark kone = one.tag;
+ Quark ktwo = two.tag;
if (kone < ktwo)
return -1;
if (kone > ktwo)
@@ -277,35 +277,35 @@
return 0;
}
- private void delete_key_batch (List<Key> keys) {
- assert (keys != null);
- var commands = _commands.lookup(keys.data.ktype);
+ private void delete_object_batch (List<Object> objects) {
+ assert (objects != null);
+ var commands = _commands.lookup(objects.data.tag);
try {
if (commands != null)
- commands.delete_keys (keys);
+ commands.delete_objects (objects);
} catch (GLib.Error ex) {
- Util.handle_error (ex, _("Couldn't delete keys."), window);
+ Util.handle_error (ex, _("Couldn't delete."), window);
}
}
private void on_key_delete (Action action) {
- List<weak Key> keys, batch;
+ List<weak Object> objects, batch;
- /* Get the selected keys and sort them by ktype */
- keys = get_selected_keys ();
- keys.sort ((GLib.CompareFunc)compare_by_ktype);
+ /* Get the selected objects and sort them by ktype */
+ objects = get_selected_objects ();
+ objects.sort ((GLib.CompareFunc)compare_by_tag);
- uint num = keys.length();
+ uint num = objects.length();
if (num == 0)
return;
- /* Check for private keys */
- foreach (var key in keys) {
- if (key.etype == Key.EType.PRIVATE) {
+ /* Check for private objects */
+ foreach (var object in objects) {
+ if (object.usage == Usage.PRIVATE_KEY) {
string prompt;
if (num == 1)
- prompt = _("%s is a private key. Are you sure you want to proceed?").printf(keys.data.display_name);
+ prompt = _("%s is a private key. Are you sure you want to proceed?").printf(objects.data.description);
else
prompt = _("One or more of the deleted keys are private keys. Are you sure you want to proceed?");
if (!Util.prompt_delete (prompt))
@@ -314,22 +314,22 @@
}
Quark ktype = 0;
- batch = new List<weak Key>();
- foreach (Key key in keys) {
+ batch = new List<weak Object>();
+ foreach (Object object in objects) {
/* Process that batch */
- if (ktype != key.ktype && batch != null) {
- delete_key_batch (batch);
- batch = new List<weak Key>();
+ if (ktype != object.tag && batch != null) {
+ delete_object_batch (batch);
+ batch = new List<weak Object>();
}
/* Add to the batch */
- batch.prepend (key);
+ batch.prepend (object);
}
/* Process last batch */
if (batch != null)
- delete_key_batch (batch);
+ delete_object_batch (batch);
}
private void on_copy_complete (Operation op) {
@@ -358,12 +358,12 @@
private void on_key_export_clipboard (Action action) {
- var keys = get_selected_keys ();
- if (keys == null)
+ var objects = get_selected_objects ();
+ if (objects == null)
return;
OutputStream output = new MemoryOutputStream (null, 0, realloc, free);
- Operation op = KeySource.export_keys (keys, output);
+ Operation op = Source.export_objects (objects, output);
Progress.show (op, _("Retrieving keys"), true);
op.watch (on_copy_complete, null);
@@ -376,13 +376,13 @@
private void on_key_export_file (Action action) {
- var keys = get_selected_keys ();
- if (keys == null)
+ var objects = get_selected_objects ();
+ if (objects == null)
return;
Gtk.Dialog dialog = Util.chooser_save_new (_("Export public key"), window);
Util.chooser_show_key_files (dialog);
- Util.chooser_set_filename (dialog, keys);
+ Util.chooser_set_filename (dialog, objects);
string uri = Util.chooser_save_prompt (dialog);
if (uri != null) {
@@ -391,7 +391,7 @@
var file = File.new_for_uri (uri);
OutputStream output = file.replace (null, false, 0, null);
- Operation op = KeySource.export_keys (keys, output);
+ Operation op = Source.export_objects (objects, output);
Progress.show (op, _("Exporting keys"), true);
op.watch (on_export_done, null);
@@ -405,7 +405,7 @@
}
private void on_selection_changed (View view) {
- _key_actions.set_sensitive (view.selected_key != null);
+ _object_actions.set_sensitive (view.selected != null);
}
protected void set_status (string text) {
Modified: trunk/src/vala-build.stamp
==============================================================================
--- trunk/src/vala-build.stamp (original)
+++ trunk/src/vala-build.stamp Thu Jul 17 01:41:51 2008
@@ -1 +1 @@
-1216229895
+1216254703
Modified: trunk/ssh/libseahorse-ssh-c.vapi
==============================================================================
--- trunk/ssh/libseahorse-ssh-c.vapi (original)
+++ trunk/ssh/libseahorse-ssh-c.vapi Thu Jul 17 01:41:51 2008
@@ -37,7 +37,7 @@
}
[CCode (cheader_filename = "seahorse-ssh-source.h")]
- public class Source : Seahorse.KeySource {
+ public class Source : Seahorse.Source {
}
Modified: trunk/ssh/seahorse-delete.c
==============================================================================
--- trunk/ssh/seahorse-delete.c (original)
+++ trunk/ssh/seahorse-delete.c Thu Jul 17 01:41:51 2008
@@ -101,7 +101,7 @@
void
seahorse_delete_show (GList *keys)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseKey *skey;
GError *error = NULL;
GList *list = NULL;
@@ -114,14 +114,14 @@
for (list = keys; list != NULL; list = g_list_next (list)) {
skey = SEAHORSE_KEY (list->data);
- if (seahorse_key_get_etype (skey) == SKEY_PRIVATE &&
+ if (seahorse_key_get_usage (skey) == SEAHORSE_USAGE_PRIVATE_KEY &&
!ask_key_pair (skey))
break;
sksrc = seahorse_key_get_source (skey);
g_return_if_fail (sksrc != NULL);
- if (!seahorse_key_source_remove (sksrc, skey, 0, &error)) {
+ if (!seahorse_source_remove (sksrc, SEAHORSE_OBJECT (skey), 0, &error)) {
seahorse_util_handle_error (error, _("Couldn't delete key"));
g_clear_error (&error);
}
@@ -169,7 +169,7 @@
seahorse_delete_userid_show (SeahorseKey *skey, guint index)
{
GtkWidget *question, *delete_button, *cancel_button;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
gint response;
GError *error = NULL;
gchar *userid;
@@ -205,7 +205,7 @@
sksrc = seahorse_key_get_source (skey);
g_return_if_fail (sksrc != NULL);
- if (!seahorse_key_source_remove (sksrc, skey, index, &error)) {
+ if (!seahorse_source_remove (sksrc, skey, index, &error)) {
seahorse_util_handle_error (error, _("Couldn't delete user id"));
g_clear_error (&error);
}
Modified: trunk/ssh/seahorse-ssh-commands.c
==============================================================================
--- trunk/ssh/seahorse-ssh-commands.c (original)
+++ trunk/ssh/seahorse-ssh-commands.c Thu Jul 17 01:41:51 2008
@@ -25,7 +25,8 @@
#include <seahorse-ssh-key.h>
#include <seahorse-view.h>
#include <seahorse-util.h>
-#include <seahorse-key-source.h>
+#include <seahorse-source.h>
+#include <seahorse-types.h>
#include <config.h>
#include <common/seahorse-registry.h>
#include "seahorse-ssh.h"
@@ -44,8 +45,8 @@
SEAHORSE_SSH_COMMANDS_UI_DEFINITION,
SEAHORSE_SSH_COMMANDS_COMMAND_ACTIONS
};
-static void seahorse_ssh_commands_real_show_properties (SeahorseCommands* base, SeahorseKey* key);
-static void seahorse_ssh_commands_real_delete_keys (SeahorseCommands* base, GList* keys, GError** error);
+static void seahorse_ssh_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key);
+static void seahorse_ssh_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error);
static void seahorse_ssh_commands_on_ssh_upload (SeahorseSSHCommands* self, GtkAction* action);
static void seahorse_ssh_commands_on_view_selection_changed (SeahorseSSHCommands* self, SeahorseView* view);
static void _seahorse_ssh_commands_on_ssh_upload_gtk_action_activate (GtkAction* _sender, gpointer self);
@@ -58,16 +59,16 @@
static const char* SEAHORSE_SSH_COMMANDS_UI_DEF = "\n\t\t\t<ui>\n\t\t\t\n\t\t\t<menubar>\n\t\t\t\t<menu name='Remote' action='remote-menu'>\n\t\t\t\t\t<menuitem action='remote-ssh-upload'/>\n\t\t\t\t</menu>\n\t\t\t</menubar>\n\t\t\t\n\t\t\t<popup name=\"KeyPopup\">\n\t\t\t\t<menuitem action=\"remote-ssh-upload\"/>\n\t\t\t</popup>\n\t\t\t\n\t\t\t</ui>\n\t\t";
-static void seahorse_ssh_commands_real_show_properties (SeahorseCommands* base, SeahorseKey* key) {
+static void seahorse_ssh_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key) {
SeahorseSSHCommands * self;
self = SEAHORSE_SSH_COMMANDS (base);
- g_return_if_fail (SEAHORSE_IS_KEY (key));
- g_return_if_fail (seahorse_key_get_ktype (key) == SEAHORSE_SSH_TYPE);
+ g_return_if_fail (SEAHORSE_IS_OBJECT (key));
+ g_return_if_fail (seahorse_object_get_tag (key) == SEAHORSE_SSH_TYPE);
seahorse_ssh_key_properties_show (SEAHORSE_SSH_KEY (key), seahorse_view_get_window (seahorse_commands_get_view (SEAHORSE_COMMANDS (self))));
}
-static void seahorse_ssh_commands_real_delete_keys (SeahorseCommands* base, GList* keys, GError** error) {
+static void seahorse_ssh_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error) {
SeahorseSSHCommands * self;
GError * inner_error;
guint num;
@@ -83,14 +84,14 @@
if (num == 1) {
char* _tmp0;
_tmp0 = NULL;
- prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the secure shell key '%s'?"), seahorse_key_get_display_name (((SeahorseKey*) (SEAHORSE_KEY (((SeahorseSSHKey*) (keys->data))))))), (prompt = (g_free (prompt), NULL)), _tmp0);
+ prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the secure shell key '%s'?"), seahorse_object_get_description (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp0);
} else {
char* _tmp1;
_tmp1 = NULL;
prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete %d secure shell keys?"), num), (prompt = (g_free (prompt), NULL)), _tmp1);
}
if (seahorse_util_prompt_delete (prompt)) {
- seahorse_key_source_delete_keys (keys, &inner_error);
+ seahorse_source_delete_objects (keys, &inner_error);
if (inner_error != NULL) {
g_propagate_error (error, inner_error);
prompt = (g_free (prompt), NULL);
@@ -107,21 +108,18 @@
g_return_if_fail (SEAHORSE_SSH_IS_COMMANDS (self));
g_return_if_fail (GTK_IS_ACTION (action));
ssh_keys = NULL;
- keys = seahorse_view_get_selected_keys (seahorse_commands_get_view (SEAHORSE_COMMANDS (self)));
+ keys = seahorse_view_get_selected_objects (seahorse_commands_get_view (SEAHORSE_COMMANDS (self)));
{
GList* key_collection;
GList* key_it;
key_collection = keys;
for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
- SeahorseSSHKey* _tmp0;
- SeahorseSSHKey* key;
- _tmp0 = NULL;
- key = (_tmp0 = ((SeahorseSSHKey*) (key_it->data)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ SeahorseObject* key;
+ key = ((SeahorseObject*) (key_it->data));
{
- if (seahorse_key_get_ktype (SEAHORSE_KEY (key)) == SEAHORSE_SSH_TYPE && seahorse_key_get_etype (SEAHORSE_KEY (key)) == SKEY_PRIVATE) {
- ssh_keys = g_list_append (ssh_keys, key);
+ if (seahorse_object_get_tag (key) == SEAHORSE_SSH_TYPE && seahorse_object_get_usage (key) == SEAHORSE_USAGE_PRIVATE_KEY) {
+ ssh_keys = g_list_append (ssh_keys, SEAHORSE_SSH_KEY (key));
}
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
}
}
}
@@ -136,24 +134,20 @@
gboolean enable;
g_return_if_fail (SEAHORSE_SSH_IS_COMMANDS (self));
g_return_if_fail (SEAHORSE_IS_VIEW (view));
- keys = seahorse_view_get_selected_keys (view);
+ keys = seahorse_view_get_selected_objects (view);
enable = (keys != NULL);
{
GList* key_collection;
GList* key_it;
key_collection = keys;
for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
- SeahorseSSHKey* _tmp0;
- SeahorseSSHKey* key;
- _tmp0 = NULL;
- key = (_tmp0 = ((SeahorseSSHKey*) (key_it->data)), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ SeahorseObject* key;
+ key = ((SeahorseObject*) (key_it->data));
{
- if (seahorse_key_get_ktype (SEAHORSE_KEY (key)) != SEAHORSE_SSH_TYPE || seahorse_key_get_etype (SEAHORSE_KEY (key)) != SKEY_PRIVATE) {
+ if (seahorse_object_get_tag (key) != SEAHORSE_SSH_TYPE || seahorse_object_get_usage (key) != SEAHORSE_USAGE_PRIVATE_KEY) {
enable = FALSE;
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
break;
}
- (key == NULL ? NULL : (key = (g_object_unref (key), NULL)));
}
}
}
@@ -251,7 +245,7 @@
G_OBJECT_CLASS (klass)->constructor = seahorse_ssh_commands_constructor;
G_OBJECT_CLASS (klass)->dispose = seahorse_ssh_commands_dispose;
SEAHORSE_COMMANDS_CLASS (klass)->show_properties = seahorse_ssh_commands_real_show_properties;
- SEAHORSE_COMMANDS_CLASS (klass)->delete_keys = seahorse_ssh_commands_real_delete_keys;
+ SEAHORSE_COMMANDS_CLASS (klass)->delete_objects = seahorse_ssh_commands_real_delete_objects;
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_SSH_COMMANDS_KTYPE, "ktype");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_SSH_COMMANDS_UI_DEFINITION, "ui-definition");
g_object_class_override_property (G_OBJECT_CLASS (klass), SEAHORSE_SSH_COMMANDS_COMMAND_ACTIONS, "command-actions");
Modified: trunk/ssh/seahorse-ssh-commands.h
==============================================================================
--- trunk/ssh/seahorse-ssh-commands.h (original)
+++ trunk/ssh/seahorse-ssh-commands.h Thu Jul 17 01:41:51 2008
@@ -25,7 +25,7 @@
#include <glib.h>
#include <glib-object.h>
#include <seahorse-commands.h>
-#include <seahorse-key.h>
+#include <seahorse-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
Modified: trunk/ssh/seahorse-ssh-commands.vala
==============================================================================
--- trunk/ssh/seahorse-ssh-commands.vala (original)
+++ trunk/ssh/seahorse-ssh-commands.vala Thu Jul 17 01:41:51 2008
@@ -62,44 +62,44 @@
}
}
- public override void show_properties (Seahorse.Key key) {
- return_if_fail (key.ktype == Seahorse.Ssh.TYPE);
+ public override void show_properties (Object key) {
+ return_if_fail (key.tag == Seahorse.Ssh.TYPE);
KeyProperties.show ((Ssh.Key)key, view.window);
}
- public override void delete_keys (List<Key> keys) throws GLib.Error {
+ public override void delete_objects (List<Object> keys) throws GLib.Error {
uint num = keys.length();
if (num == 0)
return;
string prompt;
if (num == 1)
- prompt = _("Are you sure you want to delete the secure shell key '%s'?").printf(keys.data.display_name);
+ prompt = _("Are you sure you want to delete the secure shell key '%s'?").printf(keys.data.description);
else
prompt = _("Are you sure you want to delete %d secure shell keys?").printf(num);
if (Util.prompt_delete (prompt))
- KeySource.delete_keys (keys);
+ Seahorse.Source.delete_objects (keys);
}
private void on_ssh_upload (Action action) {
List<weak Key> ssh_keys;
- List<weak Key> keys = view.get_selected_keys ();
- foreach (Key key in keys) {
- if (key.ktype == Seahorse.Ssh.TYPE &&
- key.etype == Seahorse.Key.EType.PRIVATE)
- ssh_keys.append (key);
+ var keys = view.get_selected_objects ();
+ foreach (var key in keys) {
+ if (key.tag == Seahorse.Ssh.TYPE &&
+ key.usage == Seahorse.Usage.PRIVATE_KEY)
+ ssh_keys.append ((Ssh.Key)key);
}
Upload.prompt (keys, view.window);
}
private void on_view_selection_changed (View view) {
- List<weak Key> keys = view.get_selected_keys ();
+ var keys = view.get_selected_objects ();
bool enable = (keys != null);
- foreach (Key key in keys) {
- if (key.ktype != Seahorse.Ssh.TYPE ||
- key.etype != Seahorse.Key.EType.PRIVATE) {
+ foreach (var key in keys) {
+ if (key.tag != Seahorse.Ssh.TYPE ||
+ key.usage != Seahorse.Usage.PRIVATE_KEY) {
enable = false;
break;
}
Modified: trunk/ssh/seahorse-ssh-generator.c
==============================================================================
--- trunk/ssh/seahorse-ssh-generator.c (original)
+++ trunk/ssh/seahorse-ssh-generator.c Thu Jul 17 01:41:51 2008
@@ -24,8 +24,8 @@
#include <stdlib.h>
#include <string.h>
#include <seahorse-context.h>
-#include <seahorse-key.h>
-#include <seahorse-key-source.h>
+#include <seahorse-types.h>
+#include <seahorse-source.h>
#include <seahorse-ssh-dialogs.h>
#include <seahorse-ssh-source.h>
#include <config.h>
@@ -53,12 +53,12 @@
static void seahorse_ssh_generator_on_ssh_generate (SeahorseSSHGenerator* self, GtkAction* action) {
- SeahorseKeySource* _tmp0;
- SeahorseKeySource* sksrc;
+ SeahorseSource* _tmp0;
+ SeahorseSource* sksrc;
g_return_if_fail (SEAHORSE_SSH_IS_GENERATOR (self));
g_return_if_fail (GTK_IS_ACTION (action));
_tmp0 = NULL;
- sksrc = (_tmp0 = seahorse_context_find_key_source (seahorse_context_for_app (), SEAHORSE_SSH_TYPE, SKEY_LOC_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
+ sksrc = (_tmp0 = seahorse_context_find_source (seahorse_context_for_app (), SEAHORSE_SSH_TYPE, SEAHORSE_LOCATION_LOCAL), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
g_return_if_fail (sksrc != NULL);
seahorse_ssh_generate_show (SEAHORSE_SSH_SOURCE (sksrc), NULL);
(sksrc == NULL ? NULL : (sksrc = (g_object_unref (sksrc), NULL)));
Modified: trunk/ssh/seahorse-ssh-generator.vala
==============================================================================
--- trunk/ssh/seahorse-ssh-generator.vala (original)
+++ trunk/ssh/seahorse-ssh-generator.vala Thu Jul 17 01:41:51 2008
@@ -50,7 +50,7 @@
}
private void on_ssh_generate (Action action) {
- KeySource sksrc = Context.for_app().find_key_source(Seahorse.Ssh.TYPE, Seahorse.Key.Loc.LOCAL);
+ var sksrc = Context.for_app().find_source(Seahorse.Ssh.TYPE, Seahorse.Location.LOCAL);
GLib.return_if_fail (sksrc != null);
Generate.show ((Ssh.Source)sksrc, null);
}
Modified: trunk/ssh/seahorse-ssh-key-properties.c
==============================================================================
--- trunk/ssh/seahorse-ssh-key-properties.c (original)
+++ trunk/ssh/seahorse-ssh-key-properties.c Thu Jul 17 01:41:51 2008
@@ -87,7 +87,7 @@
{
SeahorseKey *key;
SeahorseSSHKey *skey;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseOperation *op;
const gchar *text;
gchar *comment;
@@ -133,7 +133,7 @@
static void
trust_toggled (GtkToggleButton *button, SeahorseWidget *swidget)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseOperation *op;
SeahorseKey *key;
SeahorseSSHKey *skey;
@@ -204,7 +204,7 @@
static void
export_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
{
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseOperation *op;
SeahorseKey *skey;
GFileOutputStream *output;
@@ -228,14 +228,14 @@
return;
sksrc = seahorse_key_get_source (skey);
- g_assert (SEAHORSE_IS_KEY_SOURCE (sksrc));
+ g_assert (SEAHORSE_IS_SOURCE (sksrc));
file = g_file_new_for_uri (uri);
output = g_file_replace (file, NULL, FALSE, 0, NULL, &err);
g_object_unref (file);
if (output) {
- op = seahorse_key_source_export (sksrc, keys, TRUE, G_OUTPUT_STREAM (output));
+ op = seahorse_source_export (sksrc, keys, TRUE, G_OUTPUT_STREAM (output));
seahorse_operation_wait (op);
g_object_unref (output);
@@ -344,7 +344,7 @@
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 (skey, "changed", G_CALLBACK (key_changed), swidget);
g_signal_connect_after (skey, "destroy", G_CALLBACK (key_destroyed), swidget);
@@ -365,7 +365,7 @@
g_signal_connect (widget, "activate", G_CALLBACK (comment_activate), swidget);
g_signal_connect (widget, "focus-out-event", G_CALLBACK (comment_focus_out), swidget);
- if (seahorse_key_get_etype (key) == SKEY_PRIVATE) {
+ if (seahorse_key_get_usage (key) == SEAHORSE_USAGE_PRIVATE_KEY) {
glade_xml_signal_connect_data (swidget->xml, "export_button_clicked",
G_CALLBACK (export_button_clicked), swidget);
glade_xml_signal_connect_data (swidget->xml, "passphrase_button_clicked",
Modified: trunk/ssh/seahorse-ssh-key.c
==============================================================================
--- trunk/ssh/seahorse-ssh-key.c (original)
+++ trunk/ssh/seahorse-ssh-key.c Thu Jul 17 01:41:51 2008
@@ -27,7 +27,7 @@
#include <glib/gi18n.h>
#include "seahorse-context.h"
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#include "seahorse-ssh-source.h"
#include "seahorse-ssh-key.h"
#include "seahorse-ssh-operation.h"
@@ -73,6 +73,7 @@
changed_key (SeahorseSSHKey *skey)
{
SeahorseKey *key = SEAHORSE_KEY (skey);
+ SeahorseObject *obj = SEAHORSE_OBJECT (skey);
g_free (skey->priv->displayname);
skey->priv->displayname = NULL;
@@ -102,40 +103,40 @@
}
/* Now start setting the main SeahorseKey fields */
- key->ktype = SEAHORSE_SSH;
- key->keyid = 0;
+ obj->_tag = SEAHORSE_SSH;
+ obj->_id = 0;
if (!skey->keydata || !skey->keydata->fingerprint) {
- key->location = SKEY_LOC_INVALID;
- key->etype = SKEY_ETYPE_NONE;
+ obj->_location = SEAHORSE_LOCATION_INVALID;
+ obj->_usage = SEAHORSE_USAGE_NONE;
key->loaded = SKEY_INFO_NONE;
- key->flags = SKEY_FLAG_DISABLED;
+ obj->_flags = SKEY_FLAG_DISABLED;
key->keydesc = _("Invalid");
key->rawid = NULL;
} else {
/* The key id */
- key->keyid = seahorse_ssh_key_get_cannonical_id (skey->keydata->fingerprint);
+ obj->_id = seahorse_ssh_key_get_cannonical_id (skey->keydata->fingerprint);
key->rawid = skey->keydata->fingerprint;
- key->location = SKEY_LOC_LOCAL;
+ obj->_location = SEAHORSE_LOCATION_LOCAL;
key->loaded = SKEY_INFO_COMPLETE;
- key->flags = skey->keydata->authorized ? SKEY_FLAG_TRUSTED : 0;
+ obj->_flags = skey->keydata->authorized ? SKEY_FLAG_TRUSTED : 0;
if (skey->keydata->privfile) {
- key->etype = SKEY_PRIVATE;
+ obj->_usage = SEAHORSE_USAGE_PRIVATE_KEY;
key->keydesc = _("Private Secure Shell Key");
} else {
- key->etype = SKEY_PUBLIC;
+ obj->_usage = SEAHORSE_USAGE_PUBLIC_KEY;
key->keydesc = _("Public Secure Shell Key");
}
}
- if (!key->keyid)
- key->keyid = g_quark_from_string (SEAHORSE_SSH_STR ":UNKNOWN ");
+ if (!obj->_id)
+ obj->_id = g_quark_from_string (SEAHORSE_SSH_STR ":UNKNOWN ");
- seahorse_key_changed (key, SKEY_CHANGE_ALL);
+ seahorse_object_fire_changed (obj, SKEY_CHANGE_ALL);
}
static guint
@@ -337,15 +338,11 @@
*/
SeahorseSSHKey*
-seahorse_ssh_key_new (SeahorseKeySource *sksrc, SeahorseSSHKeyData *data)
+seahorse_ssh_key_new (SeahorseSource *sksrc, SeahorseSSHKeyData *data)
{
SeahorseSSHKey *skey;
skey = g_object_new (SEAHORSE_TYPE_SSH_KEY, "key-source", sksrc,
"key-data", data, NULL);
-
- /* We don't care about this floating business */
- g_object_ref (GTK_OBJECT (skey));
- gtk_object_sink (GTK_OBJECT (skey));
return skey;
}
Modified: trunk/ssh/seahorse-ssh-key.h
==============================================================================
--- trunk/ssh/seahorse-ssh-key.h (original)
+++ trunk/ssh/seahorse-ssh-key.h Thu Jul 17 01:41:51 2008
@@ -42,7 +42,7 @@
#include <gtk/gtk.h>
#include "seahorse-key.h"
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#include "seahorse-operation.h"
#include "seahorse-ssh-module.h"
@@ -77,7 +77,7 @@
SeahorseKeyClass parent_class;
};
-SeahorseSSHKey* seahorse_ssh_key_new (SeahorseKeySource *sksrc,
+SeahorseSSHKey* seahorse_ssh_key_new (SeahorseSource *sksrc,
SeahorseSSHKeyData *data);
GType seahorse_ssh_key_get_type (void);
Modified: trunk/ssh/seahorse-ssh-operation.c
==============================================================================
--- trunk/ssh/seahorse-ssh-operation.c (original)
+++ trunk/ssh/seahorse-ssh-operation.c Thu Jul 17 01:41:51 2008
@@ -752,7 +752,7 @@
g_return_val_if_fail (output, NULL);
/* Buffer for what we send to the server */
- op = seahorse_key_source_export (SEAHORSE_KEY_SOURCE (ssrc), keys, FALSE, G_OUTPUT_STREAM (output));
+ op = seahorse_source_export (SEAHORSE_SOURCE (ssrc), keys, FALSE, G_OUTPUT_STREAM (output));
g_return_val_if_fail (op != NULL, NULL);
/*
@@ -840,7 +840,7 @@
{
SeahorseSSHOperationPrivate *pv = SEAHORSE_SSH_OPERATION_GET_PRIVATE (sop);
if (pv->prompt_skey)
- seahorse_key_source_load_async (SEAHORSE_KEY_SOURCE (sop->sksrc),
+ seahorse_source_load_async (SEAHORSE_SOURCE (sop->sksrc),
seahorse_key_get_keyid (pv->prompt_skey));
}
@@ -848,7 +848,7 @@
seahorse_ssh_operation_change_passphrase (SeahorseSSHKey *skey)
{
SeahorseSSHOperationPrivate *pv;
- SeahorseKeySource *ssrc;
+ SeahorseSource *ssrc;
SeahorseOperation *op;
gchar *cmd;
@@ -1216,7 +1216,7 @@
/* Just reload that one key */
if (!err)
- seahorse_key_source_load (SEAHORSE_KEY_SOURCE (ssrc),
+ seahorse_source_load (SEAHORSE_SOURCE (ssrc),
seahorse_key_get_keyid (SEAHORSE_KEY (skey)));
return seahorse_operation_new_complete (err);
Modified: trunk/ssh/seahorse-ssh-source.c
==============================================================================
--- trunk/ssh/seahorse-ssh-source.c (original)
+++ trunk/ssh/seahorse-ssh-source.c Thu Jul 17 01:41:51 2008
@@ -86,7 +86,7 @@
SeahorseMultiOperation *mop;
} ImportContext;
-G_DEFINE_TYPE (SeahorseSSHSource, seahorse_ssh_source, SEAHORSE_TYPE_KEY_SOURCE);
+G_DEFINE_TYPE (SeahorseSSHSource, seahorse_ssh_source, SEAHORSE_TYPE_SOURCE);
#define AUTHORIZED_KEYS_FILE "authorized_keys"
#define OTHER_KEYS_FILE "other_keys.seahorse"
@@ -140,18 +140,18 @@
}
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
* need to reload in that case */
if (change != SKEY_CHANGE_ALL)
- 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);
@@ -171,11 +171,11 @@
remove_key_from_context (gpointer hkey, SeahorseKey *dummy, SeahorseSSHSource *ssrc)
{
GQuark keyid = GPOINTER_TO_UINT (hkey);
- SeahorseKey *skey;
+ SeahorseObject *sobj;
- skey = seahorse_context_get_key (SCTX_APP (), SEAHORSE_KEY_SOURCE (ssrc), keyid);
- if (skey != NULL)
- seahorse_context_remove_key (SCTX_APP (), skey);
+ sobj = seahorse_context_get_object (SCTX_APP (), SEAHORSE_SOURCE (ssrc), keyid);
+ if (sobj != NULL)
+ seahorse_context_remove_object (SCTX_APP (), sobj);
}
@@ -184,7 +184,7 @@
{
DEBUG_REFRESH ("scheduled refresh event ocurring now\n");
cancel_scheduled_refresh (ssrc);
- seahorse_key_source_load_async (SEAHORSE_KEY_SOURCE (ssrc), 0);
+ seahorse_source_load_async (SEAHORSE_SOURCE (ssrc), 0);
return FALSE; /* don't run again */
}
@@ -256,9 +256,9 @@
ssh_key_from_data (SeahorseSSHSource *ssrc, LoadContext *ctx,
SeahorseSSHKeyData *keydata)
{
- SeahorseKeySource *sksrc = SEAHORSE_KEY_SOURCE (ssrc);
+ SeahorseSource *sksrc = SEAHORSE_SOURCE (ssrc);
SeahorseSSHKey *skey;
- SeahorseKey *prev;
+ SeahorseObject *prev;
GQuark keyid;
g_assert (ctx);
@@ -273,7 +273,7 @@
g_return_val_if_fail (keyid, NULL);
/* Does this key exist in the context? */
- prev = seahorse_context_get_key (SCTX_APP (), sksrc, keyid);
+ prev = seahorse_context_get_object (SCTX_APP (), sksrc, keyid);
/* Mark this key as seen */
if (ctx->checks)
@@ -323,7 +323,7 @@
g_signal_connect (skey, "changed", G_CALLBACK (key_changed), sksrc);
g_signal_connect (skey, "destroy", G_CALLBACK (key_destroyed), sksrc);
- seahorse_context_take_key (SCTX_APP (), SEAHORSE_KEY (skey));
+ seahorse_context_take_object (SCTX_APP (), SEAHORSE_OBJECT (skey));
return skey;
}
@@ -391,15 +391,15 @@
}
static GHashTable*
-load_present_keys (SeahorseKeySource *sksrc)
+load_present_keys (SeahorseSource *sksrc)
{
GList *keys, *l;
GHashTable *checks;
checks = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
- keys = seahorse_context_get_keys (SCTX_APP (), sksrc);
+ keys = seahorse_context_get_objects (SCTX_APP (), sksrc);
for (l = keys; l; l = g_list_next (l))
- g_hash_table_insert (checks, GUINT_TO_POINTER (seahorse_key_get_keyid (l->data)),
+ g_hash_table_insert (checks, GUINT_TO_POINTER (seahorse_object_get_id (l->data)),
GUINT_TO_POINTER (TRUE));
g_list_free (keys);
return checks;
@@ -443,7 +443,7 @@
*/
static SeahorseOperation*
-seahorse_ssh_source_load (SeahorseKeySource *sksrc, GQuark keymatch)
+seahorse_ssh_source_load (SeahorseSource *sksrc, GQuark keymatch)
{
SeahorseSSHSource *ssrc;
GError *err = NULL;
@@ -558,7 +558,7 @@
}
static SeahorseOperation*
-seahorse_ssh_source_import (SeahorseKeySource *sksrc, GInputStream *input)
+seahorse_ssh_source_import (SeahorseSource *sksrc, GInputStream *input)
{
SeahorseSSHSource *ssrc = SEAHORSE_SSH_SOURCE (sksrc);
ImportContext ctx;
@@ -582,7 +582,7 @@
}
static SeahorseOperation*
-seahorse_ssh_source_export (SeahorseKeySource *sksrc, GList *keys,
+seahorse_ssh_source_export (SeahorseSource *sksrc, GList *keys,
gboolean complete, GOutputStream *output)
{
SeahorseSSHKeyData *keydata;
@@ -661,7 +661,7 @@
}
static gboolean
-seahorse_ssh_source_remove (SeahorseKeySource *sksrc, SeahorseKey *skey,
+seahorse_ssh_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
guint name, GError **err)
{
SeahorseSSHKeyData *keydata = NULL;
@@ -670,10 +670,10 @@
gchar *fullpath;
g_assert (name == 0);
- g_assert (seahorse_key_get_source (skey) == sksrc);
+ g_assert (seahorse_object_get_source (sobj) == sksrc);
g_assert (!err || !*err);
- g_object_get (skey, "key-data", &keydata, NULL);
+ g_object_get (sobj, "key-data", &keydata, NULL);
g_return_val_if_fail (keydata, FALSE);
/* Just part of a file for this key */
@@ -715,7 +715,7 @@
}
if (ret)
- seahorse_key_destroy (SEAHORSE_KEY (skey));
+ seahorse_context_remove_object (SCTX_APP (), sobj);
return ret;
}
@@ -741,7 +741,7 @@
g_value_set_string (value, _("Secure Shell Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SKEY_LOC_LOCAL);
+ g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
break;
case PROP_BASE_DIRECTORY:
g_value_set_string (value, ssrc->priv->ssh_homedir);
@@ -820,7 +820,7 @@
seahorse_ssh_source_class_init (SeahorseSSHSourceClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- SeahorseKeySourceClass *parent_class = SEAHORSE_KEY_SOURCE_CLASS (klass);
+ SeahorseSourceClass *parent_class = SEAHORSE_SOURCE_CLASS (klass);
seahorse_ssh_source_parent_class = g_type_class_peek_parent (klass);
@@ -829,7 +829,7 @@
gobject_class->set_property = seahorse_ssh_source_set_property;
gobject_class->get_property = seahorse_ssh_source_get_property;
- parent_class->canonize_keyid = seahorse_ssh_key_get_cannonical_id;
+ parent_class->canonize_id = seahorse_ssh_key_get_cannonical_id;
parent_class->load = seahorse_ssh_source_load;
parent_class->import = seahorse_ssh_source_import;
parent_class->export = seahorse_ssh_source_export;
@@ -844,8 +844,8 @@
NULL, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_LOCATION,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseKeyLoc",
- 0, G_MAXUINT, SKEY_LOC_INVALID, G_PARAM_READABLE));
+ g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
+ 0, G_MAXUINT, SEAHORSE_LOCATION_INVALID, G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_BASE_DIRECTORY,
g_param_spec_string ("base-directory", "Key directory", "Directory where the keys are stored",
@@ -877,7 +877,7 @@
for (i = 0; i < 2; i++) {
/* Try to find it first */
- keys = seahorse_context_get_keys (SCTX_APP (), SEAHORSE_KEY_SOURCE (ssrc));
+ keys = seahorse_context_get_objects (SCTX_APP (), SEAHORSE_SOURCE (ssrc));
for (l = keys; l; l = g_list_next (l)) {
g_object_get (l->data, "key-data", &data, NULL);
@@ -890,7 +890,7 @@
/* Force loading of all new keys */
if (!i) {
- seahorse_key_source_load_sync (SEAHORSE_KEY_SOURCE (ssrc), 0);
+ seahorse_source_load_sync (SEAHORSE_SOURCE (ssrc), 0);
}
}
Modified: trunk/ssh/seahorse-ssh-source.h
==============================================================================
--- trunk/ssh/seahorse-ssh-source.h (original)
+++ trunk/ssh/seahorse-ssh-source.h Thu Jul 17 01:41:51 2008
@@ -22,7 +22,7 @@
/**
* SeahorseSSHSource: A key source for SSH keys.
*
- * - Derived from SeahorseKeySource
+ * - Derived from SeahorseSource
* - Lists all the keys in ~/.ssh/ by searching through every file.
* - Loads public keys from ~/.ssh/authorized_keys and ~/.ssh/other_keys.seahorse
* - Adds the keys it loads to the SeahorseContext.
@@ -31,15 +31,15 @@
* Properties:
* ktype: (GQuark) The ktype (ie: SEAHORSE_SSH) of keys originating from this
key source.
- * location: (SeahorseKeyLoc) The location of keys that come from this
- * source. (ie: SKEY_LOC_LOCAL)
+ * location: (SeahorseLocation) The location of keys that come from this
+ * source. (ie: SEAHORSE_LOCATION_LOCAL)
*/
#ifndef __SEAHORSE_SSH_SOURCE_H__
#define __SEAHORSE_SSH_SOURCE_H__
#include "seahorse-ssh-key.h"
-#include "seahorse-key-source.h"
+#include "seahorse-source.h"
#define SEAHORSE_TYPE_SSH_SOURCE (seahorse_ssh_source_get_type ())
#define SEAHORSE_SSH_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_SSH_SOURCE, SeahorseSSHSource))
@@ -54,14 +54,14 @@
typedef struct _SeahorseSSHSourcePrivate SeahorseSSHSourcePrivate;
struct _SeahorseSSHSource {
- SeahorseKeySource parent;
+ SeahorseSource parent;
/*< private >*/
SeahorseSSHSourcePrivate *priv;
};
struct _SeahorseSSHSourceClass {
- SeahorseKeySourceClass parent_class;
+ SeahorseSourceClass parent_class;
};
GType seahorse_ssh_source_get_type (void);
Modified: trunk/ssh/seahorse-ssh-upload.c
==============================================================================
--- trunk/ssh/seahorse-ssh-upload.c (original)
+++ trunk/ssh/seahorse-ssh-upload.c Thu Jul 17 01:41:51 2008
@@ -85,17 +85,17 @@
{
SeahorseMultiOperation *mop = NULL;
SeahorseOperation *op = NULL;
- SeahorseKeySource *sksrc;
+ SeahorseSource *sksrc;
SeahorseKey *skey;
GList *next;
- seahorse_util_keylist_sort (keys);
+ seahorse_util_objects_sort (keys);
g_assert (keys);
while (keys) {
/* Break off one set (same keysource) */
- next = seahorse_util_keylist_splice (keys);
+ next = seahorse_util_objects_splice (keys);
g_assert (SEAHORSE_IS_KEY (keys->data));
skey = SEAHORSE_KEY (keys->data);
Modified: trunk/ssh/vala-build.stamp
==============================================================================
--- trunk/ssh/vala-build.stamp (original)
+++ trunk/ssh/vala-build.stamp Thu Jul 17 01:41:51 2008
@@ -1 +1 @@
-1216229865
+1216254350
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]