Commit be61e161 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by David Fuhrmann

macosx: reload sidebar if the user un-/installs an SD using the addon manager

(cherry picked from commit 708f5f01f54a3e91d67d514d8387db7eeac64dba)
Signed-off-by: default avatarDavid Fuhrmann <dfuhrmann@videolan.org>
parent 8f7e58d2
......@@ -25,6 +25,7 @@
#import "AddonManager.h"
#import "intf.h"
#import "MainWindow.h"
#import "AddonListDataSource.h"
@interface VLCAddonManager ()
......@@ -32,6 +33,7 @@
addons_manager_t *_manager;
NSMutableArray *_addons;
NSArray *_displayedAddons;
BOOL _shouldRefreshSideBarOnAddonChange;
}
- (void)addAddon:(NSValue *)o_value;
......@@ -161,7 +163,7 @@ static VLCAddonManager *_o_sharedInstance = nil;
return;
VLCAddon *currentAddon = [_displayedAddons objectAtIndex:selectedRow];
[self _installAddonWithID:[currentAddon uuid]];
[self _installAddonWithID:[currentAddon uuid] type:[currentAddon type]];
[_installButton setEnabled:NO];
}
......@@ -173,7 +175,7 @@ static VLCAddonManager *_o_sharedInstance = nil;
return;
VLCAddon *currentAddon = [_displayedAddons objectAtIndex:selectedRow];
[self _removeAddonWithID:[currentAddon uuid]];
[self _removeAddonWithID:[currentAddon uuid] type:[currentAddon type]];
[_installButton setEnabled:NO];
}
......@@ -248,6 +250,10 @@ static VLCAddonManager *_o_sharedInstance = nil;
- (void)addonChanged:(NSValue *)o_value
{
[self _refactorDataModel];
if (_shouldRefreshSideBarOnAddonChange) {
[[VLCMainWindow sharedInstance] performSelector:@selector(reloadSidebar) withObject:nil afterDelay:0.5];
_shouldRefreshSideBarOnAddonChange = NO;
}
}
#pragma mark - helpers
......@@ -309,19 +315,25 @@ static VLCAddonManager *_o_sharedInstance = nil;
[self performSelectorOnMainThread:@selector(_refactorDataModel) withObject:nil waitUntilDone:NO];
}
- (void)_installAddonWithID:(NSData *)o_data
- (void)_installAddonWithID:(NSData *)o_data type:(addon_type_t)type
{
addon_uuid_t uuid;
[o_data getBytes:uuid length:sizeof(uuid)];
if (type == ADDON_SERVICE_DISCOVERY)
_shouldRefreshSideBarOnAddonChange = YES;
addons_manager_Install(_manager, uuid);
}
- (void)_removeAddonWithID:(NSData *)o_data
- (void)_removeAddonWithID:(NSData *)o_data type:(addon_type_t)type
{
addon_uuid_t uuid;
[o_data getBytes:uuid length:sizeof(uuid)];
if (type == ADDON_SERVICE_DISCOVERY)
_shouldRefreshSideBarOnAddonChange = YES;
addons_manager_Remove(_manager, uuid);
}
......
......@@ -122,6 +122,8 @@ typedef enum {
- (void)windowResizedOrMoved:(NSNotification *)notification;
- (void)reloadSidebar;
- (void)toggleLeftSubSplitView;
- (void)showDropZone;
- (void)hideDropZone;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment