Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
13d8a3f1
Commit
13d8a3f1
authored
Nov 23, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOSX/Framework/VLCMediaListAspect.m: Update the cachedMedia array.
parent
c721c836
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
extras/MacOSX/Framework/Sources/VLCMediaListAspect.m
extras/MacOSX/Framework/Sources/VLCMediaListAspect.m
+30
-4
No files found.
extras/MacOSX/Framework/Sources/VLCMediaListAspect.m
View file @
13d8a3f1
...
@@ -33,6 +33,9 @@
...
@@ -33,6 +33,9 @@
@interface
VLCMediaListAspect
(
Private
)
@interface
VLCMediaListAspect
(
Private
)
/* Initializers */
/* Initializers */
-
(
void
)
initInternalMediaListView
;
-
(
void
)
initInternalMediaListView
;
-
(
void
)
mediaListViewItemAdded
:(
NSDictionary
*
)
args
;
-
(
void
)
mediaListViewItemRemoved
:(
NSNumber
*
)
index
;
@end
@end
@implementation
VLCMediaListAspect
(
KeyValueCodingCompliance
)
@implementation
VLCMediaListAspect
(
KeyValueCodingCompliance
)
...
@@ -52,16 +55,22 @@ static void HandleMediaListViewItemAdded(const libvlc_event_t *event, void *user
...
@@ -52,16 +55,22 @@ static void HandleMediaListViewItemAdded(const libvlc_event_t *event, void *user
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
id
self
=
user_data
;
id
self
=
user_data
;
int
index
=
event
->
u
.
media_list_view_item_added
.
index
;
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
[
self
didChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"media"
];
withMethod:
@selector
(
mediaListViewItemAdded
:)
withArgumentAsObject:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
event
->
u
.
media_list_item_added
.
item
],
@"media"
,
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_added
.
index
],
@"index"
,
nil
]];
[
pool
release
];
[
pool
release
];
}
}
static
void
HandleMediaListViewItemDeleted
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
static
void
HandleMediaListViewItemDeleted
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
id
self
=
user_data
;
id
self
=
user_data
;
int
index
=
event
->
u
.
media_list_view_item_deleted
.
index
;
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
[
self
didChange
:
NSKeyValueChangeRemoval
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"media"
];
withMethod:
@selector
(
mediaListViewItemRemoved
:)
withArgumentAsObject:
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_deleted
.
index
]];
[
pool
release
];
[
pool
release
];
}
}
...
@@ -142,5 +151,22 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
...
@@ -142,5 +151,22 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
libvlc_event_attach
(
p_em
,
libvlc_MediaListViewItemDeleted
,
HandleMediaListViewItemDeleted
,
self
,
&
e
);
libvlc_event_attach
(
p_em
,
libvlc_MediaListViewItemDeleted
,
HandleMediaListViewItemDeleted
,
self
,
&
e
);
quit_on_exception
(
&
e
);
quit_on_exception
(
&
e
);
}
}
-
(
void
)
mediaListViewItemAdded
:(
NSDictionary
*
)
args
{
int
index
=
[[
args
objectForKey
:
@"index"
]
intValue
];
VLCMedia
*
media
=
[
args
objectForKey
:
@"media"
];
[
self
willChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"media"
];
[
cachedMedia
insertObject
:
media
atIndex
:
index
];
[
self
didChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"media"
];
}
-
(
void
)
mediaListViewItemRemoved
:(
NSNumber
*
)
index
{
[
self
willChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:[
index
intValue
]]
forKey
:
@"media"
];
[
cachedMedia
removeObjectAtIndex
:[
index
intValue
]];
[
self
didChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:[
index
intValue
]]
forKey
:
@"media"
];
}
@end
@end
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