[almanah] Improve key selection
- From: Philip Withnall <pwithnall src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [almanah] Improve key selection
- Date: Sun, 31 Jan 2010 14:38:13 +0000 (UTC)
commit 8095fd51aa194242b3efc3b00ff0e786d272afab
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Jan 31 14:36:11 2010 +0000
Improve key selection
Improve key selection in the preferences dialogue by filtering irrelevant
keys (ones for which we don't have the private key) and allowing the dialogue
to be resized so that long key names can be seen. See: bgo#607964
data/almanah.ui | 4 ++++
src/preferences-dialog.c | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/data/almanah.ui b/data/almanah.ui
index 3f04b6c..9680e03 100644
--- a/data/almanah.ui
+++ b/data/almanah.ui
@@ -104,6 +104,7 @@
<child>
<object class="GtkAction" id="almanah_ui_preferences">
<property name="stock-id">gtk-preferences</property>
+ <property name="label" translatable="yes">Pr_eferences</property>
<property name="name">edit-preferences</property>
<signal name="activate" handler="mw_preferences_activate_cb"/>
</object>
@@ -709,6 +710,9 @@
<property name="border-width">5</property>
<!-- Encryption key chooser and label go here, programmatically -->
</object>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="hbuttonbox2">
diff --git a/src/preferences-dialog.c b/src/preferences-dialog.c
index c495941..5884a82 100644
--- a/src/preferences-dialog.c
+++ b/src/preferences-dialog.c
@@ -78,7 +78,7 @@ almanah_preferences_dialog_init (AlmanahPreferencesDialog *self)
gtk_window_set_modal (GTK_WINDOW (self), FALSE);
gtk_window_set_title (GTK_WINDOW (self), _("Almanah Preferences"));
gtk_widget_set_size_request (GTK_WIDGET (self), 400, -1);
- gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
+ gtk_window_set_resizable (GTK_WINDOW (self), TRUE); /* needs to be resizeable so long keys can be made visible in the list */
}
static void
@@ -105,6 +105,14 @@ almanah_preferences_dialog_dispose (GObject *object)
G_OBJECT_CLASS (almanah_preferences_dialog_parent_class)->dispose (object);
}
+/* Filter the key list so it's not pages and pages long */
+static gboolean
+key_store_filter_cb (CryptUIKeyset *keyset, const gchar *key, gpointer user_data)
+{
+ guint flags = cryptui_keyset_key_flags (keyset, key);
+ return flags & CRYPTUI_FLAG_CAN_SIGN; /* if the key can sign, we have the private key part and can decrypt the database */
+}
+
AlmanahPreferencesDialog *
almanah_preferences_dialog_new (void)
{
@@ -163,6 +171,7 @@ almanah_preferences_dialog_new (void)
priv->keyset = cryptui_keyset_new ("openpgp", FALSE);
priv->key_store = cryptui_key_store_new (priv->keyset, FALSE, _("None (don't encrypt)"));
+ cryptui_key_store_set_filter (priv->key_store, key_store_filter_cb, NULL);
priv->key_combo = cryptui_key_combo_new (priv->key_store);
gtk_table_attach_defaults (table, GTK_WIDGET (priv->key_combo), 2, 3, 1, 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]