Mercurial > geeqie.yaz
comparison src/preferences.c @ 670:a484500de88d
Improve editor commands error display:
- display all errors (not only syntax errors)
- display errors from Preferences (checks are made on Apply or OK)
author | zas_ |
---|---|
date | Fri, 16 May 2008 09:10:56 +0000 |
parents | e34c1002e553 |
children | 8268cbe682f1 |
comparison
equal
deleted
inserted
replaced
669:dd5d7fe9458f | 670:a484500de88d |
---|---|
155 const gchar *buf; | 155 const gchar *buf; |
156 gint new_style; | 156 gint new_style; |
157 gint i; | 157 gint i; |
158 gint refresh = FALSE; | 158 gint refresh = FALSE; |
159 | 159 |
160 { | |
161 GString *errmsg = g_string_new(""); | |
162 | |
160 for (i = 0; i < GQ_EDITOR_SLOTS; i++) | 163 for (i = 0; i < GQ_EDITOR_SLOTS; i++) |
161 { | 164 { |
162 if (i < GQ_EDITOR_GENERIC_SLOTS) | 165 if (i < GQ_EDITOR_GENERIC_SLOTS) |
163 { | 166 { |
164 g_free(options->editor_name[i]); | 167 g_free(options->editor_name[i]); |
168 } | 171 } |
169 | 172 |
170 g_free(options->editor_command[i]); | 173 g_free(options->editor_command[i]); |
171 options->editor_command[i] = NULL; | 174 options->editor_command[i] = NULL; |
172 buf = gtk_entry_get_text(GTK_ENTRY(editor_command_entry[i])); | 175 buf = gtk_entry_get_text(GTK_ENTRY(editor_command_entry[i])); |
173 if (buf && strlen(buf) > 0) options->editor_command[i] = g_strdup(buf); | 176 if (buf && strlen(buf) > 0) |
174 } | 177 { |
178 gint flags = editor_command_parse(buf, NULL, NULL); | |
179 | |
180 if (flags & EDITOR_ERROR_MASK) | |
181 { | |
182 if (errmsg->str[0]) g_string_append(errmsg, "\n\n"); | |
183 g_string_append_printf(errmsg, _("%s\n#%d \"%s\":\n%s"), editor_get_error_str(flags), | |
184 i+1, options->editor_name[i], buf); | |
185 | |
186 } | |
187 options->editor_command[i] = g_strdup(buf); | |
188 } | |
189 } | |
190 | |
191 if (errmsg->str[0]) | |
192 { | |
193 file_util_warning_dialog(_("Invalid editor command"), errmsg->str, GTK_STOCK_DIALOG_ERROR, NULL); | |
194 } | |
195 | |
196 g_string_free(errmsg, TRUE); | |
197 } | |
175 layout_edit_update_all(); | 198 layout_edit_update_all(); |
176 | 199 |
177 g_free(options->file_ops.safe_delete_path); | 200 g_free(options->file_ops.safe_delete_path); |
178 options->file_ops.safe_delete_path = NULL; | 201 options->file_ops.safe_delete_path = NULL; |
179 buf = gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry)); | 202 buf = gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry)); |