comparison src/editors.c @ 1743:1cc12c4b841a

start_editor_from_filelist_full fixes fixed return value from start_editor_from_filelist_full() call editor_command_parse to detect possible problems early enough
author nadvornik
date Mon, 07 Sep 2009 20:44:29 +0000
parents eb64f542341b
children a0e47436b552
comparison
equal deleted inserted replaced
1742:eb64f542341b 1743:1cc12c4b841a
1223 1223
1224 EditorFlags start_editor_from_filelist_full(const gchar *key, GList *list, const gchar *working_directory, EditorCallback cb, gpointer data) 1224 EditorFlags start_editor_from_filelist_full(const gchar *key, GList *list, const gchar *working_directory, EditorCallback cb, gpointer data)
1225 { 1225 {
1226 EditorFlags error; 1226 EditorFlags error;
1227 EditorDescription *editor; 1227 EditorDescription *editor;
1228 if (!key) return FALSE; 1228 if (!key) return EDITOR_ERROR_EMPTY;
1229 1229
1230 editor = g_hash_table_lookup(editors, key); 1230 editor = g_hash_table_lookup(editors, key);
1231 1231
1232 if (!editor) return FALSE; 1232 if (!editor) return EDITOR_ERROR_EMPTY;
1233 if (!list && !(editor->flags & EDITOR_NO_PARAM)) return FALSE; 1233 if (!list && !(editor->flags & EDITOR_NO_PARAM)) return EDITOR_ERROR_NO_FILE;
1234 1234
1235 error = editor_command_start(editor, editor->name, list, working_directory, cb, data); 1235 error = editor_command_parse(editor, list, TRUE, NULL);
1236
1237 if (EDITOR_ERRORS(error)) return error;
1238
1239 error |= editor_command_start(editor, editor->name, list, working_directory, cb, data);
1236 1240
1237 if (EDITOR_ERRORS(error)) 1241 if (EDITOR_ERRORS(error))
1238 { 1242 {
1239 gchar *text = g_strdup_printf(_("%s\n\"%s\""), editor_get_error_str(error), editor->file); 1243 gchar *text = g_strdup_printf(_("%s\n\"%s\""), editor_get_error_str(error), editor->file);
1240 1244
1241 file_util_warning_dialog(_("Invalid editor command"), text, GTK_STOCK_DIALOG_ERROR, NULL); 1245 file_util_warning_dialog(_("Invalid editor command"), text, GTK_STOCK_DIALOG_ERROR, NULL);
1242 g_free(text); 1246 g_free(text);
1243 } 1247 }
1244 1248
1245 return error; 1249 return EDITOR_ERRORS(error);
1246 } 1250 }
1247 1251
1248 EditorFlags start_editor_from_filelist(const gchar *key, GList *list) 1252 EditorFlags start_editor_from_filelist(const gchar *key, GList *list)
1249 { 1253 {
1250 return start_editor_from_filelist_full(key, list, NULL, NULL, NULL); 1254 return start_editor_from_filelist_full(key, list, NULL, NULL, NULL);