gcr_prompt_set_description
gcr_prompt_get_warning
gcr_prompt_set_warning
+gcr_prompt_get_continue_label
+gcr_prompt_set_continue_label
+gcr_prompt_get_cancel_label
+gcr_prompt_set_cancel_label
gcr_prompt_get_choice_label
gcr_prompt_set_choice_label
gcr_prompt_get_choice_chosen
gcr_prompt_confirm_finish
gcr_prompt_confirm_run
gcr_prompt_get_caller_window
+gcr_prompt_get_cancel_label
gcr_prompt_get_choice_chosen
gcr_prompt_get_choice_label
+gcr_prompt_get_continue_label
gcr_prompt_get_description
gcr_prompt_get_message
gcr_prompt_get_password_new
gcr_prompt_password_run
gcr_prompt_reply_get_type
gcr_prompt_set_caller_window
+gcr_prompt_set_cancel_label
gcr_prompt_set_choice_chosen
gcr_prompt_set_choice_label
+gcr_prompt_set_continue_label
gcr_prompt_set_description
gcr_prompt_set_message
gcr_prompt_set_password_new
PROP_PASSWORD_STRENGTH,
PROP_CHOICE_LABEL,
PROP_CHOICE_CHOSEN,
- PROP_CALLER_WINDOW
+ PROP_CALLER_WINDOW,
+ PROP_CONTINUE_LABEL,
+ PROP_CANCEL_LABEL,
};
struct _GcrMockPrompt {
blank_string_property (self->properties, "warning");
blank_string_property (self->properties, "choice-label");
blank_string_property (self->properties, "caller-window");
+ blank_string_property (self->properties, "continue-label");
+ blank_string_property (self->properties, "cancel-label");
blank_boolean_property (self->properties, "choice-chosen");
blank_boolean_property (self->properties, "password-new");
case PROP_CHOICE_LABEL:
case PROP_CHOICE_CHOSEN:
case PROP_CALLER_WINDOW:
+ case PROP_CONTINUE_LABEL:
+ case PROP_CANCEL_LABEL:
param = g_new0 (GParameter, 1);
param->name = pspec->name;
g_value_init (¶m->value, pspec->value_type);
case PROP_CHOICE_LABEL:
case PROP_CHOICE_CHOSEN:
case PROP_CALLER_WINDOW:
+ case PROP_CONTINUE_LABEL:
+ case PROP_CANCEL_LABEL:
param = g_hash_table_lookup (self->properties, pspec->name);
g_return_if_fail (param != NULL);
g_value_copy (¶m->value, value);
g_object_class_override_property (gobject_class, PROP_CHOICE_CHOSEN, "choice-chosen");
g_object_class_override_property (gobject_class, PROP_PASSWORD_NEW, "password-new");
g_object_class_override_property (gobject_class, PROP_PASSWORD_STRENGTH, "password-strength");
+ g_object_class_override_property (gobject_class, PROP_CONTINUE_LABEL, "continue-label");
+ g_object_class_override_property (gobject_class, PROP_CANCEL_LABEL, "cancel-label");
}
static gboolean
gcr_mock_prompt_confirm_async), GCR_PROMPT_REPLY_CANCEL);
return g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (result)) ?
- GCR_PROMPT_REPLY_OK : GCR_PROMPT_REPLY_CANCEL;
+ GCR_PROMPT_REPLY_CONTINUE : GCR_PROMPT_REPLY_CANCEL;
}
static void
PROP_PASSWORD_NEW,
PROP_PASSWORD_STRENGTH,
PROP_CALLER_WINDOW,
+ PROP_CONTINUE_LABEL,
+ PROP_CANCEL_LABEL,
PROP_PASSWORD_VISIBLE,
PROP_CONFIRM_VISIBLE,
gboolean password_new;
guint password_strength;
gchar *caller_window;
+ gchar *continue_label;
+ gchar *cancel_label;
GSimpleAsyncResult *async_result;
GcrPromptReply last_reply;
update_transient_for (self);
g_object_notify (obj, "caller-window");
break;
+ case PROP_CONTINUE_LABEL:
+ g_free (self->pv->continue_label);
+ self->pv->continue_label = g_value_dup_string (value);
+ g_object_notify (obj, "continue-label");
+ break;
+ case PROP_CANCEL_LABEL:
+ g_free (self->pv->cancel_label);
+ self->pv->cancel_label = g_value_dup_string (value);
+ g_object_notify (obj, "cancel-label");
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
case PROP_CHOICE_VISIBLE:
g_value_set_boolean (value, self->pv->choice_label && self->pv->choice_label[0]);
break;
+ case PROP_CONTINUE_LABEL:
+ g_value_set_string (value, self->pv->continue_label);
+ break;
+ case PROP_CANCEL_LABEL:
+ g_value_set_string (value, self->pv->cancel_label);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
GtkWidget *widget;
GtkWidget *entry;
GtkWidget *content;
+ GtkWidget *button;
GtkGrid *grid;
G_OBJECT_CLASS (gcr_prompt_dialog_parent_class)->constructed (obj);
dialog = GTK_DIALOG (self);
- gtk_dialog_add_buttons (dialog,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- _("Continue"), GTK_RESPONSE_OK,
- NULL);
+ button = gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ g_object_bind_property (self, "cancel-label", button, "label", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+ button = gtk_dialog_add_button (dialog, GTK_STOCK_OK, GTK_RESPONSE_OK);
+ g_object_bind_property (self, "continue-label", button, "label", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_window_set_keep_above (GTK_WINDOW (dialog), TRUE);
default:
break;
}
- self->pv->last_reply = GCR_PROMPT_REPLY_OK;
+ self->pv->last_reply = GCR_PROMPT_REPLY_CONTINUE;
break;
default:
g_object_class_override_property (gobject_class, PROP_CALLER_WINDOW, "caller-window");
+ g_object_class_override_property (gobject_class, PROP_CONTINUE_LABEL, "continue-label");
+
+ g_object_class_override_property (gobject_class, PROP_CANCEL_LABEL, "cancel-label");
+
/**
* GcrPromptDialog:password-visible
*
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
return NULL;
- if (self->pv->last_reply == GCR_PROMPT_REPLY_OK)
+ if (self->pv->last_reply == GCR_PROMPT_REPLY_CONTINUE)
return gtk_entry_buffer_get_text (self->pv->password_buffer);
return NULL;
}
#include "gcr-prompt.h"
+#include <glib/gi18n-lib.h>
+
/**
* SECTION:gcr-prompt
* @title: GcrPrompt
/**
* GcrPromptReply:
- * @GCR_PROMPT_REPLY_OK: the user replied with 'ok'
+ * @GCR_PROMPT_REPLY_CONTINUE: the user replied with 'ok'
* @GCR_PROMPT_REPLY_CANCEL: the prompt was cancelled
*
* Various replies returned by gcr_prompt_confirm() and friends.
g_param_spec_string ("caller-window", "Caller window", "Window ID of application window requesting prompt",
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GcrPrompt:continue-label:
+ *
+ * The label for the continue button in the prompt.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_string ("continue-label", "Continue label", "Continue button label",
+ _("Continue"), G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GcrPrompt:cancel-label:
+ *
+ * The label for the cancel button in the prompt.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_string ("cancel-label", "Cancel label", "Cancel button label",
+ _("Cancel"), G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+
g_once_init_leave (&initialized, 1);
}
}
}
/**
+ * gcr_prompt_get_continue_label:
+ * @prompt: the prompt
+ *
+ * Get the label for the continue button.
+ *
+ * This is the button that results in a %GCR_PROMPT_REPLY_CONTINUE reply
+ * from the prompt.
+ *
+ * Returns: (transfer full): a newly allocated string containing the label
+ */
+gchar *
+gcr_prompt_get_continue_label (GcrPrompt *prompt)
+{
+ gchar *continue_label = NULL;
+ g_object_get (prompt, "continue-label", &continue_label, NULL);
+ return continue_label;
+}
+
+/**
+ * gcr_prompt_set_continue_label:
+ * @prompt: the prompt
+ * @continue_label: the label
+ *
+ * Set the label for the continue button.
+ *
+ * This is the button that results in a %GCR_PROMPT_REPLY_CONTINUE reply
+ * from the prompt.
+ */
+void
+gcr_prompt_set_continue_label (GcrPrompt *prompt,
+ const gchar *continue_label)
+{
+ g_return_if_fail (GCR_IS_PROMPT (prompt));
+ g_object_set (prompt, "continue-label", continue_label, NULL);
+}
+
+/**
+ * gcr_prompt_get_cancel_label:
+ * @prompt: the prompt
+ *
+ * Get the label for the cancel button.
+ *
+ * This is the button that results in a %GCR_PROMPT_REPLY_CANCEL reply
+ * from the prompt.
+ *
+ * Returns: (transfer full): a newly allocated string containing the label
+ */
+gchar *
+gcr_prompt_get_cancel_label (GcrPrompt *prompt)
+{
+ gchar *cancel_label = NULL;
+ g_object_get (prompt, "cancel-label", &cancel_label, NULL);
+ return cancel_label;
+}
+
+/**
+ * gcr_prompt_set_cancel_label:
+ * @prompt: the prompt
+ * @cancel_label: the label
+ *
+ * Set the label for the continue button.
+ *
+ * This is the button that results in a %GCR_PROMPT_REPLY_CANCEL reply
+ * from the prompt.
+ */
+void
+gcr_prompt_set_cancel_label (GcrPrompt *prompt,
+ const gchar *cancel_label)
+{
+ g_return_if_fail (GCR_IS_PROMPT (prompt));
+ g_object_set (prompt, "cancel-label", cancel_label, NULL);
+}
+
+/**
* gcr_prompt_password_async:
* @prompt: a prompt
* @cancellable: optional cancellation object
typedef enum {
GCR_PROMPT_REPLY_CANCEL = 0,
- GCR_PROMPT_REPLY_OK = 1,
+ GCR_PROMPT_REPLY_CONTINUE = 1,
} GcrPromptReply;
#define GCR_TYPE_PROMPT (gcr_prompt_get_type ())
void gcr_prompt_set_caller_window (GcrPrompt *prompt,
const gchar *window_id);
+gchar * gcr_prompt_get_continue_label (GcrPrompt *prompt);
+
+void gcr_prompt_set_continue_label (GcrPrompt *prompt,
+ const gchar *continue_label);
+
+gchar * gcr_prompt_get_cancel_label (GcrPrompt *prompt);
+
+void gcr_prompt_set_cancel_label (GcrPrompt *prompt,
+ const gchar *cancel_label);
+
void gcr_prompt_password_async (GcrPrompt *prompt,
GCancellable *cancellable,
GAsyncReadyCallback callback,
PROP_PASSWORD_STRENGTH,
PROP_CHOICE_LABEL,
PROP_CHOICE_CHOSEN,
- PROP_CALLER_WINDOW
+ PROP_CALLER_WINDOW,
+ PROP_CONTINUE_LABEL,
+ PROP_CANCEL_LABEL
};
struct _GcrSystemPromptPrivate {
case PROP_CALLER_WINDOW:
prompt_set_string_property (self, "caller-window", g_value_get_string (value));
break;
+ case PROP_CONTINUE_LABEL:
+ prompt_set_string_property (self, "continue-label", g_value_get_string (value));
+ break;
+ case PROP_CANCEL_LABEL:
+ prompt_set_string_property (self, "cancel-label", g_value_get_string (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
case PROP_CALLER_WINDOW:
g_value_set_string (value, prompt_get_string_property (self, "caller-window", TRUE));
break;
+ case PROP_CONTINUE_LABEL:
+ g_value_set_string (value, prompt_get_string_property (self, "continue-label", TRUE));
+ break;
+ case PROP_CANCEL_LABEL:
+ g_value_set_string (value, prompt_get_string_property (self, "cancel-label", TRUE));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
g_object_class_override_property (gobject_class, PROP_CHOICE_LABEL, "choice-label");
g_object_class_override_property (gobject_class, PROP_CHOICE_CHOSEN, "choice-chosen");
g_object_class_override_property (gobject_class, PROP_CALLER_WINDOW, "caller-window");
+ g_object_class_override_property (gobject_class, PROP_CONTINUE_LABEL, "continue-label");
+ g_object_class_override_property (gobject_class, PROP_CANCEL_LABEL, "cancel-label");
}
/**
GCR_PROMPT_REPLY_CANCEL);
if (g_str_equal (self->pv->last_response, GCR_DBUS_PROMPT_REPLY_YES)) {
- response = GCR_PROMPT_REPLY_OK;
+ response = GCR_PROMPT_REPLY_CONTINUE;
} else if (g_str_equal (self->pv->last_response, GCR_DBUS_PROMPT_REPLY_NO) ||
g_str_equal (self->pv->last_response, GCR_DBUS_PROMPT_REPLY_NONE)) {
if (g_simple_async_result_propagate_error (res, error))
return FALSE;
- if (handle_last_response (self) == GCR_PROMPT_REPLY_OK)
+ if (handle_last_response (self) == GCR_PROMPT_REPLY_CONTINUE)
return gcr_secret_exchange_get_secret (self->pv->exchange, NULL);
return NULL;
}
switch (reply) {
- case GCR_PROMPT_REPLY_OK:
+ case GCR_PROMPT_REPLY_CONTINUE:
response = GCR_DBUS_PROMPT_REPLY_YES;
break;
case GCR_PROMPT_REPLY_CANCEL:
description = An application wants access to the keyring 'sean', but it is locked
choice-label = Always unlock this keyring whenever I'm logged in.
password-new = false
+continue-label = Go
+cancel-label = Stop
[one]
type = password
"choice-chosen", TRUE,
"password-new", TRUE,
"password-strength", 0,
+ "continue-label", "My Continue",
+ "cancel-label", "My Cancel",
NULL);
prompt = gcr_system_prompt_open_for_prompter (test->prompter_name, 0, NULL, &error);
"warning", "Other Warning",
"password-new", FALSE,
"choice-chosen", TRUE,
+ "continue-label", "Other Continue",
+ "cancel-label", "Other Cancel",
NULL);
g_assert_cmpstr (gcr_prompt_get_title (prompt), ==, "Other Title");
g_assert_cmpstr (gcr_prompt_get_message (prompt), ==, "Other Message");
g_assert_cmpstr (gcr_prompt_get_caller_window (prompt), ==, "01012");
g_assert_cmpstr (gcr_prompt_get_warning (prompt), ==, "Other Warning");
+ g_assert_cmpstr (gcr_prompt_get_continue_label (prompt), ==, "Other Continue");
+ g_assert_cmpstr (gcr_prompt_get_cancel_label (prompt), ==, "Other Cancel");
g_assert (gcr_prompt_get_password_new (prompt) == FALSE);
g_assert (gcr_prompt_get_choice_chosen (prompt) == TRUE);
gcr_prompt_set_message (prompt, "My Message");
gcr_prompt_set_caller_window (prompt, "01010");
gcr_prompt_set_warning (prompt, "My Warning");
+ gcr_prompt_set_continue_label (prompt, "My Continue");
+ gcr_prompt_set_cancel_label (prompt, "My Cancel");
gcr_prompt_set_password_new (prompt, TRUE);
gcr_prompt_set_choice_chosen (prompt, TRUE);
g_assert_cmpstr (gcr_prompt_get_message (prompt), ==, NULL);
g_assert_cmpstr (gcr_prompt_get_caller_window (prompt), ==, NULL);
g_assert_cmpstr (gcr_prompt_get_warning (prompt), ==, NULL);
+ g_assert_cmpstr (gcr_prompt_get_continue_label (prompt), ==, "Continue");
+ g_assert_cmpstr (gcr_prompt_get_cancel_label (prompt), ==, "Cancel");
g_assert (gcr_prompt_get_password_new (prompt) == FALSE);
g_assert (gcr_prompt_get_choice_chosen (prompt) == FALSE);
g_assert_cmpint (gcr_prompt_get_password_strength (prompt), ==, 0);
gcr/gcr-pkcs11-import-dialog.c
[type: gettext/glade]gcr/gcr-pkcs11-import-dialog.ui
gcr/gcr-pkcs11-import-interaction.c
+gcr/gcr-prompt.c
gcr/gcr-prompt-dialog.c
gcr/gcr-subject-public-key.c
gcr/gcr-system-prompt.c