Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b431995c
Commit
b431995c
authored
Aug 04, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Aug 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explorerframe: Implement RemoveRoot and RemoveAllRoots.
parent
658ec55a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
4 deletions
+100
-4
nstc.c
dlls/explorerframe/nstc.c
+71
-4
nstc.c
dlls/explorerframe/tests/nstc.c
+29
-0
No files found.
dlls/explorerframe/nstc.c
View file @
b431995c
...
...
@@ -99,6 +99,19 @@ static HRESULT events_OnItemAdded(NSTC2Impl *This, IShellItem *psi, BOOL fIsRoot
return
ret
;
}
static
HRESULT
events_OnItemDeleted
(
NSTC2Impl
*
This
,
IShellItem
*
psi
,
BOOL
fIsRoot
)
{
HRESULT
ret
;
LONG
refcount
;
if
(
!
This
->
pnstce
)
return
S_OK
;
refcount
=
IShellItem_AddRef
(
psi
);
ret
=
INameSpaceTreeControlEvents_OnItemDeleted
(
This
->
pnstce
,
psi
,
fIsRoot
);
if
(
IShellItem_Release
(
psi
)
<
refcount
-
1
)
ERR
(
"ShellItem was released by client - please file a bug.
\n
"
);
return
ret
;
}
/*************************************************************************
* NamespaceTree helper functions
*/
...
...
@@ -270,11 +283,22 @@ static LRESULT destroy_namespacetree(NSTC2Impl *This)
{
TRACE
(
"%p
\n
"
,
This
);
INameSpaceTreeControl_RemoveAllRoots
((
INameSpaceTreeControl
*
)
This
);
/* This reference was added in create_namespacetree */
INameSpaceTreeControl_Release
((
INameSpaceTreeControl
*
)
This
);
return
TRUE
;
}
static
LRESULT
on_tvn_deleteitemw
(
NSTC2Impl
*
This
,
LPARAM
lParam
)
{
NMTREEVIEWW
*
nmtv
=
(
NMTREEVIEWW
*
)
lParam
;
TRACE
(
"%p
\n
"
,
This
);
IShellItem_Release
((
IShellItem
*
)
nmtv
->
itemOld
.
lParam
);
return
TRUE
;
}
static
LRESULT
on_tvn_getdispinfow
(
NSTC2Impl
*
This
,
LPARAM
lParam
)
{
NMTVDISPINFOW
*
dispinfo
=
(
NMTVDISPINFOW
*
)
lParam
;
...
...
@@ -349,6 +373,7 @@ static LRESULT CALLBACK NSTC2_WndProc(HWND hWnd, UINT uMessage,
nmhdr
=
(
NMHDR
*
)
lParam
;
switch
(
nmhdr
->
code
)
{
case
TVN_DELETEITEMW
:
return
on_tvn_deleteitemw
(
This
,
lParam
);
case
TVN_GETDISPINFOW
:
return
on_tvn_getdispinfow
(
This
,
lParam
);
default:
break
;
}
...
...
@@ -601,15 +626,57 @@ static HRESULT WINAPI NSTC2_fnRemoveRoot(INameSpaceTreeControl2* iface,
IShellItem
*
psiRoot
)
{
NSTC2Impl
*
This
=
(
NSTC2Impl
*
)
iface
;
FIXME
(
"stub, %p (%p)
\n
"
,
This
,
psiRoot
);
return
E_NOTIMPL
;
nstc_root
*
cursor
,
*
root
=
NULL
;
TRACE
(
"%p (%p)
\n
"
,
This
,
psiRoot
);
if
(
!
psiRoot
)
return
E_NOINTERFACE
;
LIST_FOR_EACH_ENTRY
(
cursor
,
&
This
->
roots
,
nstc_root
,
entry
)
{
HRESULT
hr
;
int
order
;
hr
=
IShellItem_Compare
(
psiRoot
,
cursor
->
psi
,
SICHINT_DISPLAY
,
&
order
);
if
(
hr
==
S_OK
)
{
root
=
cursor
;
break
;
}
}
TRACE
(
"root %p
\n
"
,
root
);
if
(
root
)
{
SendMessageW
(
This
->
hwnd_tv
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
root
->
htreeitem
);
events_OnItemDeleted
(
This
,
root
->
psi
,
TRUE
);
list_remove
(
&
root
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
root
);
return
S_OK
;
}
else
{
WARN
(
"No matching root found.
\n
"
);
return
E_FAIL
;
}
}
static
HRESULT
WINAPI
NSTC2_fnRemoveAllRoots
(
INameSpaceTreeControl2
*
iface
)
{
NSTC2Impl
*
This
=
(
NSTC2Impl
*
)
iface
;
FIXME
(
"stub, %p
\n
"
,
This
);
return
E_NOTIMPL
;
nstc_root
*
cur1
,
*
cur2
;
UINT
removed
=
0
;
TRACE
(
"%p
\n
"
,
This
);
LIST_FOR_EACH_ENTRY_SAFE
(
cur1
,
cur2
,
&
This
->
roots
,
nstc_root
,
entry
)
{
NSTC2_fnRemoveRoot
(
iface
,
cur1
->
psi
);
removed
++
;
}
if
(
removed
)
return
S_OK
;
else
return
E_INVALIDARG
;
}
static
HRESULT
WINAPI
NSTC2_fnGetRootItems
(
INameSpaceTreeControl2
*
iface
,
...
...
dlls/explorerframe/tests/nstc.c
View file @
b431995c
...
...
@@ -541,6 +541,12 @@ static void test_basics(void)
ok
(
hr
==
S_OK
,
"Failed to initialize control (0x%08x)
\n
"
,
hr
);
/* Some tests on an uninitialized control */
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
E_INVALIDARG
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
psidesktop
);
ok
(
hr
==
E_FAIL
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
NULL
);
ok
(
hr
==
E_NOINTERFACE
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psidesktop
,
SHCONTF_NONFOLDERS
,
0
,
NULL
);
ok
(
hr
==
E_FAIL
,
"Got (0x%08x)
\n
"
,
hr
);
process_msgs
();
...
...
@@ -763,6 +769,9 @@ static void test_basics(void)
skip
(
"INameSpaceTreeControl2 missing.
\n
"
);
}
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
NULL
);
ok
(
hr
==
E_NOINTERFACE
,
"Got (0x%08x)
\n
"
,
hr
);
/* Append / Insert root */
if
(
0
)
{
...
...
@@ -780,6 +789,23 @@ static void test_basics(void)
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
process_msgs
();
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
psidesktop
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
psidesktop
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
psidesktop
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveRoot
(
pnstc
,
psidesktop
);
ok
(
hr
==
E_FAIL
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
E_INVALIDARG
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_AppendRoot
(
pnstc
,
psidesktop
,
SHCONTF_FOLDERS
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_InsertRoot
(
pnstc
,
0
,
psidesktop
,
SHCONTF_FOLDERS
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_InsertRoot
(
pnstc
,
-
1
,
psidesktop
,
SHCONTF_FOLDERS
,
0
,
NULL
);
...
...
@@ -791,6 +817,9 @@ static void test_basics(void)
hr
=
INameSpaceTreeControl_InsertRoot
(
pnstc
,
1
,
psidesktop
,
SHCONTF_FOLDERS
,
0
,
NULL
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
hr
=
INameSpaceTreeControl_RemoveAllRoots
(
pnstc
);
ok
(
hr
==
S_OK
,
"Got (0x%08x)
\n
"
,
hr
);
IShellItem_Release
(
psidesktop
);
IShellItem_Release
(
psidesktop2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment