XQuartz: Improve type safety for X11Controller's application menu editor
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
parent
dfd057996b
commit
4cfdc5af31
|
@ -62,8 +62,8 @@ extern char *bundle_id_prefix;
|
||||||
@property (nonatomic, readwrite, strong) NSMenuItem *check_for_updates_item; // Programatically enabled
|
@property (nonatomic, readwrite, strong) NSMenuItem *check_for_updates_item; // Programatically enabled
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@property (nonatomic, readwrite, strong) NSArray *apps;
|
@property (nonatomic, readwrite, strong) NSArray <NSArray <NSString *> *> *apps;
|
||||||
@property (nonatomic, readwrite, strong) NSMutableArray *table_apps;
|
@property (nonatomic, readwrite, strong) NSMutableArray <NSMutableArray <NSString *> *> *table_apps;
|
||||||
@property (nonatomic, readwrite, assign) NSInteger windows_menu_nitems;
|
@property (nonatomic, readwrite, assign) NSInteger windows_menu_nitems;
|
||||||
@property (nonatomic, readwrite, assign) int checked_window_item;
|
@property (nonatomic, readwrite, assign) int checked_window_item;
|
||||||
@property (nonatomic, readwrite, assign) x_list *pending_apps;
|
@property (nonatomic, readwrite, assign) x_list *pending_apps;
|
||||||
|
@ -155,10 +155,10 @@ extern char *bundle_id_prefix;
|
||||||
self.apps = nil;
|
self.apps = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) prepend_apps_item:(NSArray *)list index:(int)i menu:(NSMenu *)menu
|
- (void) prepend_apps_item:(NSArray <NSArray <NSString *> *> *)list index:(int)i menu:(NSMenu *)menu
|
||||||
{
|
{
|
||||||
NSString *title, *shortcut = @"";
|
NSString *title, *shortcut = @"";
|
||||||
NSArray *group;
|
NSArray <NSString *> *group;
|
||||||
NSMenuItem *item;
|
NSMenuItem *item;
|
||||||
|
|
||||||
group = [list objectAtIndex:i];
|
group = [list objectAtIndex:i];
|
||||||
|
@ -182,7 +182,7 @@ extern char *bundle_id_prefix;
|
||||||
[item setTag:i + 1]; /* can't be zero, so add one */
|
[item setTag:i + 1]; /* can't be zero, so add one */
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) install_apps_menu:(NSArray *)list
|
- (void) install_apps_menu:(NSArray <NSArray <NSString *> *> *)list
|
||||||
{
|
{
|
||||||
NSMenu *menu;
|
NSMenu *menu;
|
||||||
int i, count;
|
int i, count;
|
||||||
|
@ -206,7 +206,7 @@ extern char *bundle_id_prefix;
|
||||||
self.apps = list;
|
self.apps = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_window_menu:(NSArray *)list
|
- (void) set_window_menu:(NSArray <NSArray <NSString *> *> *)list
|
||||||
{
|
{
|
||||||
NSMenu * const menu = X11App.windowsMenu;
|
NSMenu * const menu = X11App.windowsMenu;
|
||||||
NSMenu * const dock_menu = self.dock_menu;
|
NSMenu * const dock_menu = self.dock_menu;
|
||||||
|
@ -302,7 +302,7 @@ extern char *bundle_id_prefix;
|
||||||
self.checked_window_item = n;
|
self.checked_window_item = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_apps_menu:(NSArray *)list
|
- (void) set_apps_menu:(NSArray <NSArray <NSString *> *> *)list
|
||||||
{
|
{
|
||||||
[self remove_apps_menu];
|
[self remove_apps_menu];
|
||||||
[self install_apps_menu:list];
|
[self install_apps_menu:list];
|
||||||
|
@ -448,7 +448,7 @@ extern char *bundle_id_prefix;
|
||||||
{
|
{
|
||||||
int tag;
|
int tag;
|
||||||
NSString *item;
|
NSString *item;
|
||||||
NSArray * const apps = self.apps;
|
NSArray <NSArray <NSString *> *> * const apps = self.apps;
|
||||||
|
|
||||||
tag = [sender tag] - 1;
|
tag = [sender tag] - 1;
|
||||||
if (apps == nil || tag < 0 || tag >= [apps count])
|
if (apps == nil || tag < 0 || tag >= [apps count])
|
||||||
|
@ -462,13 +462,13 @@ extern char *bundle_id_prefix;
|
||||||
- (IBAction) apps_table_show:sender
|
- (IBAction) apps_table_show:sender
|
||||||
{
|
{
|
||||||
NSArray *columns;
|
NSArray *columns;
|
||||||
NSMutableArray *oldapps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const oldapps = self.table_apps;
|
||||||
NSTableView * const apps_table = self.apps_table;
|
NSTableView * const apps_table = self.apps_table;
|
||||||
|
|
||||||
NSMutableArray * const table_apps = [[NSMutableArray alloc] initWithCapacity:1];
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = [[NSMutableArray alloc] initWithCapacity:1];
|
||||||
self.table_apps = table_apps;
|
self.table_apps = table_apps;
|
||||||
|
|
||||||
NSArray * const apps = self.apps;
|
NSArray <NSArray <NSString *> *> * const apps = self.apps;
|
||||||
if (apps != nil) {
|
if (apps != nil) {
|
||||||
for (NSArray <NSString *> * row in apps) {
|
for (NSArray <NSString *> * row in apps) {
|
||||||
[table_apps addObject:row.mutableCopy];
|
[table_apps addObject:row.mutableCopy];
|
||||||
|
@ -492,7 +492,7 @@ extern char *bundle_id_prefix;
|
||||||
|
|
||||||
- (IBAction) apps_table_done:sender
|
- (IBAction) apps_table_done:sender
|
||||||
{
|
{
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
NSTableView * const apps_table = self.apps_table;
|
NSTableView * const apps_table = self.apps_table;
|
||||||
[apps_table deselectAll:sender]; /* flush edits? */
|
[apps_table deselectAll:sender]; /* flush edits? */
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ extern char *bundle_id_prefix;
|
||||||
- (IBAction) apps_table_new:sender
|
- (IBAction) apps_table_new:sender
|
||||||
{
|
{
|
||||||
NSMutableArray *item;
|
NSMutableArray *item;
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
NSTableView * const apps_table = self.apps_table;
|
NSTableView * const apps_table = self.apps_table;
|
||||||
|
|
||||||
int row = [apps_table selectedRow], i;
|
int row = [apps_table selectedRow], i;
|
||||||
|
@ -539,10 +539,10 @@ extern char *bundle_id_prefix;
|
||||||
|
|
||||||
- (IBAction) apps_table_duplicate:sender
|
- (IBAction) apps_table_duplicate:sender
|
||||||
{
|
{
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
NSTableView * const apps_table = self.apps_table;
|
NSTableView * const apps_table = self.apps_table;
|
||||||
int row = [apps_table selectedRow], i;
|
int row = [apps_table selectedRow], i;
|
||||||
NSObject *item;
|
NSMutableArray <NSString *> *item;
|
||||||
|
|
||||||
if (row < 0) {
|
if (row < 0) {
|
||||||
[self apps_table_new:sender];
|
[self apps_table_new:sender];
|
||||||
|
@ -565,7 +565,7 @@ extern char *bundle_id_prefix;
|
||||||
|
|
||||||
- (IBAction) apps_table_delete:sender
|
- (IBAction) apps_table_delete:sender
|
||||||
{
|
{
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
NSTableView * const apps_table = self.apps_table;
|
NSTableView * const apps_table = self.apps_table;
|
||||||
int row = [apps_table selectedRow];
|
int row = [apps_table selectedRow];
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ extern char *bundle_id_prefix;
|
||||||
|
|
||||||
- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
|
- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
|
||||||
{
|
{
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
if (table_apps == nil) return 0;
|
if (table_apps == nil) return 0;
|
||||||
|
|
||||||
return [table_apps count];
|
return [table_apps count];
|
||||||
|
@ -598,7 +598,7 @@ extern char *bundle_id_prefix;
|
||||||
- (id) tableView:(NSTableView *)tableView
|
- (id) tableView:(NSTableView *)tableView
|
||||||
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||||
{
|
{
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
NSArray *item;
|
NSArray *item;
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
|
@ -616,8 +616,8 @@ extern char *bundle_id_prefix;
|
||||||
- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
|
- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
|
||||||
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||||
{
|
{
|
||||||
NSMutableArray * const table_apps = self.table_apps;
|
NSMutableArray <NSMutableArray <NSString *> *> * const table_apps = self.table_apps;
|
||||||
NSMutableArray *item;
|
NSMutableArray <NSString *> *item;
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
if (table_apps == nil) return;
|
if (table_apps == nil) return;
|
||||||
|
|
Loading…
Reference in New Issue