summaryrefslogtreecommitdiff
path: root/client/gtk.c
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2009-10-11 14:41:57 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2010-01-02 22:30:12 +0100
commitb5ede6e44c62a70dacb091e19c671829fc26eddc (patch)
tree538836cbb7a106a834719ea04902f1ee843f6a5a /client/gtk.c
parentbf1632fec45dc95752f3151b2d60b2037226c6ad (diff)
downloadfribid-b5ede6e44c62a70dacb091e19c671829fc26eddc.tar.gz
fribid-b5ede6e44c62a70dacb091e19c671829fc26eddc.tar.bz2
fribid-b5ede6e44c62a70dacb091e19c671829fc26eddc.zip
Select the only signature if there's only one
Diffstat (limited to 'client/gtk.c')
-rw-r--r--client/gtk.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/client/gtk.c b/client/gtk.c
index bcb6b4d..a25c544 100644
--- a/client/gtk.c
+++ b/client/gtk.c
@@ -136,6 +136,18 @@ static bool addSignatureFile(GtkListStore *signatures, const char *filename,
return (personCount != 0);
}
+static void selectDefaultSignature() {
+ GtkTreeModel *model = gtk_combo_box_get_model(signaturesCombo);
+ GtkTreeIter iter = { .stamp = 0 };
+
+ if (gtk_tree_model_get_iter_first(model, &iter) &&
+ !gtk_tree_model_iter_next(model, &iter)) {
+ // There's only one item, select it
+ gtk_tree_model_get_iter_first(model, &iter);
+ gtk_combo_box_set_active_iter(signaturesCombo, &iter);
+ }
+}
+
void platform_startSign(const char *url, const char *hostname, const char *ip,
const char *subjectFilter, int parentWindowId) {
@@ -191,6 +203,8 @@ void platform_startSign(const char *url, const char *hostname, const char *ip,
g_signal_connect(G_OBJECT(signaturesCombo), "changed",
G_CALLBACK(validateDialog), NULL);
+ selectDefaultSignature();
+
passwordEntry = GTK_ENTRY(gtk_builder_get_object(builder, "password_entry"));
signDialog = GTK_DIALOG(gtk_builder_get_object(builder, "dialog_sign"));