mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 20:05:41 +00:00
Implemented 'Browse' functionality for the drive mapping property
sheet.
This commit is contained in:
parent
015d2a4dbe
commit
d95a91ff52
|
@ -4,7 +4,7 @@ SRCDIR = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
MODULE = winecfg.exe
|
||||
APPMODE = -mwindows
|
||||
IMPORTS = comdlg32 comctl32 user32 advapi32 kernel32
|
||||
IMPORTS = comdlg32 comctl32 shell32 ole32 shlwapi user32 advapi32 kernel32
|
||||
|
||||
C_SRCS = \
|
||||
appdefaults.c \
|
||||
|
|
|
@ -517,6 +517,66 @@ static void paint(HWND dialog)
|
|||
EndPaint(dialog, &ps);
|
||||
}
|
||||
|
||||
static void browse_for_folder(HWND dialog)
|
||||
{
|
||||
static WCHAR wszUnixRootDisplayName[] =
|
||||
{ ':',':','{','C','C','7','0','2','E','B','2','-','7','D','C','5','-','1','1','D','9','-',
|
||||
'C','6','8','7','-','0','0','0','4','2','3','8','A','0','1','C','D','}','\\','/', 0 };
|
||||
BROWSEINFOA bi = {
|
||||
dialog,
|
||||
NULL,
|
||||
NULL,
|
||||
"Select the unix directory to be mapped, please.",
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
0
|
||||
};
|
||||
IShellFolder *pDesktop;
|
||||
LPITEMIDLIST pidlUnixRoot, pidlSelectedPath;
|
||||
HRESULT hr;
|
||||
|
||||
hr = SHGetDesktopFolder(&pDesktop);
|
||||
if (!SUCCEEDED(hr)) return;
|
||||
|
||||
hr = pDesktop->lpVtbl->ParseDisplayName(pDesktop, NULL, NULL, wszUnixRootDisplayName, NULL,
|
||||
&pidlUnixRoot, NULL);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
pDesktop->lpVtbl->Release(pDesktop);
|
||||
return;
|
||||
}
|
||||
|
||||
bi.pidlRoot = pidlUnixRoot;
|
||||
pidlSelectedPath = SHBrowseForFolderA(&bi);
|
||||
|
||||
SHFree(pidlUnixRoot);
|
||||
|
||||
if (pidlSelectedPath) {
|
||||
STRRET strSelectedPath;
|
||||
char *pszSelectedPath;
|
||||
HRESULT hr;
|
||||
|
||||
hr = pDesktop->lpVtbl->GetDisplayNameOf(pDesktop, pidlSelectedPath, SHGDN_FORPARSING,
|
||||
&strSelectedPath);
|
||||
pDesktop->lpVtbl->Release(pDesktop);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
SHFree(pidlSelectedPath);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = StrRetToStr(&strSelectedPath, pidlSelectedPath, &pszSelectedPath);
|
||||
SHFree(pidlSelectedPath);
|
||||
if (!SUCCEEDED(hr)) return;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, current_drive->unixpath);
|
||||
current_drive->unixpath = strdupA(pszSelectedPath);
|
||||
fill_drives_list(dialog);
|
||||
update_controls(dialog);
|
||||
|
||||
CoTaskMemFree(pszSelectedPath);
|
||||
}
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
@ -588,7 +648,7 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case IDC_BUTTON_BROWSE_PATH:
|
||||
MessageBox(dialog, "", "Write me!", MB_OK);
|
||||
browse_for_folder(dialog);
|
||||
break;
|
||||
|
||||
case IDC_RADIO_ASSIGN:
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
#include <commctrl.h>
|
||||
#include <objbase.h>
|
||||
#include <wine/debug.h>
|
||||
|
||||
#include "properties.h"
|
||||
|
@ -248,16 +249,17 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
|
|||
}
|
||||
|
||||
/*
|
||||
* The next 3 lines should be all that is needed
|
||||
* The next 9 lines should be all that is needed
|
||||
* for the Wine Configuration property sheet
|
||||
*/
|
||||
InitCommonControls ();
|
||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
if (doPropertySheet (hInstance, NULL) > 0) {
|
||||
WINE_TRACE("OK\n");
|
||||
} else {
|
||||
WINE_TRACE("Cancel\n");
|
||||
}
|
||||
|
||||
CoUninitialize();
|
||||
ExitProcess (0);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue