Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contributions for 2ndalpha/gasmask#220 #1

Merged
merged 9 commits into from
Mar 27, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/sparkle-project/Sparkle.git",
"state" : {
"revision" : "7918c1c8fc68baa37917eeaa67286b077ad5e393",
"version" : "1.27.1"
"revision" : "dda155c7d3ef38c53d29f8584cb2aad2a1a54dba",
"version" : "2.3.2"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.8.6</string>
<string>0.8.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -59,7 +59,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>0.8.6</string>
<string>0.8.7</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSUIElement</key>
Expand Down
2 changes: 1 addition & 1 deletion Source/FileUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ @implementation FileUtil
+ (NSString*)dataDirectory
{
if (dataDirectory == nil) {
NSArray *array = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
dataDirectory = [[array objectAtIndex:0] stringByAppendingString:@"/Gas Mask/"];
}
return dataDirectory;
Expand Down
10 changes: 5 additions & 5 deletions Source/HostsListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ @implementation HostsListView

- (void)awakeFromNib
{
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypeString, NSFilenamesPboardType, nil]];
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypeString, NSPasteboardTypeFileURL, nil]];
[self setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES];
[self setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];

[self setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
[self setStyle:NSTableViewStyleSourceList];

NSTableColumn *tableColumn = [self tableColumnWithIdentifier:kColumnIdName];
cell = [[Cell alloc] init];
[cell setEditable:YES];
Expand Down Expand Up @@ -98,15 +98,15 @@ - (void)removeBadgesFromGroups
#pragma mark -
#pragma mark NSDraggingSource

- (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation
- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation
{
// Dragged item ended up in Trash
if (operation == NSDragOperationDelete) {
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:DraggedFileShouldBeRemovedNotification object:nil];
}
else {
[super draggedImage:image endedAt:screenPoint operation:operation];
[super draggingSession:session endedAtPoint:screenPoint operation:operation];
}
}

Expand Down
3 changes: 3 additions & 0 deletions Source/LocalHostsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ - (void)loadFiles
}

[hostsFiles addObject:hosts];
// grossly sorting array every time we add a host? Probably there is a better way.
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES];
[hostsFiles sortUsingDescriptors:[NSArray arrayWithObject:sort]];
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions Source/Util.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ + (BOOL) restartDNSResponder

+ (BOOL) isDarkMode
{
NSAppearance *appearance = NSAppearance.currentAppearance;
return appearance.name == NSAppearanceNameDarkAqua;
NSAppearance *currentAppearance = NSAppearance.currentDrawingAppearance;
if (@available(macOS 10.14, *)) {
return currentAppearance.name == NSAppearanceNameDarkAqua;
} else {
return [[NSColor controlTextColor] isEqual:[NSColor whiteColor]];
}
}

@end