Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
1f77da0f
Commit
1f77da0f
authored
May 16, 2017
by
Marvin Scholz
Browse files
macOS: Add ability to copy bookmarks
parent
336846ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/gui/macosx/VLCBookmarksWindowController.m
View file @
1f77da0f
...
...
@@ -427,4 +427,62 @@ clear:
}
}
/* Called when the user hits CMD + C or copy is clicked in the edit menu
*/
-
(
void
)
copy
:(
id
)
sender
{
NSPasteboard
*
pasteBoard
=
[
NSPasteboard
generalPasteboard
];
NSIndexSet
*
selectionIndices
=
[
_dataTable
selectedRowIndexes
];
input_thread_t
*
p_input
=
pl_CurrentInput
(
getIntf
());
int
i_bookmarks
;
seekpoint_t
**
pp_bookmarks
;
if
(
input_Control
(
p_input
,
INPUT_GET_BOOKMARKS
,
&
pp_bookmarks
,
&
i_bookmarks
)
!=
VLC_SUCCESS
)
return
;
[
pasteBoard
clearContents
];
NSUInteger
index
=
[
selectionIndices
firstIndex
];
while
(
index
!=
NSNotFound
)
{
/* Get values */
if
(
index
>=
i_bookmarks
)
break
;
NSString
*
name
=
toNSStr
(
pp_bookmarks
[
index
]
->
psz_name
);
NSString
*
time
=
[
self
timeStringForBookmark
:
pp_bookmarks
[
index
]];
NSString
*
message
=
[
NSString
stringWithFormat
:
@"%@ - %@"
,
name
,
time
];
[
pasteBoard
writeObjects
:@[
message
]];
/* Get next index */
index
=
[
selectionIndices
indexGreaterThanIndex
:
index
];
}
// Clear the bookmark list
for
(
int
i
=
0
;
i
<
i_bookmarks
;
i
++
)
vlc_seekpoint_Delete
(
pp_bookmarks
[
i
]);
free
(
pp_bookmarks
);
}
#pragma mark -
#pragma mark UI validation
/* Validate the copy menu item
*/
-
(
BOOL
)
validateUserInterfaceItem
:(
id
<
NSValidatedUserInterfaceItem
>
)
anItem
{
SEL
theAction
=
[
anItem
action
];
if
(
theAction
==
@selector
(
copy
:
))
{
if
([[
_dataTable
selectedRowIndexes
]
count
]
>
0
)
{
return
YES
;
}
return
NO
;
}
/* Indicate that we handle the validation method,
* even if we don’t implement the action
*/
return
YES
;
}
@end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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