Don't add the same program in AppDefaults more than once.
This commit is contained in:
parent
64dcb35a4e
commit
34299c760a
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue