Commit 6424a7eb authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: remove duplicate code by using the same IBAction for both Prefs Reset buttons

parent df97baf7
......@@ -50,7 +50,6 @@
- (void)showPrefsWithLevel:(NSInteger)i_window_level;
- (IBAction)savePrefs: (id)sender;
- (IBAction)closePrefs: (id)sender;
- (IBAction)resetAll: (id)sender;
- (IBAction)buttonAction: (id)sender;
@end
......
......@@ -224,30 +224,6 @@ static VLCPrefs *_o_sharedMainInstance = nil;
[o_prefs_window orderOut:self];
}
- (IBAction)resetAll: (id)sender
{
NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, o_prefs_window, self,
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
_NS("Beware this will reset the VLC media player preferences.\n"
"Are you sure you want to continue?"));
}
- (void)sheetDidEnd:(NSWindow *)o_sheet returnCode:(int)i_return
contextInfo:(void *)o_context
{
if (i_return == NSAlertAlternateReturn) {
/* reset VLC's config */
config_ResetAll(p_intf);
[_rootTreeItem resetView];
config_SaveConfigFile(p_intf);
/* reset OS X defaults */
[NSUserDefaults resetStandardUserDefaults];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
- (IBAction)buttonAction: (id)sender
{
[o_prefs_window orderOut: self];
......
......@@ -208,6 +208,7 @@
- (void)showSimplePrefsWithLevel:(NSInteger)i_window_level;
- (IBAction)buttonAction:(id)sender;
- (IBAction)resetPreferences:(id)sender;
- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context;
......
......@@ -682,23 +682,26 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
[self saveChangedSettings];
[[NSFontPanel sharedFontPanel] close];
[o_sprefs_win orderOut: sender];
} else if (sender == o_sprefs_reset_btn)
NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, o_sprefs_win, self,
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
_NS("This will reset VLC media player's preferences.\n\n"
"Note that VLC will restart during the process, so your current "
"playlist will be emptied and eventual playback, streaming or "
"transcoding activities will stop immediately.\n\n"
"The Media Library will not be affected.\n\n"
"Are you sure you want to continue?"));
else if (sender == o_sprefs_showAll_btn) {
} else if (sender == o_sprefs_showAll_btn) {
[o_sprefs_win orderOut: self];
[[[VLCMain sharedInstance] preferences] showPrefsWithLevel:[o_sprefs_win level]];
} else
msg_Warn(p_intf, "unknown buttonAction sender");
}
- (IBAction)resetPreferences:(NSControl *)sender
{
NSBeginInformationalAlertSheet(_NS("Reset Preferences"), _NS("Cancel"),
_NS("Continue"), nil, [sender window], self,
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, @"%@",
_NS("This will reset VLC media player's preferences.\n\n"
"Note that VLC will restart during the process, so your current "
"playlist will be emptied and eventual playback, streaming or "
"transcoding activities will stop immediately.\n\n"
"The Media Library will not be affected.\n\n"
"Are you sure you want to continue?"));
}
- (void)sheetDidEnd:(NSWindow *)o_sheet
returnCode:(int)i_return
contextInfo:(void *)o_context
......
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