Don't add the same program in AppDefaults more than once.

This commit is contained in:
James Hawkins 2005-05-04 09:47:46 +00:00 committed by Alexandre Julliard
parent 64dcb35a4e
commit 34299c760a
1 changed files with 14 additions and 0 deletions

View File

@ -256,6 +256,16 @@ static void on_selection_change(HWND dialog, HWND listview)
set_window_title(dialog); set_window_title(dialog);
} }
static BOOL list_contains_file(HWND listview, char *filename)
{
LVFINDINFO find_info = { LVFI_STRING, filename, 0, {0, 0}, 0 };
int index;
index = ListView_FindItem(listview, -1, &find_info);
return (index != -1);
}
static void on_add_app_click(HWND dialog) static void on_add_app_click(HWND dialog)
{ {
char filetitle[MAX_PATH]; char filetitle[MAX_PATH];
@ -280,6 +290,10 @@ static void on_add_app_click(HWND dialog)
char* new_app; char* new_app;
new_app = strdupA(filetitle); new_app = strdupA(filetitle);
if (list_contains_file(listview, new_app))
return;
WINE_TRACE("adding %s\n", new_app); WINE_TRACE("adding %s\n", new_app);
add_listview_item(listview, new_app, new_app); add_listview_item(listview, new_app, new_app);