4
* Copyright (C) 2008 Stefan Walter
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as
8
* published by the Free Software Foundation; either version 2.1 of
9
* the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24
#include "seahorse-gconf.h"
25
#include "seahorse-key.h"
27
#include "seahorse-pgp-module.h"
28
#include "seahorse-pgp-keysets.h"
30
/* -----------------------------------------------------------------------------
35
pgp_signers_gconf_notify (GConfClient *client, guint id, GConfEntry *entry,
38
/* Default key changed, refresh */
39
seahorse_set_refresh (skset);
43
pgp_signers_match (SeahorseObject *obj, gpointer data)
45
SeahorseKey *key, *defkey;
47
if (!SEAHORSE_IS_KEY (obj))
50
key = SEAHORSE_KEY (obj);
51
defkey = seahorse_context_get_default_key (SCTX_APP ());
53
/* Default key overrides all, and becomes the only signer available*/
54
if (defkey && seahorse_key_get_keyid (key) != seahorse_key_get_keyid (defkey))
61
seahorse_keyset_pgp_signers_new ()
63
SeahorseObjectPredicate *pred = g_new0(SeahorseObjectPredicate, 1);
66
pred->location = SEAHORSE_LOCATION_LOCAL;
67
pred->id = SEAHORSE_PGP;
68
pred->usage = SEAHORSE_USAGE_PRIVATE_KEY;
69
pred->flags = SKEY_FLAG_CAN_SIGN;
70
pred->nflags = SKEY_FLAG_EXPIRED | SKEY_FLAG_REVOKED | SKEY_FLAG_DISABLED;
71
pred->custom = pgp_signers_match;
73
skset = seahorse_set_new_full (pred);
74
g_object_set_data_full (G_OBJECT (skset), "pgp-signers-predicate", pred, g_free);
76
seahorse_gconf_notify_lazy (SEAHORSE_DEFAULT_KEY,
77
(GConfClientNotifyFunc)pgp_signers_gconf_notify,