Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inital commit, das Bundle ist ladefaehig
- Loading branch information
Axel Schlueter
committed
Aug 13, 2009
0 parents
commit d1b901a
Showing
14 changed files
with
1,975 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax: regexp | ||
|
||
# die Builds gehoeren nicht ins Repo | ||
^build/.*$ | ||
|
||
# alle dusseligen Swap-Dateien des vim ignorieren | ||
\.swp$ | ||
|
||
# der Mac-Dreck | ||
.DS_Store$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Created by Axel on 13.08.09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface BundlePrincipal: NSObject { | ||
} | ||
|
||
+ (void)load; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Created by Axel on 13.08.09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
|
||
#import "BundlePrincipal.h" | ||
#import <syslog.h> | ||
|
||
|
||
@implementation BundlePrincipal | ||
|
||
+ (void)load { | ||
// let's get some informations about our current host app | ||
NSBundle *hostApp=[NSBundle mainBundle]; | ||
NSString *bundleID=[hostApp bundleIdentifier]; | ||
NSDictionary *infoDict=[hostApp infoDictionary]; | ||
float version=[[infoDict valueForKey:@"CFBundleVersion"] floatValue]; | ||
|
||
// write the host app info to the system log | ||
NSString *msg=[NSString stringWithFormat:@"we were loaded for <%@>, version <%f>",bundleID,version]; | ||
openlog("vImputManager",LOG_CONS|LOG_PID,LOG_USER); | ||
syslog(LOG_NOTICE,[msg UTF8String]); | ||
closelog(); | ||
} | ||
|
||
@end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleIdentifier</key> | ||
<string>de.pqrs.vImputManager</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>NSPrincipalClass</key> | ||
<string>BundlePrincipal</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
Was ist ein InputManager? | ||
|
||
- liegt als Directory in /Library/InputManagers/vImputManager/ | ||
|
||
|
||
- zwei Bestandteile, eine Property-Datei ".../vImputManager/Info" | ||
und dann das eigentliche Cocoa Bundle ".../vImputManager/vImputManager.bundle" | ||
|
||
|
||
- die Property-Datei ist XML: | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> | ||
<plist version="0.9"> | ||
<dict> | ||
<key>BundleName</key> | ||
<string>vImputManager.bundle</string> | ||
<key>LoadBundleOnLaunch</key> | ||
<string>YES</string> | ||
<key>LocalizedNames</key> | ||
<dict> | ||
<key>English</key> | ||
<string>IncrementalSearch</string> | ||
</dict> | ||
<key>NoMenuEntry</key> | ||
<string>YES</string> | ||
</dict> | ||
</plist> | ||
|
||
|
||
- das Bundle ist ein normales Cocoa-Bundle, es sollte "+(void)load" | ||
implementieren. Um an Infos ueber die aktuelle Host-App zu kommen | ||
koennen wir folgendes benutzen: | ||
|
||
[[NSBundle mainBundle] bundleIdentifier] => "com.apple.Safari" | ||
[[NSBundle mainBundle] infoDictionary] => other information | ||
|
||
|
||
- Beispiel-Bundle: | ||
+ (void)load { | ||
NSBundle *hostApp=[NSBundle mainBundle]; | ||
|
||
// check the host app is Safari | ||
NSString *bundleID=[hostApp bundleIdentifier]; | ||
if(![bundleID isEqualToString:@"com.apple.Safari"]) | ||
return; | ||
|
||
// check this version of Safari is supported | ||
NSDictionary *infoDict=[hostApp infoDictionary]; | ||
float v=[[infoDict valueForKey:@"CFBundleVersion"] floatValue]; | ||
if(v<5528.16) { | ||
// TODO: Tell the user why the plugin hasn't loaded | ||
return; | ||
} | ||
|
||
// Initialise your plugin here... | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
|
||
- (void)awakeFromNib { | ||
NSStatusBar *statusBar=[NSStatusBar systemStatusBar]; | ||
|
||
NSStatusItem *statusItem=[statusBar statusItemWithLength:NSVariableStatusItemLength]; | ||
[statusItem retain]; | ||
|
||
NSImage *itemImage = [[NSImage alloc] | ||
initWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"]]; | ||
[statusItem setImage:itemImage]; | ||
[statusItem setHighlightMode:YES]; | ||
[statusItem setMenu:tunesMenu]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
#include <stdio.h> | ||
#include <syslog.h> | ||
|
||
int main(int argc,char **argv) { | ||
openlog("axel",LOG_CONS|LOG_PID,LOG_USER); | ||
syslog(LOG_NOTICE,"and this is another little notice"); | ||
closelog(); | ||
|
||
printf("logging done!\n"); | ||
return 0; | ||
} |
Binary file not shown.
Oops, something went wrong.