[gnome-keyring] [gpg-agent] Change the agent prompt strings to not talk about keyrings.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] [gpg-agent] Change the agent prompt strings to not talk about keyrings.
- Date: Sun, 29 Aug 2010 01:33:42 +0000 (UTC)
commit 04a179c4def0d311e0bd2be62e5e0f7dc3c94bfd
Author: Stef Walter <stef memberwebs com>
Date: Fri Aug 27 03:21:09 2010 +0000
[gpg-agent] Change the agent prompt strings to not talk about keyrings.
* Added way to change strings in GcrUnlockOptionsWidget
* GkuPrompt now has a way to transfer these strings to gnome-keyring-prompt
daemon/gpg-agent/gkd-gpg-agent-ops.c | 4 ++
gcr/gcr-unlock-options-widget.c | 51 ++++++++++++++++++++++++++++++++++
gcr/gcr-unlock-options-widget.h | 13 ++++++++
ui/gku-prompt-tool.c | 15 ++++++++++
ui/gku-prompt.c | 11 +++++++
ui/gku-prompt.h | 4 ++
6 files changed, 98 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gpg-agent/gkd-gpg-agent-ops.c b/daemon/gpg-agent/gkd-gpg-agent-ops.c
index 5defe24..89ea21d 100644
--- a/daemon/gpg-agent/gkd-gpg-agent-ops.c
+++ b/daemon/gpg-agent/gkd-gpg-agent-ops.c
@@ -338,6 +338,10 @@ prepare_password_prompt (GP11Session *session, const gchar *errmsg, const gchar
else
gku_prompt_hide_widget (prompt, "auto_area");
+ gku_prompt_set_unlock_label (prompt, "label-idle", _("Forget this password if idle for"));
+ gku_prompt_set_unlock_label (prompt, "label-timeout", _("Forget this password after"));
+ gku_prompt_set_unlock_label (prompt, "label-session", _("Forget this password when I log out"));
+
gp11_list_unref_free (objects);
return prompt;
diff --git a/gcr/gcr-unlock-options-widget.c b/gcr/gcr-unlock-options-widget.c
index 44afb8a..61d0a77 100644
--- a/gcr/gcr-unlock-options-widget.c
+++ b/gcr/gcr-unlock-options-widget.c
@@ -73,6 +73,21 @@ on_timeout_choices_toggled (GtkToggleButton *unused, GtkBuilder *builder)
}
+static const gchar*
+widget_name_for_option (guint option)
+{
+ switch (option) {
+ case GCR_UNLOCK_OPTION_SESSION:
+ return "lock_logout_choice";
+ case GCR_UNLOCK_OPTION_TIMEOUT:
+ return "lock_after_choice";
+ case GCR_UNLOCK_OPTION_IDLE:
+ return "lock_idle_choice";
+ default:
+ return NULL;
+ }
+}
+
/* -----------------------------------------------------------------------------
* OBJECT
*/
@@ -243,3 +258,39 @@ gcr_unlock_options_widget_new (void)
{
return g_object_new (GCR_TYPE_UNLOCK_OPTIONS_WIDGET, NULL);
}
+
+const gchar*
+gcr_unlock_options_widget_get_label (GcrUnlockOptionsWidget *self, guint option)
+{
+ GtkToggleButton *button;
+ const gchar *name;
+
+ g_return_val_if_fail (GCR_IS_UNLOCK_OPTIONS_WIDGET (self), NULL);
+
+ name = widget_name_for_option (option);
+ g_return_val_if_fail (name, NULL);
+
+ button = builder_get_toggle_button (self->pv->builder, name);
+ g_return_val_if_fail (button, NULL);
+
+ return gtk_button_get_label (GTK_BUTTON (button));
+}
+
+void
+gcr_unlock_options_widget_set_label (GcrUnlockOptionsWidget *self, guint option,
+ const gchar *text)
+{
+ GtkToggleButton *button;
+ const gchar *name;
+
+ g_return_if_fail (GCR_IS_UNLOCK_OPTIONS_WIDGET (self));
+ g_return_if_fail (text);
+
+ name = widget_name_for_option (option);
+ g_return_if_fail (name);
+
+ button = builder_get_toggle_button (self->pv->builder, name);
+ g_return_if_fail (button);
+
+ gtk_button_set_label (GTK_BUTTON (button), text);
+}
diff --git a/gcr/gcr-unlock-options-widget.h b/gcr/gcr-unlock-options-widget.h
index 835a550..e2e7831 100644
--- a/gcr/gcr-unlock-options-widget.h
+++ b/gcr/gcr-unlock-options-widget.h
@@ -47,10 +47,23 @@ struct _GcrUnlockOptionsWidgetClass {
GtkAlignmentClass parent_class;
};
+enum {
+ GCR_UNLOCK_OPTION_SESSION = 0x01,
+ GCR_UNLOCK_OPTION_TIMEOUT = 0x02,
+ GCR_UNLOCK_OPTION_IDLE = 0x04,
+};
+
GType gcr_unlock_options_widget_get_type (void);
GtkWidget* gcr_unlock_options_widget_new (void);
+const gchar* gcr_unlock_options_widget_get_label (GcrUnlockOptionsWidget *self,
+ guint option);
+
+void gcr_unlock_options_widget_set_label (GcrUnlockOptionsWidget *self,
+ guint option,
+ const gchar *text);
+
G_END_DECLS
#endif /* __GCR_UNLOCK_OPTIONS_WIDGET_H__ */
diff --git a/ui/gku-prompt-tool.c b/ui/gku-prompt-tool.c
index 91c49fa..149b06e 100644
--- a/ui/gku-prompt-tool.c
+++ b/ui/gku-prompt-tool.c
@@ -424,6 +424,17 @@ prepare_security (GtkBuilder *builder, GtkDialog *dialog)
g_signal_connect (dialog, "window-state-event", G_CALLBACK (window_state_changed), NULL);
}
+static void
+prepare_lock_label (GtkWidget *unlock, guint option, const gchar *field)
+{
+ gchar *label;
+
+ label = g_key_file_get_string (input_data, "unlock-options", field, NULL);
+ if (label)
+ gcr_unlock_options_widget_set_label (GCR_UNLOCK_OPTIONS_WIDGET (unlock), option, label);
+ g_free (label);
+}
+
/**
* builder: GtkBuilderobject to read widgets from
* dialog: the prompt dialog
@@ -458,6 +469,10 @@ prepare_lock (GtkBuilder *builder, GtkDialog *dialog)
"unlock-idle", unlock_idle,
"unlock-timeout", unlock_timeout,
NULL);
+
+ prepare_lock_label (unlock, GCR_UNLOCK_OPTION_IDLE, "label-idle");
+ prepare_lock_label (unlock, GCR_UNLOCK_OPTION_TIMEOUT, "label-timeout");
+ prepare_lock_label (unlock, GCR_UNLOCK_OPTION_SESSION, "label-session");
}
/**
diff --git a/ui/gku-prompt.c b/ui/gku-prompt.c
index 0b8f2e6..d723eb3 100644
--- a/ui/gku-prompt.c
+++ b/ui/gku-prompt.c
@@ -913,6 +913,17 @@ gku_prompt_set_unlock_option (GkuPrompt *self, const gchar *option, gint value)
g_key_file_set_integer (self->pv->input, "unlock-options", option, value);
}
+void
+gku_prompt_set_unlock_label (GkuPrompt *self, const gchar *option, const gchar *label)
+{
+ g_return_if_fail (GKU_IS_PROMPT (self));
+ g_return_if_fail (option);
+ g_return_if_fail (label);
+ g_return_if_fail (self->pv->input);
+
+ g_key_file_set_string (self->pv->input, "unlock-options", option, label);
+}
+
/* ----------------------------------------------------------------------------------
* ATTENTION QUEUES
*/
diff --git a/ui/gku-prompt.h b/ui/gku-prompt.h
index 060bfcf..b230079 100644
--- a/ui/gku-prompt.h
+++ b/ui/gku-prompt.h
@@ -124,6 +124,10 @@ void gku_prompt_set_unlock_option (GkuPrompt *self,
const gchar *option,
gint value);
+void gku_prompt_set_unlock_label (GkuPrompt *self,
+ const gchar *option,
+ const gchar *label);
+
gboolean gku_prompt_is_widget_selected (GkuPrompt *prompt,
const gchar *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]