Mercurial > geeqie
comparison src/editors.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 | 7148e125bf23 |
children | 8adf248bf5c9 |
comparison
equal
deleted
inserted
replaced
767:e73d30e0c896 | 768:ff51413f098d |
---|---|
91 *----------------------------------------------------------------------------- | 91 *----------------------------------------------------------------------------- |
92 * external editor routines | 92 * external editor routines |
93 *----------------------------------------------------------------------------- | 93 *----------------------------------------------------------------------------- |
94 */ | 94 */ |
95 | 95 |
96 void editor_set_name(gint n, gchar *name) | |
97 { | |
98 if (n < 0 || n >= GQ_EDITOR_SLOTS) return; | |
99 | |
100 g_free(options->editor[n].name); | |
101 | |
102 options->editor[n].name = name ? utf8_validate_or_convert(name) : NULL; | |
103 } | |
104 | |
105 void editor_set_command(gint n, gchar *command) | |
106 { | |
107 if (n < 0 || n >= GQ_EDITOR_SLOTS) return; | |
108 | |
109 g_free(options->editor[n].command); | |
110 options->editor[n].command = command ? utf8_validate_or_convert(command) : NULL; | |
111 } | |
112 | |
96 void editor_reset_defaults(void) | 113 void editor_reset_defaults(void) |
97 { | 114 { |
98 gint i; | 115 gint i; |
99 | 116 |
100 for (i = 0; i < GQ_EDITOR_SLOTS; i++) | 117 for (i = 0; i < GQ_EDITOR_SLOTS; i++) |
101 { | 118 { |
102 g_free(options->editor[i].name); | 119 editor_set_name(i, _(editor_slot_defaults[i].name)); |
103 options->editor[i].name = g_strdup(_(editor_slot_defaults[i].name)); | 120 editor_set_command(i, _(editor_slot_defaults[i].command)); |
104 g_free(options->editor[i].command); | |
105 options->editor[i].command = g_strdup(editor_slot_defaults[i].command); | |
106 } | 121 } |
107 } | 122 } |
108 | 123 |
109 static void editor_verbose_data_free(EditorData *ed) | 124 static void editor_verbose_data_free(EditorData *ed) |
110 { | 125 { |