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
8006fd41
Commit
8006fd41
authored
Jun 06, 2016
by
Vincent Povirk
Committed by
Alexandre Julliard
Jun 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explorer: Hide empty folders in the start menu.
Signed-off-by:
Vincent Povirk
<
vincent@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
69caad44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
2 deletions
+59
-2
startmenu.c
programs/explorer/startmenu.c
+59
-2
No files found.
programs/explorer/startmenu.c
View file @
8006fd41
...
...
@@ -131,6 +131,50 @@ static HRESULT pidl_to_shellfolder(LPITEMIDLIST pidl, LPWSTR *displayname, IShel
return
hr
;
}
static
BOOL
shell_folder_is_empty
(
IShellFolder
*
folder
)
{
IEnumIDList
*
enumidl
;
LPITEMIDLIST
pidl
=
NULL
;
if
(
IShellFolder_EnumObjects
(
folder
,
NULL
,
SHCONTF_NONFOLDERS
,
&
enumidl
)
==
S_OK
)
{
if
(
IEnumIDList_Next
(
enumidl
,
1
,
&
pidl
,
NULL
)
==
S_OK
)
{
CoTaskMemFree
(
pidl
);
IEnumIDList_Release
(
enumidl
);
return
FALSE
;
}
IEnumIDList_Release
(
enumidl
);
}
if
(
IShellFolder_EnumObjects
(
folder
,
NULL
,
SHCONTF_FOLDERS
,
&
enumidl
)
==
S_OK
)
{
BOOL
found
=
FALSE
;
IShellFolder
*
child_folder
;
while
(
!
found
&&
IEnumIDList_Next
(
enumidl
,
1
,
&
pidl
,
NULL
)
==
S_OK
)
{
if
(
IShellFolder_BindToObject
(
folder
,
pidl
,
NULL
,
&
IID_IShellFolder
,
(
void
*
)
&
child_folder
)
==
S_OK
)
{
if
(
!
shell_folder_is_empty
(
child_folder
))
found
=
TRUE
;
IShellFolder_Release
(
child_folder
);
}
CoTaskMemFree
(
pidl
);
}
IEnumIDList_Release
(
enumidl
);
if
(
found
)
return
FALSE
;
}
return
TRUE
;
}
/* add an individual file or folder to the menu, takes ownership of pidl */
static
struct
menu_item
*
add_shell_item
(
struct
menu_item
*
parent
,
LPITEMIDLIST
pidl
)
{
...
...
@@ -161,6 +205,15 @@ static struct menu_item* add_shell_item(struct menu_item* parent, LPITEMIDLIST p
IShellFolder_BindToObject
(
parent
->
folder
,
pidl
,
NULL
,
&
IID_IShellFolder
,
(
void
*
)
&
item
->
folder
);
}
if
(
item
->
folder
&&
shell_folder_is_empty
(
item
->
folder
))
{
IShellFolder_Release
(
item
->
folder
);
HeapFree
(
GetProcessHeap
(),
0
,
item
->
displayname
);
HeapFree
(
GetProcessHeap
(),
0
,
item
);
CoTaskMemFree
(
pidl
);
return
NULL
;
}
parent_menu
=
parent
->
menuhandle
;
item
->
parent
=
parent
;
...
...
@@ -411,9 +464,13 @@ void do_startmenu(HWND hwnd)
if
(
!
public_startmenu
.
folder
)
pidl_to_shellfolder
(
public_startmenu
.
pidl
,
NULL
,
&
public_startmenu
.
folder
);
fill_menu
(
&
user_startmenu
);
if
(
!
shell_folder_is_empty
(
user_startmenu
.
folder
)
||
!
shell_folder_is_empty
(
public_startmenu
.
folder
))
{
fill_menu
(
&
user_startmenu
);
AppendMenuW
(
root_menu
.
menuhandle
,
MF_SEPARATOR
,
0
,
NULL
);
AppendMenuW
(
root_menu
.
menuhandle
,
MF_SEPARATOR
,
0
,
NULL
);
}
if
(
SUCCEEDED
(
SHGetSpecialFolderLocation
(
NULL
,
CSIDL_CONTROLS
,
&
pidl
)))
add_shell_item
(
&
root_menu
,
pidl
);
...
...
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