diff src/preferences.c @ 768:ff51413f098d

Use functions to set editors name and command and ensure they are utf8-encoded. Previously, non-utf8 strings from rc file caused some issues.
author zas_
date Fri, 30 May 2008 08:39:52 +0000
parents a7289f9e8d29
children ee33d2ddb661
line wrap: on
line diff
--- a/src/preferences.c	Fri May 30 08:36:23 2008 +0000
+++ b/src/preferences.c	Fri May 30 08:39:52 2008 +0000
@@ -161,16 +161,18 @@
 
 	for (i = 0; i < GQ_EDITOR_SLOTS; i++)
 		{
+		gchar *command = NULL;
+
 		if (i < GQ_EDITOR_GENERIC_SLOTS)
 			{
-			g_free(options->editor[i].name);
-			options->editor[i].name = NULL;
+			gchar *name = NULL;
+
 			buf = gtk_entry_get_text(GTK_ENTRY(editor_name_entry[i]));
-			if (buf && strlen(buf) > 0) options->editor[i].name = g_strdup(buf);
+			if (buf && strlen(buf) > 0) name = g_strdup(buf);
+			editor_set_name(i, name);
+			g_free(name);
 			}
 
-		g_free(options->editor[i].command);
-		options->editor[i].command = NULL;
 		buf = gtk_entry_get_text(GTK_ENTRY(editor_command_entry[i]));
 		if (buf && strlen(buf) > 0)
 			{
@@ -183,8 +185,11 @@
 						       i+1, options->editor[i].name, buf);
 
 				}
-			options->editor[i].command = g_strdup(buf);
+			command = g_strdup(buf);
 			}
+
+		editor_set_command(i, command);
+		g_free(command);
 		}
 	
 	if (errmsg->str[0])