Permalink
Browse files

Added some hooks so that extras can have their class loaded at startu…

…p, and be given the opportunity to mess with the UI.
  • Loading branch information...
1 parent dc79693 commit 9db46e0460a0a28c6e4eb704800db8839d0fdfdf @ccgus committed Nov 5, 2011
Showing with 12 additions and 4 deletions.
  1. +2 −1 src/JSTAppDelegate.m
  2. +4 −0 src/JSTDocument.m
  3. +1 −0 src/JSTalk.h
  4. +5 −3 src/JSTalk.m
View
@@ -24,7 +24,6 @@ @implementation JSTAppDelegate
+ (void)initialize {
-
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@@ -55,6 +54,8 @@ - (void)awakeFromNib {
// have all the services menus get updated.
//NSUpdateDynamicServices();
+
+ [JSTalk loadPlugins]; // some guys will setup custom UI in the app.
}
- (IBAction)showPrefs:(id)sender {
View
@@ -44,6 +44,10 @@ - (void)dealloc {
[super dealloc];
}
++ (BOOL)autosavesInPlace {
+ // defaults write org.jstalk.JSTalkEditor autosavesInPlace 1
+ return [[NSUserDefaults standardUserDefaults] boolForKey:@"autosavesInPlace"];
+}
- (NSString *)windowNibName {
return @"JSTDocument";
View
@@ -32,6 +32,7 @@
+ (void)listen;
+ (void)resetPlugins;
++ (void)loadPlugins;
+ (void)setShouldLoadJSTPlugins:(BOOL)b;
+ (id)application:(NSString*)app;
+ (id)app:(NSString*)app;
View
@@ -75,7 +75,7 @@ - (void)dealloc {
[super dealloc];
}
-- (void)loadExtraAtPath:(NSString*)fullPath {
++ (void)loadExtraAtPath:(NSString*)fullPath {
Class pluginClass;
@@ -93,6 +93,8 @@ - (void)loadExtraAtPath:(NSString*)fullPath {
return;
}
+ [principalClassName class]; // force loading of it.
+
NSError *err = 0x00;
[pluginBundle loadAndReturnError:&err];
@@ -129,7 +131,7 @@ + (void)resetPlugins {
JSTalkPluginList = 0x00;
}
-- (void)loadPlugins {
++ (void)loadPlugins {
// install plugins that were passed via the command line
int i = 0;
@@ -227,7 +229,7 @@ - (void)deleteObjectWithName:(NSString*)name {
- (id)executeString:(NSString*)str {
if (!JSTalkPluginList && JSTalkShouldLoadJSTPlugins) {
- [self loadPlugins];
+ [JSTalk loadPlugins];
}
if (_shouldPreprocess) {

0 comments on commit 9db46e0

Please sign in to comment.