seahorse r2479 - in trunk: . gkr libcryptui libseahorse pgp pkcs11 src ssh
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2479 - in trunk: . gkr libcryptui libseahorse pgp pkcs11 src ssh
- Date: Thu, 11 Sep 2008 02:20:27 +0000 (UTC)
Author: nnielsen
Date: Thu Sep 11 02:20:26 2008
New Revision: 2479
URL: http://svn.gnome.org/viewvc/seahorse?rev=2479&view=rev
Log:
* gkr/seahorse-gkeyring-source.c:
* libcryptui/cryptui.h:
* libseahorse/libseahorse-c.vapi:
* libseahorse/seahorse-key.h:
* pgp/seahorse-pgp-key.c:
* pkcs11/p11.vapi:
* pkcs11/seahorse-pkcs11-certificate.vala:
* pkcs11/seahorse-pkcs11-source.vala:
* src/seahorse-viewer.c:
* ssh/seahorse-ssh-key.c: Add 'exportable' flag to objects/keys
and don't enable export UI if selected objects are not exportable.
Fixes bug #551477
Modified:
trunk/ChangeLog
trunk/gkr/seahorse-gkeyring-source.c
trunk/gkr/vala-build.stamp
trunk/libcryptui/cryptui.h
trunk/libseahorse/libseahorse-c.vapi
trunk/libseahorse/seahorse-key.h
trunk/pgp/seahorse-pgp-key.c
trunk/pgp/vala-build.stamp
trunk/pkcs11/p11.vapi
trunk/pkcs11/seahorse-pkcs11-certificate.c
trunk/pkcs11/seahorse-pkcs11-certificate.vala
trunk/pkcs11/seahorse-pkcs11-source.c
trunk/pkcs11/seahorse-pkcs11-source.vala
trunk/pkcs11/vala-build.stamp
trunk/src/seahorse-viewer.c
trunk/src/vala-build.stamp
trunk/ssh/seahorse-ssh-key.c
trunk/ssh/vala-build.stamp
Modified: trunk/gkr/seahorse-gkeyring-source.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-source.c (original)
+++ trunk/gkr/seahorse-gkeyring-source.c Thu Sep 11 02:20:26 2008
@@ -60,6 +60,7 @@
PROP_0,
PROP_KEYRING_NAME,
PROP_KEY_TYPE,
+ PROP_FLAGS,
PROP_KEY_DESC,
PROP_LOCATION
};
@@ -672,6 +673,9 @@
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;
@@ -825,6 +829,10 @@
g_object_class_install_property (gobject_class, PROP_KEY_TYPE,
g_param_spec_uint ("key-type", "Key Type", "Key type that originates from this key source.",
0, G_MAXUINT, SKEY_UNKNOWN, 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_install_property (gobject_class, PROP_KEY_DESC,
g_param_spec_string ("key-desc", "Key Desc", "Description for keys that originate here.",
Modified: trunk/gkr/vala-build.stamp
==============================================================================
--- trunk/gkr/vala-build.stamp (original)
+++ trunk/gkr/vala-build.stamp Thu Sep 11 02:20:26 2008
@@ -1 +1 @@
-1220798429
+1221098971
Modified: trunk/libcryptui/cryptui.h
==============================================================================
--- trunk/libcryptui/cryptui.h (original)
+++ trunk/libcryptui/cryptui.h Thu Sep 11 02:20:26 2008
@@ -51,13 +51,14 @@
* across applications, DBus etc...
*/
typedef enum {
- CRYPTUI_FLAG_IS_VALID = 0x0001,
- CRYPTUI_FLAG_CAN_ENCRYPT = 0x0002,
- CRYPTUI_FLAG_CAN_SIGN = 0x0004,
- CRYPTUI_FLAG_EXPIRED = 0x0100,
- CRYPTUI_FLAG_REVOKED = 0x0200,
- CRYPTUI_FLAG_DISABLED = 0x0400,
- CRYPTUI_FLAG_TRUSTED = 0x1000
+ CRYPTUI_FLAG_IS_VALID = 0x00000001,
+ CRYPTUI_FLAG_CAN_ENCRYPT = 0x00000002,
+ CRYPTUI_FLAG_CAN_SIGN = 0x00000004,
+ CRYPTUI_FLAG_EXPIRED = 0x00000100,
+ CRYPTUI_FLAG_REVOKED = 0x00000200,
+ CRYPTUI_FLAG_DISABLED = 0x00000400,
+ CRYPTUI_FLAG_TRUSTED = 0x00001000,
+ CRYPTUI_FLAG_EXPORTABLE = 0x00100000
} CryptUIKeyFlags;
/*
Modified: trunk/libseahorse/libseahorse-c.vapi
==============================================================================
--- trunk/libseahorse/libseahorse-c.vapi (original)
+++ trunk/libseahorse/libseahorse-c.vapi Thu Sep 11 02:20:26 2008
@@ -50,7 +50,8 @@
EXPIRED = 0x0100,
REVOKED = 0x0200,
DISABLED = 0x0400,
- TRUSTED = 0x1000
+ TRUSTED = 0x1000,
+ EXPORTABLE = 0x00100000
}
public GLib.Quark ktype { get; }
Modified: trunk/libseahorse/seahorse-key.h
==============================================================================
--- trunk/libseahorse/seahorse-key.h (original)
+++ trunk/libseahorse/seahorse-key.h Thu Sep 11 02:20:26 2008
@@ -89,7 +89,8 @@
SKEY_FLAG_EXPIRED = CRYPTUI_FLAG_EXPIRED,
SKEY_FLAG_REVOKED = CRYPTUI_FLAG_REVOKED,
SKEY_FLAG_DISABLED = CRYPTUI_FLAG_DISABLED,
- SKEY_FLAG_TRUSTED = CRYPTUI_FLAG_TRUSTED
+ SKEY_FLAG_TRUSTED = CRYPTUI_FLAG_TRUSTED,
+ SKEY_FLAG_EXPORTABLE = CRYPTUI_FLAG_EXPORTABLE
} SeahorseKeyFlags;
/* Possible key changes */
Modified: trunk/pgp/seahorse-pgp-key.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key.c (original)
+++ trunk/pgp/seahorse-pgp-key.c Thu Sep 11 02:20:26 2008
@@ -245,7 +245,7 @@
skey->loaded = SKEY_INFO_BASIC;
/* The flags */
- obj->_flags = 0;
+ obj->_flags = SKEY_FLAG_EXPORTABLE;
if (!pkey->pubkey->disabled && !pkey->pubkey->expired &&
!pkey->pubkey->revoked && !pkey->pubkey->invalid)
Modified: trunk/pgp/vala-build.stamp
==============================================================================
--- trunk/pgp/vala-build.stamp (original)
+++ trunk/pgp/vala-build.stamp Thu Sep 11 02:20:26 2008
@@ -1 +1 @@
-1220798439
+1221099102
Modified: trunk/pkcs11/p11.vapi
==============================================================================
--- trunk/pkcs11/p11.vapi (original)
+++ trunk/pkcs11/p11.vapi Thu Sep 11 02:20:26 2008
@@ -3,6 +3,7 @@
namespace P11 {
const uint CKA_CLASS;
const uint CKA_END_DATE;
+ const uint CKA_EXTRACTABLE;
const uint CKA_GNOME_IMPORT_OBJECTS;
const uint CKA_GNOME_IMPORT_TOKEN;
const uint CKA_GNOME_USER_TRUST;
Modified: trunk/pkcs11/seahorse-pkcs11-certificate.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-certificate.c (original)
+++ trunk/pkcs11/seahorse-pkcs11-certificate.c Thu Sep 11 02:20:26 2008
@@ -62,10 +62,18 @@
SEAHORSE_OBJECT (self)->_usage = SEAHORSE_USAGE_NONE;
SEAHORSE_OBJECT (self)->_flags = ((guint) (SKEY_FLAG_DISABLED));
} else {
+ gboolean exportable;
SEAHORSE_OBJECT (self)->_id = seahorse_pkcs11_id_from_attributes (self->priv->_pkcs11_attributes);
SEAHORSE_OBJECT (self)->_location = SEAHORSE_LOCATION_LOCAL;
SEAHORSE_OBJECT (self)->_usage = SEAHORSE_USAGE_PUBLIC_KEY;
+ exportable = FALSE;
+ if (!gp11_attributes_find_boolean (self->priv->_pkcs11_attributes, CKA_EXTRACTABLE, &exportable)) {
+ exportable = FALSE;
+ }
SEAHORSE_OBJECT (self)->_flags = ((guint) (0));
+ if (exportable) {
+ SEAHORSE_OBJECT (self)->_flags = ((guint) (SKEY_FLAG_EXPORTABLE));
+ }
/* TODO: Expiry, revoked, disabled etc... */
if (seahorse_pkcs11_certificate_get_trust (self) >= ((gint) (SEAHORSE_VALIDITY_MARGINAL))) {
SEAHORSE_OBJECT (self)->_flags = SEAHORSE_OBJECT (self)->_flags | (SKEY_FLAG_TRUSTED);
Modified: trunk/pkcs11/seahorse-pkcs11-certificate.vala
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-certificate.vala (original)
+++ trunk/pkcs11/seahorse-pkcs11-certificate.vala Thu Sep 11 02:20:26 2008
@@ -133,7 +133,14 @@
_id = id_from_attributes(_pkcs11_attributes);
_location = Location.LOCAL;
_usage = Usage.PUBLIC_KEY;
+
+ bool exportable;
+ if(!_pkcs11_attributes.find_boolean(P11.CKA_EXTRACTABLE, out exportable))
+ exportable = false;
+
_flags = 0;
+ if(exportable)
+ _flags = Key.Flag.EXPORTABLE;
/* TODO: Expiry, revoked, disabled etc... */
Modified: trunk/pkcs11/seahorse-pkcs11-source.c
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.c (original)
+++ trunk/pkcs11/seahorse-pkcs11-source.c Thu Sep 11 02:20:26 2008
@@ -261,7 +261,7 @@
static gpointer seahorse_pkcs11_source_parent_class = NULL;
static void seahorse_pkcs11_source_finalize (GObject * obj);
-static const guint SEAHORSE_PKCS11_ATTRIBUTE_TYPES[] = {CKA_LABEL, CKA_ID, CKA_CLASS, CKA_TOKEN, CKA_GNOME_USER_TRUST, CKA_START_DATE, CKA_END_DATE};
+static const guint SEAHORSE_PKCS11_ATTRIBUTE_TYPES[] = {CKA_LABEL, CKA_ID, CKA_CLASS, CKA_TOKEN, CKA_GNOME_USER_TRUST, CKA_START_DATE, CKA_END_DATE, CKA_EXTRACTABLE};
/* ---------------------------------------------------------------------------------
Modified: trunk/pkcs11/seahorse-pkcs11-source.vala
==============================================================================
--- trunk/pkcs11/seahorse-pkcs11-source.vala (original)
+++ trunk/pkcs11/seahorse-pkcs11-source.vala Thu Sep 11 02:20:26 2008
@@ -10,7 +10,8 @@
P11.CKA_TOKEN,
P11.CKA_GNOME_USER_TRUST,
P11.CKA_START_DATE,
- P11.CKA_END_DATE
+ P11.CKA_END_DATE,
+ P11.CKA_EXTRACTABLE
};
public class Source : Seahorse.Source {
Modified: trunk/pkcs11/vala-build.stamp
==============================================================================
--- trunk/pkcs11/vala-build.stamp (original)
+++ trunk/pkcs11/vala-build.stamp Thu Sep 11 02:20:26 2008
@@ -1 +1 @@
-1220798433
+1221099095
Modified: trunk/src/seahorse-viewer.c
==============================================================================
--- trunk/src/seahorse-viewer.c (original)
+++ trunk/src/seahorse-viewer.c Thu Sep 11 02:20:26 2008
@@ -22,6 +22,7 @@
#include "config.h"
#include "seahorse-commands.h"
+#include "seahorse-key.h"
#include "seahorse-preferences.h"
#include "seahorse-progress.h"
#include "seahorse-util.h"
@@ -43,6 +44,7 @@
struct _SeahorseViewerPrivate {
GtkUIManager *ui_manager;
GtkActionGroup *object_actions;
+ GtkActionGroup *export_actions;
GHashTable *commands;
};
@@ -175,6 +177,21 @@
seahorse_viewer_show_properties (self, seahorse_viewer_get_selected (self));
}
+static GList*
+objects_prune_non_exportable (GList *objects)
+{
+ GList *exportable = NULL;
+ GList *l;
+
+ for (l = objects; l; l = g_list_next (l)) {
+ if (seahorse_object_get_flags (l->data) & SKEY_FLAG_EXPORTABLE)
+ exportable = g_list_append (exportable, l->data);
+ }
+
+ g_list_free (objects);
+ return exportable;
+}
+
static void
on_export_done (SeahorseOperation* op, SeahorseViewer* self)
{
@@ -198,7 +215,8 @@
g_return_if_fail (GTK_IS_ACTION (action));
objects = seahorse_viewer_get_selected_objects (self);
- if (objects == NULL)
+ objects = objects_prune_non_exportable (objects);
+ if (objects == NULL)
return;
dialog = seahorse_util_chooser_save_new (_("Export public key"),
@@ -276,6 +294,7 @@
g_return_if_fail (GTK_IS_ACTION (action));
objects = seahorse_viewer_get_selected_objects (self);
+ objects = objects_prune_non_exportable (objects);
if (objects == NULL)
return;
@@ -409,12 +428,15 @@
static const GtkActionEntry KEY_ENTRIES[] = {
{ "key-properties", GTK_STOCK_PROPERTIES, N_("P_roperties"), NULL,
N_("Show key properties"), G_CALLBACK (on_key_properties) },
+ { "key-delete", GTK_STOCK_DELETE, N_("_Delete Key"), NULL,
+ N_("Delete selected keys"), G_CALLBACK (on_key_delete) }
+};
+
+static const GtkActionEntry EXPORT_ENTRIES[] = {
{ "key-export-file", GTK_STOCK_SAVE_AS, N_("E_xport Public Key..."), NULL,
N_("Export public part of key to a file"), G_CALLBACK (on_key_export_file) },
{ "key-export-clipboard", GTK_STOCK_COPY, N_("_Copy Public Key"), "<control>C",
- N_("Copy public part of selected keys to the clipboard"), G_CALLBACK (on_key_export_clipboard) },
- { "key-delete", GTK_STOCK_DELETE, N_("_Delete Key"), NULL,
- N_("Delete selected keys"), G_CALLBACK (on_key_delete) }
+ N_("Copy public part of selected keys to the clipboard"), G_CALLBACK (on_key_export_clipboard) }
};
static void
@@ -437,17 +459,33 @@
/* Mark the properties toolbar button as important */
g_object_set (gtk_action_group_get_action (pv->object_actions, "key-properties"), "is-important", TRUE, NULL);
seahorse_viewer_include_actions (self, pv->object_actions);
+
+ pv->export_actions = gtk_action_group_new ("export");
+ gtk_action_group_set_translation_domain (pv->export_actions, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (pv->export_actions, EXPORT_ENTRIES, G_N_ELEMENTS (EXPORT_ENTRIES), self);
+ seahorse_viewer_include_actions (self, pv->export_actions);
}
static void
on_selection_changed (SeahorseView* view, SeahorseViewer* self)
{
SeahorseViewerPrivate *pv = SEAHORSE_VIEWER_GET_PRIVATE (self);
-
+ gboolean exportable = FALSE;
+ GList *objects;
+
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (SEAHORSE_IS_VIEW (view));
+ /* Enable if anything is selected */
gtk_action_group_set_sensitive (pv->object_actions, seahorse_view_get_selected (view) != NULL);
+
+ objects = seahorse_viewer_get_selected_objects (self);
+ objects = objects_prune_non_exportable (objects);
+ exportable = (objects != NULL);
+ g_list_free (objects);
+
+ /* Enable if any exportable objects are selected */
+ gtk_action_group_set_sensitive (pv->export_actions, exportable);
}
static void
@@ -574,6 +612,10 @@
g_object_unref (pv->object_actions);
pv->object_actions = NULL;
+ if (pv->export_actions)
+ g_object_unref (pv->export_actions);
+ pv->export_actions = NULL;
+
if (pv->commands)
g_hash_table_unref (pv->commands);
pv->commands = NULL;
@@ -587,6 +629,7 @@
SeahorseViewerPrivate *pv = SEAHORSE_VIEWER_GET_PRIVATE(obj);
g_assert (pv->object_actions == NULL);
+ g_assert (pv->export_actions == NULL);
g_assert (pv->commands == NULL);
g_assert (pv->ui_manager == NULL);
Modified: trunk/src/vala-build.stamp
==============================================================================
--- trunk/src/vala-build.stamp (original)
+++ trunk/src/vala-build.stamp Thu Sep 11 02:20:26 2008
@@ -1 +1 @@
-1220798615
+1221099170
Modified: trunk/ssh/seahorse-ssh-key.c
==============================================================================
--- trunk/ssh/seahorse-ssh-key.c (original)
+++ trunk/ssh/seahorse-ssh-key.c Thu Sep 11 02:20:26 2008
@@ -123,6 +123,7 @@
obj->_location = SEAHORSE_LOCATION_LOCAL;
key->loaded = SKEY_INFO_COMPLETE;
obj->_flags = skey->keydata->authorized ? SKEY_FLAG_TRUSTED : 0;
+ obj->_flags |= SKEY_FLAG_EXPORTABLE;
if (skey->keydata->privfile) {
obj->_usage = SEAHORSE_USAGE_PRIVATE_KEY;
Modified: trunk/ssh/vala-build.stamp
==============================================================================
--- trunk/ssh/vala-build.stamp (original)
+++ trunk/ssh/vala-build.stamp Thu Sep 11 02:20:26 2008
@@ -1 +1 @@
-1220798446
+1221099147
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]