Skip to content

Commit

Permalink
start_editor_from_filelist_full fixes
Browse files Browse the repository at this point in the history
fixed return value from start_editor_from_filelist_full()
call editor_command_parse to detect possible problems early enough
  • Loading branch information
nadvornik committed Sep 7, 2009
1 parent 89d76d7 commit 04d9cb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/editors.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,14 +1225,18 @@ EditorFlags start_editor_from_filelist_full(const gchar *key, GList *list, const
{
EditorFlags error;
EditorDescription *editor;
if (!key) return FALSE;
if (!key) return EDITOR_ERROR_EMPTY;

editor = g_hash_table_lookup(editors, key);

if (!editor) return FALSE;
if (!list && !(editor->flags & EDITOR_NO_PARAM)) return FALSE;
if (!editor) return EDITOR_ERROR_EMPTY;
if (!list && !(editor->flags & EDITOR_NO_PARAM)) return EDITOR_ERROR_NO_FILE;

error = editor_command_parse(editor, list, TRUE, NULL);

error = editor_command_start(editor, editor->name, list, working_directory, cb, data);
if (EDITOR_ERRORS(error)) return error;

error |= editor_command_start(editor, editor->name, list, working_directory, cb, data);

if (EDITOR_ERRORS(error))
{
Expand All @@ -1242,7 +1246,7 @@ EditorFlags start_editor_from_filelist_full(const gchar *key, GList *list, const
g_free(text);
}

return error;
return EDITOR_ERRORS(error);
}

EditorFlags start_editor_from_filelist(const gchar *key, GList *list)
Expand Down
2 changes: 1 addition & 1 deletion src/utilops.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ void file_util_perform_ci(UtilityData *ud)
}
}

if (flags)
if (EDITOR_ERRORS(flags))
{
gchar *text = g_strdup_printf(_("%s\nUnable to start external command.\n"), editor_get_error_str(flags));
file_util_warning_dialog(ud->messages.fail, text, GTK_STOCK_DIALOG_ERROR, NULL);
Expand Down

0 comments on commit 04d9cb6

Please sign in to comment.