seahorse r2663 - in trunk: . daemon gkr libseahorse pgp pkcs11 src ssh
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2663 - in trunk: . daemon gkr libseahorse pgp pkcs11 src ssh
- Date: Sun, 14 Dec 2008 23:27:13 +0000 (UTC)
Author: nnielsen
Date: Sun Dec 14 23:27:12 2008
New Revision: 2663
URL: http://svn.gnome.org/viewvc/seahorse?rev=2663&view=rev
Log:
* daemon/seahorse-daemon.c:
* gkr/seahorse-gkr-item-properties.c:
* gkr/seahorse-gkr-keyring.c:
* gkr/seahorse-gkr-source.c:
* gkr/seahorse-gkr-source.h:
* libseahorse/seahorse-context.c:
* libseahorse/seahorse-context.h:
* libseahorse/seahorse-source.c:
* libseahorse/seahorse-unknown-source.c:
* pgp/seahorse-hkp-source.c:
* pgp/seahorse-ldap-source.c:
* pgp/seahorse-pgp-source.c:
* pgp/seahorse-server-source.c:
* pkcs11/seahorse-pkcs11-source.c:
* src/main.c:
* src/seahorse-key-manager.h:
* src/seahorse-key-manager.c:
* ssh/seahorse-ssh-source.c: Make SeahorseGkrKeyring be both
a SeahorseObject and a SeahorseSource. Enumerate keyrings
properly. Don't list items in locked keyrings. Refresh
sources as they're added to the context.
Modified:
trunk/ChangeLog
trunk/daemon/seahorse-daemon.c
trunk/gkr/seahorse-gkr-item-properties.c
trunk/gkr/seahorse-gkr-keyring.c
trunk/gkr/seahorse-gkr-module.c
trunk/gkr/seahorse-gkr-source.c
trunk/gkr/seahorse-gkr-source.h
trunk/libseahorse/seahorse-context.c
trunk/libseahorse/seahorse-context.h
trunk/libseahorse/seahorse-marshal.list
trunk/libseahorse/seahorse-source.c
trunk/libseahorse/seahorse-unknown-source.c
trunk/pgp/seahorse-hkp-source.c
trunk/pgp/seahorse-ldap-source.c
trunk/pgp/seahorse-pgp-source.c
trunk/pgp/seahorse-server-source.c
trunk/pkcs11/seahorse-pkcs11-source.c
trunk/src/main.c
trunk/src/seahorse-key-manager.c
trunk/src/seahorse-key-manager.h
trunk/ssh/seahorse-ssh-source.c
Modified: trunk/daemon/seahorse-daemon.c
==============================================================================
--- trunk/daemon/seahorse-daemon.c (original)
+++ trunk/daemon/seahorse-daemon.c Sun Dec 14 23:27:12 2008
@@ -182,7 +182,6 @@
int main(int argc, char* argv[])
{
- SeahorseOperation *op;
GOptionContext *octx = NULL;
GError *error = NULL;
@@ -233,8 +232,7 @@
seahorse_ssh_module_init ();
#endif
- op = seahorse_context_refresh_local (NULL);
- g_object_unref (op);
+ seahorse_context_refresh_auto (NULL);
/* Initialize the various daemon components */
seahorse_dbus_server_init ();
Modified: trunk/gkr/seahorse-gkr-item-properties.c
==============================================================================
--- trunk/gkr/seahorse-gkr-item-properties.c (original)
+++ trunk/gkr/seahorse-gkr-item-properties.c Sun Dec 14 23:27:12 2008
@@ -298,7 +298,7 @@
SeahorseOperation *op = NULL;
GnomeKeyringItemInfo *info;
const gchar *text;
- gchar *original;
+ const gchar *original;
object = SEAHORSE_OBJECT_WIDGET (swidget)->object;
if (!object)
@@ -340,7 +340,6 @@
gtk_widget_set_sensitive (entry, TRUE);
g_object_unref (entry);
g_object_unref (git);
- g_free (original);
if (op) {
if (!seahorse_operation_is_successful (op))
Modified: trunk/gkr/seahorse-gkr-keyring.c
==============================================================================
--- trunk/gkr/seahorse-gkr-keyring.c (original)
+++ trunk/gkr/seahorse-gkr-keyring.c Sun Dec 14 23:27:12 2008
@@ -25,8 +25,250 @@
#include "seahorse-gkr-keyring.h"
#include "seahorse-gkr-operation.h"
+#include <glib/gi18n.h>
+
+/* -----------------------------------------------------------------------------
+ * LIST OPERATION
+ */
+
+
+#define SEAHORSE_TYPE_GKR_LIST_OPERATION (seahorse_gkr_list_operation_get_type ())
+#define SEAHORSE_GKR_LIST_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_GKR_LIST_OPERATION, SeahorseGkrListOperation))
+#define SEAHORSE_GKR_LIST_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_GKR_LIST_OPERATION, SeahorseGkrListOperationClass))
+#define SEAHORSE_IS_GKR_LIST_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_GKR_LIST_OPERATION))
+#define SEAHORSE_IS_GKR_LIST_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_GKR_LIST_OPERATION))
+#define SEAHORSE_GKR_LIST_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_GKR_LIST_OPERATION, SeahorseGkrListOperationClass))
+
+typedef struct _SeahorseGkrListOperation SeahorseGkrListOperation;
+typedef struct _SeahorseGkrListOperationClass SeahorseGkrListOperationClass;
+
+struct _SeahorseGkrListOperation {
+ SeahorseOperation parent;
+ SeahorseGkrKeyring *keyring;
+ gpointer request;
+};
+
+struct _SeahorseGkrListOperationClass {
+ SeahorseOperationClass parent_class;
+};
+
+G_DEFINE_TYPE (SeahorseGkrListOperation, seahorse_gkr_list_operation, SEAHORSE_TYPE_OPERATION);
+
+static void
+keyring_operation_failed (SeahorseGkrListOperation *self, GnomeKeyringResult result)
+{
+ SeahorseOperation *op = SEAHORSE_OPERATION (self);
+ GError *err = NULL;
+
+ g_assert (result != GNOME_KEYRING_RESULT_OK);
+ g_assert (result != GNOME_KEYRING_RESULT_CANCELLED);
+
+ if (!seahorse_operation_is_running (op))
+ return;
+
+ if (self->request)
+ gnome_keyring_cancel_request (self->request);
+ self->request = NULL;
+
+ seahorse_gkr_operation_parse_error (result, &err);
+ g_assert (err != NULL);
+
+ seahorse_operation_mark_done (op, FALSE, err);
+}
+
+/* Remove the given key from the context */
+static void
+remove_key_from_context (gpointer kt, SeahorseObject *dummy, SeahorseSource *sksrc)
+{
+ /* This function gets called as a GHFunc on the self->checks hashtable. */
+ GQuark keyid = GPOINTER_TO_UINT (kt);
+ SeahorseObject *sobj;
+
+ sobj = seahorse_context_get_object (SCTX_APP (), sksrc, keyid);
+ if (sobj != NULL)
+ seahorse_context_remove_object (SCTX_APP (), sobj);
+}
+
+static void
+insert_id_hashtable (SeahorseObject *object, gpointer user_data)
+{
+ g_hash_table_insert ((GHashTable*)user_data,
+ GUINT_TO_POINTER (seahorse_object_get_id (object)),
+ GUINT_TO_POINTER (TRUE));
+}
+
+static void
+on_list_item_ids (GnomeKeyringResult result, GList *list, SeahorseGkrListOperation *self)
+{
+ SeahorseObjectPredicate pred;
+ SeahorseGkrItem *git;
+ const gchar *keyring_name;
+ GHashTable *checks;
+ guint32 item_id;
+ GQuark id;
+
+ if (result == GNOME_KEYRING_RESULT_CANCELLED)
+ return;
+
+ self->request = NULL;
+
+ if (result != GNOME_KEYRING_RESULT_OK) {
+ keyring_operation_failed (self, result);
+ return;
+ }
+
+ keyring_name = seahorse_gkr_keyring_get_name (self->keyring);
+ g_return_if_fail (keyring_name);
+
+ /* When loading new keys prepare a list of current */
+ checks = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
+ seahorse_object_predicate_clear (&pred);
+ pred.source = SEAHORSE_SOURCE (self->keyring);
+ pred.type = SEAHORSE_TYPE_GKR_ITEM;
+ seahorse_context_for_objects_full (SCTX_APP (), &pred, insert_id_hashtable, checks);
+
+ while (list) {
+ item_id = GPOINTER_TO_UINT (list->data);
+ id = seahorse_gkr_item_get_cannonical (keyring_name, item_id);
+
+ git = SEAHORSE_GKR_ITEM (seahorse_context_get_object (SCTX_APP (),
+ SEAHORSE_SOURCE (self->keyring), id));
+ if (!git) {
+ git = seahorse_gkr_item_new (SEAHORSE_SOURCE (self->keyring), keyring_name, item_id);
+
+ /* Add to context */
+ seahorse_object_set_parent (SEAHORSE_OBJECT (git), SEAHORSE_OBJECT (self->keyring));
+ seahorse_context_take_object (SCTX_APP (), SEAHORSE_OBJECT (git));
+ }
+
+ g_hash_table_remove (checks, GUINT_TO_POINTER (id));
+ list = g_list_next (list);
+ }
+
+ g_hash_table_foreach (checks, (GHFunc)remove_key_from_context,
+ SEAHORSE_SOURCE (self->keyring));
+
+ g_hash_table_destroy (checks);
+
+ seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, NULL);
+}
+
+static void
+on_keyring_info (GnomeKeyringResult result, GnomeKeyringInfo *info, SeahorseGkrListOperation *self)
+{
+ if (result == GNOME_KEYRING_RESULT_CANCELLED)
+ return;
+
+ self->request = NULL;
+
+ if (result != GNOME_KEYRING_RESULT_OK) {
+ keyring_operation_failed (self, result);
+ return;
+ }
+
+ seahorse_gkr_keyring_set_info (self->keyring, info);
+ if (gnome_keyring_info_get_is_locked (info)) {
+ /* Locked, no items... */
+ on_list_item_ids (GNOME_KEYRING_RESULT_OK, NULL, self);
+ } else {
+ g_object_ref (self);
+ self->request = gnome_keyring_list_item_ids (seahorse_gkr_keyring_get_name (self->keyring),
+ (GnomeKeyringOperationGetListCallback)on_list_item_ids,
+ self, g_object_unref);
+ }
+}
+
+static SeahorseOperation*
+start_gkr_list_operation (SeahorseGkrKeyring *keyring)
+{
+ SeahorseGkrListOperation *self;
+
+ g_assert (SEAHORSE_IS_GKR_KEYRING (keyring));
+
+ self = g_object_new (SEAHORSE_TYPE_GKR_LIST_OPERATION, NULL);
+ self->keyring = keyring;
+
+ /* Start listing of ids */
+ seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+ seahorse_operation_mark_progress (SEAHORSE_OPERATION (self), _("Listing passwords"), -1);
+
+ g_object_ref (self);
+ self->request = gnome_keyring_get_info (seahorse_gkr_keyring_get_name (keyring),
+ (GnomeKeyringOperationGetKeyringInfoCallback)on_keyring_info,
+ self, g_object_unref);
+
+ return SEAHORSE_OPERATION (self);
+}
+
+static void
+seahorse_gkr_list_operation_cancel (SeahorseOperation *operation)
+{
+ SeahorseGkrListOperation *self = SEAHORSE_GKR_LIST_OPERATION (operation);
+
+ if (self->request)
+ gnome_keyring_cancel_request (self->request);
+ self->request = NULL;
+
+ if (seahorse_operation_is_running (operation))
+ seahorse_operation_mark_done (operation, TRUE, NULL);
+}
+
+static void
+seahorse_gkr_list_operation_init (SeahorseGkrListOperation *self)
+{
+ /* Everything already set to zero */
+}
+
+static void
+seahorse_gkr_list_operation_dispose (GObject *gobject)
+{
+ SeahorseGkrListOperation *self = SEAHORSE_GKR_LIST_OPERATION (gobject);
+
+ /* Cancel it if it's still running */
+ if (seahorse_operation_is_running (SEAHORSE_OPERATION (self)))
+ seahorse_gkr_list_operation_cancel (SEAHORSE_OPERATION (self));
+ g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (self)));
+
+ /* The above cancel should have stopped this */
+ g_assert (self->request == NULL);
+
+ G_OBJECT_CLASS (seahorse_gkr_list_operation_parent_class)->dispose (gobject);
+}
+
+static void
+seahorse_gkr_list_operation_finalize (GObject *gobject)
+{
+ SeahorseGkrListOperation *self = SEAHORSE_GKR_LIST_OPERATION (gobject);
+ g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (self)));
+
+ /* The above cancel should have stopped this */
+ g_assert (self->request == NULL);
+
+ G_OBJECT_CLASS (seahorse_gkr_list_operation_parent_class)->finalize (gobject);
+}
+
+static void
+seahorse_gkr_list_operation_class_init (SeahorseGkrListOperationClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ SeahorseOperationClass *operation_class = SEAHORSE_OPERATION_CLASS (klass);
+
+ seahorse_gkr_list_operation_parent_class = g_type_class_peek_parent (klass);
+ gobject_class->dispose = seahorse_gkr_list_operation_dispose;
+ gobject_class->finalize = seahorse_gkr_list_operation_finalize;
+ operation_class->cancel = seahorse_gkr_list_operation_cancel;
+
+}
+
+/* -----------------------------------------------------------------------------------------
+ * KEYRING
+ */
+
enum {
PROP_0,
+ PROP_KEY_TYPE,
+ PROP_KEY_DESC,
+ PROP_LOCATION,
PROP_KEYRING_NAME,
PROP_KEYRING_INFO
};
@@ -38,7 +280,10 @@
GnomeKeyringInfo *keyring_info;
};
-G_DEFINE_TYPE (SeahorseGkrKeyring, seahorse_gkr_keyring, SEAHORSE_TYPE_OBJECT);
+static void seahorse_source_iface (SeahorseSourceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (SeahorseGkrKeyring, seahorse_gkr_keyring, SEAHORSE_TYPE_OBJECT, 0,
+ G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SOURCE, seahorse_source_iface));
GType
boxed_type_keyring_info (void)
@@ -142,6 +387,12 @@
return seahorse_gkr_operation_delete_keyring (self);
}
+static SeahorseOperation*
+seahorse_gkr_keyring_load (SeahorseSource *src)
+{
+ SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (src);
+ return start_gkr_list_operation (self);
+}
static GObject*
seahorse_gkr_keyring_constructor (GType type, guint n_props, GObjectConstructParam *props)
@@ -219,6 +470,15 @@
SeahorseGkrKeyring *self = SEAHORSE_GKR_KEYRING (obj);
switch (prop_id) {
+ case PROP_KEY_TYPE:
+ g_value_set_uint (value, SEAHORSE_GKR_TYPE);
+ break;
+ case PROP_KEY_DESC:
+ g_value_set_string (value, _("Passwords"));
+ break;
+ case PROP_LOCATION:
+ g_value_set_enum (value, SEAHORSE_LOCATION_LOCAL);
+ break;
case PROP_KEYRING_NAME:
g_value_set_string (value, seahorse_gkr_keyring_get_name (self));
break;
@@ -250,6 +510,10 @@
seahorse_class->refresh = seahorse_gkr_keyring_refresh;
seahorse_class->delete = seahorse_gkr_keyring_delete;
+ g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
+ g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
+ g_object_class_override_property (gobject_class, PROP_LOCATION, "location");
+
g_object_class_install_property (gobject_class, PROP_KEYRING_NAME,
g_param_spec_string ("keyring-name", "Gnome Keyring Name", "Name of keyring.",
"", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
@@ -259,6 +523,12 @@
boxed_type_keyring_info (), G_PARAM_READWRITE));
}
+static void
+seahorse_source_iface (SeahorseSourceIface *iface)
+{
+ iface->load = seahorse_gkr_keyring_load;
+}
+
/* -----------------------------------------------------------------------------
* PUBLIC
*/
Modified: trunk/gkr/seahorse-gkr-module.c
==============================================================================
--- trunk/gkr/seahorse-gkr-module.c (original)
+++ trunk/gkr/seahorse-gkr-module.c Sun Dec 14 23:27:12 2008
@@ -33,26 +33,10 @@
void
seahorse_gkr_module_init (void)
{
- GnomeKeyringResult result;
SeahorseSource *source;
- const gchar *keyring_name;
- GList *l, *keyrings = NULL;
-
- /* List the keyrings and add one per */
- result = gnome_keyring_list_keyring_names_sync (&keyrings);
- if (result != GNOME_KEYRING_RESULT_OK) {
- g_warning ("couldn't get list gnome-keyring keyrings: %s",
- gnome_keyring_result_to_message (result));
- } else {
-
- for (l = keyrings; l; l = g_list_next (l)) {
- keyring_name = (const gchar*)l->data;
- source = SEAHORSE_SOURCE (seahorse_gkr_source_new (keyring_name));
- seahorse_context_take_source (NULL, source);
- }
-
- gnome_keyring_string_list_free (keyrings);
- }
+
+ source = SEAHORSE_SOURCE (seahorse_gkr_source_new ());
+ seahorse_context_take_source (NULL, source);
/* Let these classes register themselves */
g_type_class_unref (g_type_class_ref (SEAHORSE_TYPE_GKR_SOURCE));
Modified: trunk/gkr/seahorse-gkr-source.c
==============================================================================
--- trunk/gkr/seahorse-gkr-source.c (original)
+++ trunk/gkr/seahorse-gkr-source.c Sun Dec 14 23:27:12 2008
@@ -60,19 +60,12 @@
enum {
PROP_0,
- PROP_KEYRING_NAME,
PROP_KEY_TYPE,
PROP_FLAGS,
PROP_KEY_DESC,
PROP_LOCATION
};
-struct _SeahorseGkrSourcePrivate {
- SeahorseMultiOperation *operations; /* A list of all current operations */
- gchar *keyring_name; /* The key ring name */
- SeahorseObject *keyring_object; /* Object which represents the whole keyring */
-};
-
static void seahorse_source_iface (SeahorseSourceIface *iface);
G_DEFINE_TYPE_EXTENDED (SeahorseGkrSource, seahorse_gkr_source, G_TYPE_OBJECT, 0,
@@ -90,187 +83,179 @@
#define SEAHORSE_IS_LIST_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_LIST_OPERATION))
#define SEAHORSE_LIST_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_LIST_OPERATION, SeahorseListOperationClass))
-DECLARE_OPERATION (List, list)
+typedef struct _SeahorseListOperation SeahorseListOperation;
+typedef struct _SeahorseListOperationClass SeahorseListOperationClass;
- SeahorseGkrSource *gsrc;
- gpointer request;
- GHashTable *checks;
+struct _SeahorseListOperation {
+ SeahorseOperation parent;
+ SeahorseGkrSource *gsrc;
+ gpointer request;
+};
-END_DECLARE_OPERATION
+struct _SeahorseListOperationClass {
+ SeahorseOperationClass parent_class;
+};
-IMPLEMENT_OPERATION (List, list)
+G_DEFINE_TYPE (SeahorseListOperation, seahorse_list_operation, SEAHORSE_TYPE_OPERATION);
static void
-keyring_operation_failed (SeahorseListOperation *lop, GnomeKeyringResult result)
+remove_each_keyring_from_context (const gchar *keyring_name, SeahorseObject *keyring,
+ gpointer unused)
{
- SeahorseOperation *op = SEAHORSE_OPERATION (lop);
- GError *err = NULL;
-
- g_assert (result != GNOME_KEYRING_RESULT_OK);
- g_assert (result != GNOME_KEYRING_RESULT_CANCELLED);
-
- if (!seahorse_operation_is_running (op))
- return;
-
- if (lop->request)
- gnome_keyring_cancel_request (lop->request);
- lop->request = NULL;
-
- seahorse_gkr_operation_parse_error (result, &err);
- g_assert (err != NULL);
-
- seahorse_operation_mark_done (op, FALSE, err);
+ seahorse_context_remove_object (NULL, keyring);
+ seahorse_context_remove_source (NULL, SEAHORSE_SOURCE (keyring));
}
-/* Remove the given key from the context */
static void
-remove_key_from_context (gpointer kt, SeahorseObject *dummy, SeahorseSource *sksrc)
+insert_each_keyring_in_hashtable (SeahorseObject *object, gpointer user_data)
{
- /* This function gets called as a GHFunc on the lop->checks hashtable. */
- GQuark keyid = GPOINTER_TO_UINT (kt);
- SeahorseObject *sobj;
-
- sobj = seahorse_context_get_object (SCTX_APP (), sksrc, keyid);
- if (sobj != NULL)
- seahorse_context_remove_object (SCTX_APP (), sobj);
+ g_hash_table_insert ((GHashTable*)user_data,
+ g_strdup (seahorse_gkr_keyring_get_name (SEAHORSE_GKR_KEYRING (object))),
+ g_object_ref (object));
}
static void
-keyring_ids_ready (GnomeKeyringResult result, GList *list, SeahorseListOperation *lop)
+on_keyring_names (GnomeKeyringResult result, GList *list, SeahorseListOperation *self)
{
- SeahorseGkrItem *git;
+ SeahorseGkrKeyring *keyring;
+ SeahorseObjectPredicate pred;
+ GError *err = NULL;
gchar *keyring_name;
- guint32 item_id;
- GQuark id;
-
+ GHashTable *checks;
+ GList *l;
+
if (result == GNOME_KEYRING_RESULT_CANCELLED)
return;
-
- lop->request = NULL;
+
+ self->request = NULL;
+
+ if (!seahorse_operation_is_running (SEAHORSE_OPERATION (self)))
+ return;
if (result != GNOME_KEYRING_RESULT_OK) {
- keyring_operation_failed (lop, result);
+
+ g_assert (result != GNOME_KEYRING_RESULT_OK);
+ g_assert (result != GNOME_KEYRING_RESULT_CANCELLED);
+
+ if (self->request)
+ gnome_keyring_cancel_request (self->request);
+ self->request = NULL;
+
+ seahorse_gkr_operation_parse_error (result, &err);
+ g_assert (err != NULL);
+
+ seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, err);
return;
}
- g_object_get (lop->gsrc, "keyring-name", &keyring_name, NULL);
- g_return_if_fail (keyring_name);
-
- while (list) {
- item_id = GPOINTER_TO_UINT (list->data);
- id = seahorse_gkr_item_get_cannonical (keyring_name, item_id);
+ /* Load up a list of all the current names */
+ checks = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ seahorse_object_predicate_clear (&pred);
+ pred.source = SEAHORSE_SOURCE (self->gsrc);
+ pred.type = SEAHORSE_TYPE_GKR_KEYRING;
+ seahorse_context_for_objects_full (NULL, &pred, insert_each_keyring_in_hashtable, checks);
+
+ for (l = list; l; l = g_list_next (l)) {
+ keyring_name = l->data;
- git = SEAHORSE_GKR_ITEM (seahorse_context_get_object (SCTX_APP (),
- SEAHORSE_SOURCE (lop->gsrc), id));
- if (!git) {
- git = seahorse_gkr_item_new (SEAHORSE_SOURCE (lop->gsrc), keyring_name, item_id);
-
- /* Add to context */
- seahorse_object_set_parent (SEAHORSE_OBJECT (git), lop->gsrc->pv->keyring_object);
- seahorse_context_take_object (SCTX_APP (), SEAHORSE_OBJECT (git));
+ /* Register a new keyring if possible */
+ if (!g_hash_table_remove (checks, keyring_name)) {
+ keyring = seahorse_gkr_keyring_new (keyring_name);
+ g_object_set (keyring, "source", self->gsrc, NULL);
+ seahorse_context_add_source (NULL, SEAHORSE_SOURCE (keyring));
+ seahorse_context_take_object (NULL, SEAHORSE_OBJECT (keyring));
}
- if (lop->checks)
- g_hash_table_remove (lop->checks, GUINT_TO_POINTER (id));
-
- list = g_list_next (list);
}
- if (lop->checks)
- g_hash_table_foreach (lop->checks, (GHFunc)remove_key_from_context,
- SEAHORSE_SOURCE (lop->gsrc));
+ g_hash_table_foreach (checks, (GHFunc)remove_each_keyring_from_context, NULL);
+ g_hash_table_destroy (checks);
- seahorse_operation_mark_done (SEAHORSE_OPERATION (lop), FALSE, NULL);
-
-}
-
-static void
-insert_id_hashtable (SeahorseObject *object, gpointer user_data)
-{
- g_hash_table_insert ((GHashTable*)user_data,
- GUINT_TO_POINTER (seahorse_object_get_id (object)),
- GUINT_TO_POINTER (TRUE));
+ seahorse_operation_mark_done (SEAHORSE_OPERATION (self), FALSE, NULL);
}
-static SeahorseListOperation*
+static SeahorseOperation*
start_list_operation (SeahorseGkrSource *gsrc)
{
- SeahorseListOperation *lop;
- SeahorseObjectPredicate pred;
+ SeahorseListOperation *self;
g_assert (SEAHORSE_IS_GKR_SOURCE (gsrc));
- lop = g_object_new (SEAHORSE_TYPE_LIST_OPERATION, NULL);
- lop->gsrc = gsrc;
+ self = g_object_new (SEAHORSE_TYPE_LIST_OPERATION, NULL);
+ self->gsrc = g_object_ref (gsrc);
- seahorse_operation_mark_start (SEAHORSE_OPERATION (lop));
+ seahorse_operation_mark_start (SEAHORSE_OPERATION (self));
+ seahorse_operation_mark_progress (SEAHORSE_OPERATION (self), _("Listing password keyrings"), -1);
- /* When loading new keys prepare a list of current */
- lop->checks = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
- seahorse_object_predicate_clear (&pred);
- pred.source = SEAHORSE_SOURCE (gsrc);
- pred.type = SEAHORSE_TYPE_GKR_ITEM;
- seahorse_context_for_objects_full (SCTX_APP (), &pred, insert_id_hashtable, lop->checks);
-
/* Start listing of ids */
- seahorse_operation_mark_progress (SEAHORSE_OPERATION (lop), _("Listing passwords"), -1);
- g_object_ref (lop);
- lop->request = gnome_keyring_list_item_ids (gsrc->pv->keyring_name,
- (GnomeKeyringOperationGetListCallback)keyring_ids_ready,
- lop, g_object_unref);
+ g_object_ref (self);
+ self->request = gnome_keyring_list_keyring_names ((GnomeKeyringOperationGetListCallback)on_keyring_names,
+ self, g_object_unref);
- return lop;
+ return SEAHORSE_OPERATION (self);
}
static void
-seahorse_list_operation_init (SeahorseListOperation *lop)
+seahorse_list_operation_cancel (SeahorseOperation *operation)
{
- /* Everything already set to zero */
+ SeahorseListOperation *self = SEAHORSE_LIST_OPERATION (operation);
+
+ if (self->request)
+ gnome_keyring_cancel_request (self->request);
+ self->request = NULL;
+
+ if (seahorse_operation_is_running (operation))
+ seahorse_operation_mark_done (operation, TRUE, NULL);
+}
+
+static void
+seahorse_list_operation_init (SeahorseListOperation *self)
+{
+ /* Everything already set to zero */
}
static void
seahorse_list_operation_dispose (GObject *gobject)
{
- SeahorseListOperation *lop = SEAHORSE_LIST_OPERATION (gobject);
+ SeahorseListOperation *self = SEAHORSE_LIST_OPERATION (gobject);
- /* Cancel it if it's still running */
- if (seahorse_operation_is_running (SEAHORSE_OPERATION (lop)))
- seahorse_list_operation_cancel (SEAHORSE_OPERATION (lop));
- g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (lop)));
+ /* Cancel it if it's still running */
+ if (seahorse_operation_is_running (SEAHORSE_OPERATION (self)))
+ seahorse_list_operation_cancel (SEAHORSE_OPERATION (self));
+ g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (self)));
- /* The above cancel should have stopped this */
- g_assert (lop->request == NULL);
+ /* The above cancel should have stopped this */
+ g_assert (self->request == NULL);
+
+ if (self->gsrc)
+ g_object_unref (self->gsrc);
+ self->gsrc = NULL;
- G_OBJECT_CLASS (list_operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (seahorse_list_operation_parent_class)->dispose (gobject);
}
static void
seahorse_list_operation_finalize (GObject *gobject)
{
- SeahorseListOperation *lop = SEAHORSE_LIST_OPERATION (gobject);
- g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (lop)));
+ SeahorseListOperation *self = SEAHORSE_LIST_OPERATION (gobject);
+ g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (self)));
- if (lop->checks)
- g_hash_table_destroy (lop->checks);
- lop->checks = NULL;
-
- /* The above cancel should have stopped this */
- g_assert (lop->request == NULL);
+ /* The above cancel should have stopped this */
+ g_assert (self->request == NULL);
- G_OBJECT_CLASS (list_operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (seahorse_list_operation_parent_class)->finalize (gobject);
}
-static void
-seahorse_list_operation_cancel (SeahorseOperation *operation)
+static void
+seahorse_list_operation_class_init (SeahorseListOperationClass *klass)
{
- SeahorseListOperation *lop = SEAHORSE_LIST_OPERATION (operation);
-
- if (lop->request)
- gnome_keyring_cancel_request (lop->request);
- lop->request = NULL;
-
- if (seahorse_operation_is_running (operation))
- seahorse_operation_mark_done (operation, TRUE, NULL);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ SeahorseOperationClass *operation_class = SEAHORSE_OPERATION_CLASS (klass);
+
+ seahorse_list_operation_parent_class = g_type_class_peek_parent (klass);
+ gobject_class->dispose = seahorse_list_operation_dispose;
+ gobject_class->finalize = seahorse_list_operation_finalize;
+ operation_class->cancel = seahorse_list_operation_cancel;
}
/* -----------------------------------------------------------------------------
@@ -278,169 +263,59 @@
*/
static void
-seahorse_gkr_source_init (SeahorseGkrSource *gsrc)
-{
- /* init private vars */
- gsrc->pv = g_new0 (SeahorseGkrSourcePrivate, 1);
- gsrc->pv->operations = seahorse_multi_operation_new ();
-}
-
-static GObject*
-seahorse_gkr_source_constructor (GType type, guint n_props, GObjectConstructParam* props)
+seahorse_gkr_source_init (SeahorseGkrSource *self)
{
- GObject* obj = G_OBJECT_CLASS (seahorse_gkr_source_parent_class)->constructor (type, n_props, props);
- SeahorseGkrSource *self = NULL;
-
- if (obj) {
- self = SEAHORSE_GKR_SOURCE (obj);
-
- /* Add the initial keyring folder style object */
- self->pv->keyring_object = SEAHORSE_OBJECT (seahorse_gkr_keyring_new (self->pv->keyring_name));
- seahorse_context_add_object (SCTX_APP (), self->pv->keyring_object);
- }
-
- return obj;
+ self->pv = NULL;
}
static void
seahorse_gkr_source_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *pspec)
{
- SeahorseGkrSource *gsrc = SEAHORSE_GKR_SOURCE (object);
-
- switch (prop_id) {
- case PROP_KEYRING_NAME:
- g_value_set_string (value, gsrc->pv->keyring_name);
- break;
- case PROP_KEY_TYPE:
- g_value_set_uint (value, SEAHORSE_GKR);
- break;
- case PROP_FLAGS:
- g_value_set_uint (value, 0);
- break;
- case PROP_KEY_DESC:
- g_value_set_string (value, _("Password"));
- break;
- case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
- break;
- }
+ switch (prop_id) {
+ case PROP_KEY_TYPE:
+ g_value_set_uint (value, SEAHORSE_GKR);
+ break;
+ case PROP_FLAGS:
+ g_value_set_uint (value, 0);
+ break;
+ case PROP_KEY_DESC:
+ g_value_set_string (value, _("Password"));
+ break;
+ case PROP_LOCATION:
+ g_value_set_enum (value, SEAHORSE_LOCATION_LOCAL);
+ break;
+ }
}
static void
seahorse_gkr_source_set_property (GObject *object, guint prop_id, const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
- SeahorseGkrSource *gsrc = SEAHORSE_GKR_SOURCE (object);
- switch (prop_id) {
- case PROP_KEYRING_NAME:
- if (g_value_get_string (value) != gsrc->pv->keyring_name) {
- g_free (gsrc->pv->keyring_name);
- gsrc->pv->keyring_name = g_strdup (g_value_get_string (value));
- }
- break;
- };
}
static SeahorseOperation*
seahorse_gkr_source_load (SeahorseSource *src)
{
- SeahorseGkrSource *gsrc;
- SeahorseListOperation *lop;
-
- g_assert (SEAHORSE_IS_SOURCE (src));
- gsrc = SEAHORSE_GKR_SOURCE (src);
-
- lop = start_list_operation (gsrc);
- seahorse_multi_operation_take (gsrc->pv->operations, SEAHORSE_OPERATION (lop));
-
- g_object_ref (lop);
- return SEAHORSE_OPERATION (lop);
-}
-
-static SeahorseOperation*
-seahorse_gkr_source_import (SeahorseSource *sksrc, GInputStream *input)
-{
- GError *err = NULL;
-
- g_return_val_if_fail (SEAHORSE_IS_GKR_SOURCE (sksrc), NULL);
- g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
-
- /* TODO: Implement properly */
- g_set_error (&err, 0, 0, "gnome-keyring import support not implemented");
- return seahorse_operation_new_complete (err);
-}
-
-static void
-seahorse_gkr_source_dispose (GObject *gobject)
-{
- SeahorseGkrSource *gsrc;
-
- /*
- * Note that after this executes the rest of the object should
- * still work without a segfault. This basically nullifies the
- * object, but doesn't free it.
- *
- * This function should also be able to run multiple times.
- */
-
- gsrc = SEAHORSE_GKR_SOURCE (gobject);
- g_assert (gsrc->pv);
-
- /* Clear out all operations */
- if (gsrc->pv->operations) {
- if(seahorse_operation_is_running (SEAHORSE_OPERATION (gsrc->pv->operations)))
- seahorse_operation_cancel (SEAHORSE_OPERATION (gsrc->pv->operations));
- g_object_unref (gsrc->pv->operations);
- gsrc->pv->operations = NULL;
- }
-
- /* The keyring object */
- if (gsrc->pv->keyring_object)
- g_object_unref (gsrc->pv->keyring_object);
- gsrc->pv->keyring_object = NULL;
-
- G_OBJECT_CLASS (seahorse_gkr_source_parent_class)->dispose (gobject);
-}
-
-static void
-seahorse_gkr_source_finalize (GObject *gobject)
-{
- SeahorseGkrSource *gsrc;
-
- gsrc = SEAHORSE_GKR_SOURCE (gobject);
- g_assert (gsrc->pv);
-
- g_assert (gsrc->pv->operations == NULL);
-
- g_free (gsrc->pv->keyring_name);
- g_free (gsrc->pv);
-
- G_OBJECT_CLASS (seahorse_gkr_source_parent_class)->finalize (gobject);
+ SeahorseGkrSource *self = SEAHORSE_GKR_SOURCE (src);
+ return start_list_operation (self);
}
static void
seahorse_gkr_source_class_init (SeahorseGkrSourceClass *klass)
{
- GObjectClass *gobject_class;
+ GObjectClass *gobject_class;
- seahorse_gkr_source_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->constructor = seahorse_gkr_source_constructor;
- gobject_class->dispose = seahorse_gkr_source_dispose;
- gobject_class->finalize = seahorse_gkr_source_finalize;
- gobject_class->set_property = seahorse_gkr_source_set_property;
- gobject_class->get_property = seahorse_gkr_source_get_property;
+ seahorse_gkr_source_parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->set_property = seahorse_gkr_source_set_property;
+ gobject_class->get_property = seahorse_gkr_source_get_property;
- g_object_class_install_property (gobject_class, PROP_KEYRING_NAME,
- g_param_spec_string ("keyring-name", "Keyring Name", "GNOME Keyring name",
- NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (gobject_class, PROP_FLAGS,
- g_param_spec_uint ("flags", "Flags", "Object Source flags.",
- 0, G_MAXUINT, 0, G_PARAM_READABLE));
+ g_object_class_install_property (gobject_class, PROP_FLAGS,
+ g_param_spec_uint ("flags", "Flags", "Object Source flags.",
+ 0, G_MAXUINT, 0, G_PARAM_READABLE));
g_object_class_override_property (gobject_class, PROP_KEY_TYPE, "key-type");
g_object_class_override_property (gobject_class, PROP_KEY_DESC, "key-desc");
@@ -453,7 +328,6 @@
seahorse_source_iface (SeahorseSourceIface *iface)
{
iface->load = seahorse_gkr_source_load;
- iface->import = seahorse_gkr_source_import;
}
/* --------------------------------------------------------------------------
@@ -461,13 +335,7 @@
*/
SeahorseGkrSource*
-seahorse_gkr_source_new (const gchar *keyring_name)
+seahorse_gkr_source_new (void)
{
- return g_object_new (SEAHORSE_TYPE_GKR_SOURCE, "keyring-name", keyring_name, NULL);
+ return g_object_new (SEAHORSE_TYPE_GKR_SOURCE, NULL);
}
-
-const gchar*
-seahorse_gkr_source_get_keyring_name (SeahorseGkrSource *gsrc)
-{
- return gsrc->pv->keyring_name;
-}
Modified: trunk/gkr/seahorse-gkr-source.h
==============================================================================
--- trunk/gkr/seahorse-gkr-source.h (original)
+++ trunk/gkr/seahorse-gkr-source.h Sun Dec 14 23:27:12 2008
@@ -59,8 +59,6 @@
GType seahorse_gkr_source_get_type (void);
-SeahorseGkrSource* seahorse_gkr_source_new (const gchar *keyring_name);
-
-const gchar* seahorse_gkr_source_get_keyring_name (SeahorseGkrSource *gsrc);
+SeahorseGkrSource* seahorse_gkr_source_new (void);
#endif /* __SEAHORSE_GKR_SOURCE_H__ */
Modified: trunk/libseahorse/seahorse-context.c
==============================================================================
--- trunk/libseahorse/seahorse-context.c (original)
+++ trunk/libseahorse/seahorse-context.c Sun Dec 14 23:27:12 2008
@@ -51,6 +51,7 @@
ADDED,
REMOVED,
CHANGED,
+ REFRESHING,
LAST_SIGNAL
};
@@ -75,6 +76,7 @@
GHashTable *objects_by_source; /* See explanation above */
GHashTable *objects_by_type; /* See explanation above */
guint notify_id; /* Notify for GConf watch */
+ SeahorseMultiOperation *refresh_ops; /* Operations for refreshes going on */
SeahorseServiceDiscovery *discovery; /* Adds sources from DNS-SD */
};
@@ -105,6 +107,9 @@
signals[CHANGED] = g_signal_new ("changed", SEAHORSE_TYPE_CONTEXT,
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, changed),
NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_OBJECT);
+ signals[REFRESHING] = g_signal_new ("refreshing", SEAHORSE_TYPE_CONTEXT,
+ G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseContextClass, refreshing),
+ NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, SEAHORSE_TYPE_OPERATION);
}
/* init context, private vars, set prefs, connect signals */
@@ -126,7 +131,6 @@
/* The context is explicitly destroyed */
g_object_ref (sctx);
-
}
static void
@@ -172,6 +176,10 @@
g_slist_free (sctx->pv->sources);
sctx->pv->sources = NULL;
+ if (sctx->pv->refresh_ops)
+ g_object_unref (sctx->pv->refresh_ops);
+ sctx->pv->refresh_ops = NULL;
+
G_OBJECT_CLASS (seahorse_context_parent_class)->dispose (gobject);
}
@@ -191,6 +199,7 @@
g_assert (sctx->pv->sources == NULL);
g_assert (sctx->pv->auto_sources == NULL);
g_assert (sctx->pv->discovery == NULL);
+ g_assert (sctx->pv->refresh_ops == NULL);
g_free (sctx->pv);
G_OBJECT_CLASS (seahorse_context_parent_class)->finalize (gobject);
@@ -254,33 +263,49 @@
app_context = NULL;
}
+static gboolean
+take_source (SeahorseContext *sctx, SeahorseSource *sksrc)
+{
+ SeahorseOperation *operation;
+
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), FALSE);
+ if (!g_slist_find (sctx->pv->sources, sksrc)) {
+ sctx->pv->sources = g_slist_append (sctx->pv->sources, sksrc);
+ if (sctx->pv->refresh_ops) {
+ operation = seahorse_source_load (sksrc);
+ g_return_val_if_fail (operation, TRUE);
+ seahorse_multi_operation_take (sctx->pv->refresh_ops, operation);
+ g_signal_emit (sctx, signals[REFRESHING], 0, sctx->pv->refresh_ops);
+ }
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void
seahorse_context_take_source (SeahorseContext *sctx, SeahorseSource *sksrc)
{
- g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
+ g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
- if (!sctx)
- sctx = seahorse_context_for_app ();
- g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+ if (!sctx)
+ sctx = seahorse_context_for_app ();
+ g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- if (!g_slist_find (sctx->pv->sources, sksrc))
- sctx->pv->sources = g_slist_append (sctx->pv->sources, sksrc);
+ take_source (sctx, sksrc);
}
void
seahorse_context_add_source (SeahorseContext *sctx, SeahorseSource *sksrc)
{
- g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
-
- if (!sctx)
- sctx = seahorse_context_for_app ();
- g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
-
- if (g_slist_find (sctx->pv->sources, sksrc))
- return;
+ g_return_if_fail (SEAHORSE_IS_SOURCE (sksrc));
- sctx->pv->sources = g_slist_append (sctx->pv->sources, sksrc);
- g_object_ref (sksrc);
+ if (!sctx)
+ sctx = seahorse_context_for_app ();
+ g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
+ if (take_source (sctx, sksrc))
+ g_object_ref (sksrc);
}
void
@@ -767,53 +792,35 @@
return sctx->pv->discovery;
}
-SeahorseOperation*
-seahorse_context_refresh_local (SeahorseContext *sctx)
+void
+seahorse_context_refresh_auto (SeahorseContext *sctx)
{
- SeahorseSource *ks;
- SeahorseMultiOperation *mop = NULL;
- SeahorseOperation *op = NULL;
- GSList *l;
-
- if (!sctx)
- sctx = seahorse_context_for_app ();
- g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
+ SeahorseSource *ks;
+ SeahorseOperation *op = NULL;
+ GSList *l;
+
+ if (!sctx)
+ sctx = seahorse_context_for_app ();
+ g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
+
+ if (!sctx->pv->refresh_ops)
+ sctx->pv->refresh_ops = seahorse_multi_operation_new ();
- for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
- ks = SEAHORSE_SOURCE (l->data);
+ for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
+ ks = SEAHORSE_SOURCE (l->data);
- 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_source_load (ks);
-
- if (mop != NULL)
- seahorse_multi_operation_take (mop, op);
- }
- }
+ if (seahorse_source_get_location (ks) == SEAHORSE_LOCATION_LOCAL) {
- return mop ? SEAHORSE_OPERATION (mop) : op;
-}
-
-static gboolean
-refresh_local (SeahorseContext *sctx)
-{
- SeahorseOperation *op = seahorse_context_refresh_local (sctx);
- g_return_val_if_fail (op != NULL, FALSE);
- g_object_unref (op);
- return FALSE;
-}
-
-void
-seahorse_context_refresh_local_async (SeahorseContext *sctx)
-{
- g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)refresh_local, sctx, NULL);
+ op = seahorse_source_load (ks);
+ g_return_if_fail (op);
+ seahorse_multi_operation_take (sctx->pv->refresh_ops, op);
+ }
+
+ }
+
+ g_signal_emit (sctx, signals[REFRESHING], 0, sctx->pv->refresh_ops);
}
-
SeahorseOperation*
seahorse_context_search_remote (SeahorseContext *sctx, const gchar *search)
{
Modified: trunk/libseahorse/seahorse-context.h
==============================================================================
--- trunk/libseahorse/seahorse-context.h (original)
+++ trunk/libseahorse/seahorse-context.h Sun Dec 14 23:27:12 2008
@@ -84,6 +84,9 @@
/* This object has changed */
void (*changed) (SeahorseContext *sctx, struct _SeahorseObject *sobj);
+
+ /* The source is being refreshed */
+ void (*refreshing) (SeahorseContext *sctx, SeahorseOperation *op);
};
enum SeahorseContextType {
@@ -167,12 +170,10 @@
struct _SeahorseObject*
seahorse_context_get_default_key (SeahorseContext *sctx);
-SeahorseOperation* seahorse_context_refresh_local (SeahorseContext *sctx);
-
-void seahorse_context_refresh_local_async (SeahorseContext *sctx);
+void seahorse_context_refresh_auto (SeahorseContext *sctx);
-SeahorseOperation* seahorse_context_search_remote (SeahorseContext *sctx,
- const gchar *search);
+SeahorseOperation* seahorse_context_search_remote (SeahorseContext *sctx,
+ const gchar *search);
SeahorseOperation* seahorse_context_transfer_objects (SeahorseContext *sctx,
GList *objs,
Modified: trunk/libseahorse/seahorse-marshal.list
==============================================================================
--- trunk/libseahorse/seahorse-marshal.list (original)
+++ trunk/libseahorse/seahorse-marshal.list Sun Dec 14 23:27:12 2008
@@ -2,3 +2,4 @@
VOID:OBJECT,UINT
VOID:OBJECT,POINTER
VOID:OBJECT,UINT,POINTER
+VOID:OBJECT,OBJECT
Modified: trunk/libseahorse/seahorse-source.c
==============================================================================
--- trunk/libseahorse/seahorse-source.c (original)
+++ trunk/libseahorse/seahorse-source.c Sun Dec 14 23:27:12 2008
@@ -42,15 +42,15 @@
/* Add properties and signals to the interface */
g_object_interface_install_property (gobject_class,
g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.",
- 0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ 0, G_MAXUINT, SEAHORSE_TAG_INVALID, G_PARAM_READABLE));
g_object_interface_install_property (gobject_class,
g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
NULL, G_PARAM_READABLE));
g_object_interface_install_property (gobject_class,
- g_param_spec_uint ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
- 0, G_MAXUINT, SEAHORSE_LOCATION_MISSING, G_PARAM_READABLE));
+ g_param_spec_enum ("location", "Key Location", "Where the key is stored. See SeahorseLocation",
+ SEAHORSE_TYPE_LOCATION, SEAHORSE_LOCATION_LOCAL, G_PARAM_READABLE));
initialized = TRUE;
}
Modified: trunk/libseahorse/seahorse-unknown-source.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.c (original)
+++ trunk/libseahorse/seahorse-unknown-source.c Sun Dec 14 23:27:12 2008
@@ -89,7 +89,7 @@
g_value_set_string (value, _("Unavailable Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_MISSING);
+ g_value_set_enum (value, SEAHORSE_LOCATION_MISSING);
break;
}
}
Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c (original)
+++ trunk/pgp/seahorse-hkp-source.c Sun Dec 14 23:27:12 2008
@@ -737,7 +737,7 @@
g_value_set_string (value, _("PGP Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_REMOTE);
+ g_value_set_enum (value, SEAHORSE_LOCATION_REMOTE);
break;
};
}
Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c (original)
+++ trunk/pgp/seahorse-ldap-source.c Sun Dec 14 23:27:12 2008
@@ -1280,7 +1280,7 @@
g_value_set_string (value, _("PGP Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_REMOTE);
+ g_value_set_enum (value, SEAHORSE_LOCATION_REMOTE);
break;
};
}
Modified: trunk/pgp/seahorse-pgp-source.c
==============================================================================
--- trunk/pgp/seahorse-pgp-source.c (original)
+++ trunk/pgp/seahorse-pgp-source.c Sun Dec 14 23:27:12 2008
@@ -438,7 +438,7 @@
g_value_set_string (value, _("PGP Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
+ g_value_set_enum (value, SEAHORSE_LOCATION_LOCAL);
break;
}
}
Modified: trunk/pgp/seahorse-server-source.c
==============================================================================
--- trunk/pgp/seahorse-server-source.c (original)
+++ trunk/pgp/seahorse-server-source.c Sun Dec 14 23:27:12 2008
@@ -206,7 +206,7 @@
g_value_set_string (value, _("PGP Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_REMOTE);
+ g_value_set_enum (value, SEAHORSE_LOCATION_REMOTE);
break;
}
}
Modified: trunk/pkcs11/seahorse-pkcs11-source.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.c (original)
+++ trunk/pkcs11/seahorse-pkcs11-source.c Sun Dec 14 23:27:12 2008
@@ -102,7 +102,7 @@
g_value_set_string (value, _("X509 Certificates"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
+ g_value_set_enum (value, SEAHORSE_LOCATION_LOCAL);
break;
}
}
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Sun Dec 14 23:27:12 2008
@@ -56,7 +56,6 @@
int
main (int argc, char **argv)
{
- SeahorseOperation *op = NULL;
GError *error = NULL;
int ret = 0;
@@ -94,9 +93,11 @@
#endif
seahorse_gkr_module_init ();
- op = seahorse_context_refresh_local (SCTX_APP ());
+ seahorse_key_manager_show ();
+
+ /* Start the refreshing of the keys */
+ seahorse_context_refresh_auto (NULL);
- seahorse_key_manager_show (op);
g_signal_connect_after (SCTX_APP (), "destroy", gtk_main_quit, NULL);
gtk_main ();
Modified: trunk/src/seahorse-key-manager.c
==============================================================================
--- trunk/src/seahorse-key-manager.c (original)
+++ trunk/src/seahorse-key-manager.c Sun Dec 14 23:27:12 2008
@@ -725,6 +725,11 @@
gtk_toggle_action_set_active (action, gconf_value_get_bool (entry->value));
}
+static void
+on_refreshing (SeahorseContext *sctx, SeahorseOperation *operation, SeahorseWidget *swidget)
+{
+ seahorse_progress_status_set_operation (swidget, operation);
+}
static const GtkActionEntry GENERAL_ENTRIES[] = {
@@ -976,6 +981,7 @@
g_timeout_add_seconds (1, (GSourceFunc)on_first_timer, self);
g_signal_emit_by_name (self, "selection-changed");
+ g_signal_connect (seahorse_context_for_app (), "refreshing", G_CALLBACK (on_refreshing), self);
return G_OBJECT (self);
}
@@ -1076,9 +1082,8 @@
GtkWindow*
-seahorse_key_manager_show (SeahorseOperation* op)
+seahorse_key_manager_show (void)
{
SeahorseKeyManager *man = g_object_new (SEAHORSE_TYPE_KEY_MANAGER, "name", "key-manager", NULL);
- seahorse_progress_status_set_operation (SEAHORSE_WIDGET (man), op);
return GTK_WINDOW (seahorse_widget_get_toplevel (SEAHORSE_WIDGET (man)));
}
Modified: trunk/src/seahorse-key-manager.h
==============================================================================
--- trunk/src/seahorse-key-manager.h (original)
+++ trunk/src/seahorse-key-manager.h Sun Dec 14 23:27:12 2008
@@ -56,7 +56,7 @@
* logic throughout this file.
*/
-GtkWindow* seahorse_key_manager_show (SeahorseOperation *op);
+GtkWindow* seahorse_key_manager_show (void);
GType seahorse_key_manager_get_type (void);
Modified: trunk/ssh/seahorse-ssh-source.c
==============================================================================
--- trunk/ssh/seahorse-ssh-source.c (original)
+++ trunk/ssh/seahorse-ssh-source.c Sun Dec 14 23:27:12 2008
@@ -616,7 +616,7 @@
g_value_set_string (value, _("Secure Shell Key"));
break;
case PROP_LOCATION:
- g_value_set_uint (value, SEAHORSE_LOCATION_LOCAL);
+ g_value_set_enum (value, SEAHORSE_LOCATION_LOCAL);
break;
case PROP_BASE_DIRECTORY:
g_value_set_string (value, ssrc->priv->ssh_homedir);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]