[gnome-keyring] [prompt] Always encode strings properly.



commit e258971767cd259dfa3cf58babc6a4362906c618
Author: Stef Walter <stef memberwebs com>
Date:   Sun Jun 13 01:51:28 2010 +0000

    [prompt] Always encode strings properly.
    
     * Encode strings going to and from prompt process properly.
     * Previously certain character combinations would cause
       GKeyFile to barf.

 ui/gku-prompt-tool.c |   20 ++++++++++----------
 ui/gku-prompt.c      |   14 +++++++-------
 2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/ui/gku-prompt-tool.c b/ui/gku-prompt-tool.c
index 43ddea0..0c29102 100644
--- a/ui/gku-prompt-tool.c
+++ b/ui/gku-prompt-tool.c
@@ -198,7 +198,7 @@ prepare_titlebar (GtkBuilder *builder, GtkDialog *dialog)
 {
 	gchar *title;
 
-	title = g_key_file_get_value (input_data, "prompt", "title", NULL);
+	title = g_key_file_get_string (input_data, "prompt", "title", NULL);
 	if (title)
 		gtk_window_set_title (GTK_WINDOW (dialog), title);
 	gtk_window_set_icon_name(GTK_WINDOW(dialog), "stock_lock");
@@ -231,9 +231,9 @@ prepare_prompt (GtkBuilder *builder, GtkDialog *dialog)
 	gchar *primary, *secondary, *markup, *warning;
 	GtkLabel *label;
 
-	primary = g_key_file_get_value (input_data, "prompt", "primary", NULL);
+	primary = g_key_file_get_string (input_data, "prompt", "primary", NULL);
 	g_return_if_fail (primary);
-	secondary = g_key_file_get_value (input_data, "prompt", "secondary", NULL);
+	secondary = g_key_file_get_string (input_data, "prompt", "secondary", NULL);
 
 	markup = create_markup (primary, secondary);
 	g_free (primary);
@@ -245,7 +245,7 @@ prepare_prompt (GtkBuilder *builder, GtkDialog *dialog)
 	gtk_label_set_markup (label, markup);
 	g_free (markup);
 
-	warning = g_key_file_get_value (input_data, "prompt", "warning", NULL);
+	warning = g_key_file_get_string (input_data, "prompt", "warning", NULL);
 	if (warning != NULL)
 		prepare_warning (builder, warning);
 	g_free (warning);
@@ -258,9 +258,9 @@ prepare_buttons (GtkBuilder *builder, GtkDialog *dialog)
 	gchar *cancel_text;
 	gchar *other_text;
 
-	ok_text = g_key_file_get_value (input_data, "buttons", "ok", NULL);
-	cancel_text = g_key_file_get_value (input_data, "buttons", "cancel", NULL);
-	other_text = g_key_file_get_value (input_data, "buttons", "other", NULL);
+	ok_text = g_key_file_get_string (input_data, "buttons", "ok", NULL);
+	cancel_text = g_key_file_get_string (input_data, "buttons", "cancel", NULL);
+	other_text = g_key_file_get_string (input_data, "buttons", "other", NULL);
 
 	if (other_text)
 		gtk_dialog_add_button (dialog, other_text, GTK_RESPONSE_APPLY);
@@ -521,8 +521,8 @@ gather_password (GtkBuilder *builder, const gchar *password_type)
 	if (!g_key_file_has_group (input_data, "transport")) {
 		text = gtk_entry_get_text (entry);
 		value = egg_hex_encode ((const guchar*)text, strlen (text));
-		g_key_file_set_value (output_data, password_type, "parameter", "");
-		g_key_file_set_value (output_data, password_type, "value", value);
+		g_key_file_set_string (output_data, password_type, "parameter", "");
+		g_key_file_set_string (output_data, password_type, "value", value);
 		g_free (value);
 		return;
 	}
@@ -566,7 +566,7 @@ gather_response (gint response)
 		break;
 	}
 
-	g_key_file_set_value (output_data, "prompt", "response", value);
+	g_key_file_set_string (output_data, "prompt", "response", value);
 }
 
 static void
diff --git a/ui/gku-prompt.c b/ui/gku-prompt.c
index f609bf9..0b8f2e6 100644
--- a/ui/gku-prompt.c
+++ b/ui/gku-prompt.c
@@ -454,7 +454,7 @@ display_dummy_prompt (GkuPrompt *self, const gchar *response)
 	g_assert (GKU_IS_PROMPT (self));
 
 	if (!response && self->pv->input)
-		title = g_key_file_get_value (self->pv->input, "prompt", "title", NULL);
+		title = g_key_file_get_string (self->pv->input, "prompt", "title", NULL);
 
 	/* Fires completed event when fails */
 	if (!prepare_input_data (self)) {
@@ -643,7 +643,7 @@ gku_prompt_set_title (GkuPrompt *self, const gchar *title)
 {
 	g_return_if_fail (GKU_IS_PROMPT (self));
 	g_return_if_fail (self->pv->input);
-	g_key_file_set_value (self->pv->input, "prompt", "title", title);
+	g_key_file_set_string (self->pv->input, "prompt", "title", title);
 }
 
 void
@@ -651,7 +651,7 @@ gku_prompt_set_primary_text (GkuPrompt *self, const gchar *primary)
 {
 	g_return_if_fail (GKU_IS_PROMPT (self));
 	g_return_if_fail (self->pv->input);
-	g_key_file_set_value (self->pv->input, "prompt", "primary", primary);
+	g_key_file_set_string (self->pv->input, "prompt", "primary", primary);
 }
 
 void
@@ -659,7 +659,7 @@ gku_prompt_set_secondary_text (GkuPrompt *self, const gchar *secondary)
 {
 	g_return_if_fail (GKU_IS_PROMPT (self));
 	g_return_if_fail (self->pv->input);
-	g_key_file_set_value (self->pv->input, "prompt", "secondary", secondary);
+	g_key_file_set_string (self->pv->input, "prompt", "secondary", secondary);
 }
 
 void
@@ -705,7 +705,7 @@ gku_prompt_get_response (GkuPrompt *self)
 
 	g_return_val_if_fail (self->pv->output, GKU_RESPONSE_FAILURE);
 
-	response = g_key_file_get_value (self->pv->output, "prompt", "response", NULL);
+	response = g_key_file_get_string (self->pv->output, "prompt", "response", NULL);
 	if (!response || g_str_equal (response, "")) {
 		ret = GKU_RESPONSE_NONE;
 	} else if (g_str_equal (response, "ok")) {
@@ -781,7 +781,7 @@ gku_prompt_set_window_id (GkuPrompt *self, const gchar *window_id)
 	if (!window_id)
 		g_key_file_remove_key (self->pv->input, "prompt", "window-id", NULL);
 	else
-		g_key_file_set_value (self->pv->input, "prompt", "window-id", window_id);
+		g_key_file_set_string (self->pv->input, "prompt", "window-id", window_id);
 }
 
 void
@@ -792,7 +792,7 @@ gku_prompt_set_warning (GkuPrompt *self, const gchar *warning)
 	if (!warning)
 		g_key_file_remove_key (self->pv->input, "prompt", "warning", NULL);
 	else
-		g_key_file_set_value (self->pv->input, "prompt", "warning", warning);
+		g_key_file_set_string (self->pv->input, "prompt", "warning", warning);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]