Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 72032cc7179262d1e255f559db9e4278d6ccb040 @jtbandes committed Aug 31, 2009
@@ -0,0 +1,14 @@
+# From http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
+
+.DS_Store
+*.swp
+*~.nib
+
+build/
+
+*.pbxuser
+*.perspective
+*.perspectivev3
+
+*.mode1v3
+*.mode2v3
@@ -0,0 +1,17 @@
+//
+// DIAppController.h
+// Delete Immediately
+//
+// Created by Jacob Bandes-Storch on 8/30/09.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface DIAppController : NSObject <NSApplicationDelegate> {
+
+}
+
+- (void)deleteImmediately:(NSPasteboard *)pasteboard
+ userData:(NSString *)userData
+ error:(NSString **)error;
+@end
@@ -0,0 +1,74 @@
+//
+// DIAppController.m
+// Delete Immediately
+//
+// Created by Jacob Bandes-Storch on 8/30/09.
+//
+
+#import "DIAppController.h"
+
+@implementation DIAppController
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+ [NSApp setServicesProvider:self];
+}
+
+- (void)deleteImmediately:(NSPasteboard *)pasteboard
+ userData:(NSString *)userData
+ error:(NSString **)error {
+ NSArray *items = nil;
+ NSArray *urlItems = [pasteboard readObjectsForClasses:[NSArray arrayWithObject:[NSURL class]]
+ options:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
+ forKey:NSPasteboardURLReadingFileURLsOnlyKey]];
+ NSMutableArray *new = [NSMutableArray array];
+ for (NSURL *url in urlItems) {
+ [new addObject:[url path]];
+ }
+ items = new;
+ if (items && [items count] > 0) {
+ NSString *messageText;
+ NSString *infoText = NSLocalizedString(@"INFO_SINGLE", @"Deletion info (singular)");
+ if ([items count] > 1) {
+ infoText = NSLocalizedString(@"INFO_MULTIPLE", @"Deletion info (plural)");
+ messageText = NSLocalizedString(@"CONFIRM_DELETE_MULTIPLE", @"Confirm multiple file deletion");
+ } else {
+ messageText = [NSString stringWithFormat:
+ NSLocalizedString(@"CONFIRM_DELETE_SINGLE", @"Confirm single file deletion (with name)"),
+ [[NSFileManager defaultManager] displayNameAtPath:[items objectAtIndex:0]]];
+ }
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DIWarnBeforeDelete"]) {
+ NSAlert *alert = [NSAlert alertWithMessageText:messageText
+ defaultButton:NSLocalizedString(@"CONFIRM_DELETE", @"Confirm delete button")
+ alternateButton:NSLocalizedString(@"DENY_DELETE", @"Deny deletion button")
+ otherButton:nil
+ informativeTextWithFormat:infoText];
+ // [alert setShowsSuppressionButton:YES];
+ // [[alert suppressionButton] setTitle:@"Don’t show this warning again"];
+
+ [NSApp activateIgnoringOtherApps:YES];
+ if ([alert runModal] != NSAlertDefaultReturn) {
+ return; // Don't delete
+ }
+ // Suppression checkbox has no effect if the delete is cancelled
+ // if ([[alert suppressionButton] state] == NSOnState) {
+ // [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"DIWarnBeforeDelete"];
+ // }
+ }
+ for (NSString *path in items) {
+ NSError *error;
+ if (![[NSFileManager defaultManager] removeItemAtPath:path error:&error]) {
+ [NSApp activateIgnoringOtherApps:YES];
+ NSLog(@"Error deleting file at path %@! Error: %@", path, error);
+ [[NSAlert alertWithError:error] runModal];
+ }
+ // This doesn't really seem to work. Oh well.
+ // According to the docs, we're not "normally" supposed to invoke it manually,
+ // but I'm taking that to mean nothing will break outright, and it might work sometimes.
+ [NSApp deactivate];
+ }
+ } else {
+ NSLog(@"Data not available for public.file-url or NSFilenamesPboardType! Available types: %@", [pasteboard types]);
+ }
+}
+
+@end
@@ -0,0 +1,287 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1646D61B104B611600932CE1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1646D618104B611500932CE1 /* main.m */; };
+ 1646D61C104B611600932CE1 /* DIAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1646D61A104B611600932CE1 /* DIAppController.m */; };
+ 1646D7BC104BC8AA00932CE1 /* ServicesMenu.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1646D7BB104BC8AA00932CE1 /* ServicesMenu.strings */; };
+ 1646D7BF104BC98A00932CE1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1646D7BD104BC98A00932CE1 /* Localizable.strings */; };
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+ 1646D618104B611500932CE1 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1646D619104B611500932CE1 /* DIAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DIAppController.h; sourceTree = "<group>"; };
+ 1646D61A104B611600932CE1 /* DIAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DIAppController.m; sourceTree = "<group>"; };
+ 1646D7B9104BC89A00932CE1 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/ServicesMenu.strings; sourceTree = "<group>"; };
+ 1646D7BE104BC98A00932CE1 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 256AC3F00F4B6AF500CF3369 /* Delete Immediately_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Delete Immediately_Prefix.pch"; sourceTree = "<group>"; };
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+ 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8D1107320486CEB800E47090 /* Delete Immediately.service */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Delete Immediately.service"; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D11072E0486CEB800E47090 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 1646D619104B611500932CE1 /* DIAppController.h */,
+ 1646D61A104B611600932CE1 /* DIAppController.m */,
+ );
+ name = Classes;
+ sourceTree = "<group>";
+ };
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+ );
+ name = "Linked Frameworks";
+ sourceTree = "<group>";
+ };
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+ 29B97325FDCFA39411CA2CEA /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107320486CEB800E47090 /* Delete Immediately.service */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* TestService */ = {
+ isa = PBXGroup;
+ children = (
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = TestService;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 1646D618104B611500932CE1 /* main.m */,
+ 256AC3F00F4B6AF500CF3369 /* Delete Immediately_Prefix.pch */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D1107310486CEB800E47090 /* Info.plist */,
+ 1646D7BB104BC8AA00932CE1 /* ServicesMenu.strings */,
+ 1646D7BD104BC98A00932CE1 /* Localizable.strings */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
+ 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 8D1107260486CEB800E47090 /* Delete Immediately */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Delete Immediately" */;
+ buildPhases = (
+ 8D1107290486CEB800E47090 /* Resources */,
+ 8D11072C0486CEB800E47090 /* Sources */,
+ 8D11072E0486CEB800E47090 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "Delete Immediately";
+ productInstallPath = "$(HOME)/Applications";
+ productName = TestService;
+ productReference = 8D1107320486CEB800E47090 /* Delete Immediately.service */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Delete Immediately" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* TestService */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8D1107260486CEB800E47090 /* Delete Immediately */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D1107290486CEB800E47090 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1646D7BC104BC8AA00932CE1 /* ServicesMenu.strings in Resources */,
+ 1646D7BF104BC98A00932CE1 /* Localizable.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D11072C0486CEB800E47090 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1646D61B104B611600932CE1 /* main.m in Sources */,
+ 1646D61C104B611600932CE1 /* DIAppController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 1646D7BB104BC8AA00932CE1 /* ServicesMenu.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1646D7B9104BC89A00932CE1 /* English */,
+ );
+ name = ServicesMenu.strings;
+ sourceTree = "<group>";
+ };
+ 1646D7BD104BC98A00932CE1 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1646D7BE104BC98A00932CE1 /* English */,
+ );
+ name = Localizable.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ C01FCF4B08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ DEPLOYMENT_LOCATION = YES;
+ DSTROOT = /;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "Delete Immediately_Prefix.pch";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Services";
+ PRODUCT_NAME = "Delete Immediately";
+ WRAPPER_EXTENSION = service;
+ };
+ name = Debug;
+ };
+ C01FCF4C08A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DSTROOT = /;
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "Delete Immediately_Prefix.pch";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "$(HOME)/Library/Services";
+ PRODUCT_NAME = "Delete Immediately";
+ WRAPPER_EXTENSION = service;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_VERSION = 4.0;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.6;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = "";
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.6;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Delete Immediately" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4B08A954540054247B /* Debug */,
+ C01FCF4C08A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Delete Immediately" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
Oops, something went wrong.

0 comments on commit 72032cc

Please sign in to comment.