diff options
-rwxr-xr-x | lib/native/mac/libsparkle_init.dylib | bin | 50216 -> 50052 bytes | |||
-rw-r--r-- | src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.h | 4 | ||||
-rw-r--r-- | src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.m | 28 | ||||
-rw-r--r-- | src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java | 56 |
4 files changed, 13 insertions, 75 deletions
diff --git a/lib/native/mac/libsparkle_init.dylib b/lib/native/mac/libsparkle_init.dylib Binary files differindex 37fd706..c50bde7 100755 --- a/lib/native/mac/libsparkle_init.dylib +++ b/lib/native/mac/libsparkle_init.dylib diff --git a/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.h b/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.h index d1b765f..f81b0df 100644 --- a/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.h +++ b/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.h @@ -10,10 +10,10 @@ extern "C" { /* * Class: net_java_sip_communicator_impl_sparkle_SparkleActivator * Method: initSparkle - * Signature: (Ljava/lang/String;ZILjava/lang/String;)V + * Signature: (Ljava/lang/String;ZI)V */ JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_sparkle_SparkleActivator_initSparkle - (JNIEnv *, jclass, jstring, jboolean, jint, jstring); + (JNIEnv *, jclass, jstring, jboolean, jint); #ifdef __cplusplus } diff --git a/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.m b/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.m index f5d4126..c5df1a9 100644 --- a/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.m +++ b/src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.m @@ -16,7 +16,7 @@ * installed in /Library/Frameworks/. This Framework is * available at http://sparkle.andymatuschak.org/ * - * @author Romain Kuntz + * @author Romain Kuntz * @author Egidijus Jankauskas */ @@ -27,21 +27,21 @@ /* * Class: net_java_sip_communicator_impl_sparkle_SparkleActivator * Method: initSparkle - * Signature: (Ljava/lang/String;ZILjava/lang/String;)V + * Signature: (Ljava/lang/String;ZI)V */ JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_sparkle_SparkleActivator_initSparkle (JNIEnv *env, jclass obj, jstring pathToSparkleFramework, - jboolean updateAtStartup, jint checkInterval, jstring downloadLink) + jboolean updateAtStartup, jint checkInterval) { BOOL hasLaunchedBefore = [[NSUserDefaults standardUserDefaults] boolForKey:@"SCHasLaunchedBefore"]; - + if(!hasLaunchedBefore) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"SCHasLaunchedBefore"]; [[NSUserDefaults standardUserDefaults] synchronize]; } - + // The below code was used to avoid to link the Sparkle framework // at comilation time. //const char *path = (*env)->GetStringUTFChars(env, pathToSparkleFramework, 0); @@ -49,21 +49,9 @@ Java_net_java_sip_communicator_impl_sparkle_SparkleActivator_initSparkle //Class suUpdaterClass = [bundle classNamed:@"SUUpdater"]; //id suUpdater = [[suUpdaterClass alloc] init]; //(*env)->ReleaseStringUTFChars(env, pathToSparkleFramework, path); - + SUUpdater *suUpdater = [SUUpdater updaterForBundle:[NSBundle mainBundle]]; - - if(downloadLink) - { - const char* link = (*env)->GetStringUTFChars(env, downloadLink, 0); - NSString* sLink = [NSString stringWithCString: link length: strlen(link)]; - NSURL* nsLink = [NSURL URLWithString: sLink]; - - if(nsLink) - { - [suUpdater setFeedURL: nsLink]; - } - } - + NSMenu* menu = [[NSApplication sharedApplication] mainMenu]; NSMenu* applicationMenu = [[menu itemAtIndex:0] submenu]; NSMenuItem* checkForUpdatesMenuItem = [[NSMenuItem alloc] @@ -73,7 +61,7 @@ Java_net_java_sip_communicator_impl_sparkle_SparkleActivator_initSparkle [checkForUpdatesMenuItem setEnabled:YES]; [checkForUpdatesMenuItem setTarget:suUpdater]; - + // 0 => top, 1 => after "About..." [applicationMenu insertItem:checkForUpdatesMenuItem atIndex:1]; diff --git a/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java b/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java index 7310907..8a98b5f 100644 --- a/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java +++ b/src/net/java/sip/communicator/impl/sparkle/SparkleActivator.java @@ -7,8 +7,6 @@ package net.java.sip.communicator.impl.sparkle; import org.osgi.framework.*; - -import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.util.*; /** @@ -25,31 +23,16 @@ public class SparkleActivator private static Logger logger = Logger.getLogger(SparkleActivator.class); /** - * A reference to the ConfigurationService implementation instance that - * is currently registered with the bundle context. - */ - private static ConfigurationService configurationService = null; - - /** - * The current BundleContext. - */ - private static BundleContext bundleContext = null; - - /** * Native method declaration * * @param pathToSparkleFramework the path to the Sparkle framerok * @param updateAtStartup specifies whether Sparkle should be checking for * updates on startup. * @param checkInterval specifies an interval for the update checks. - * @param downloadLink a custom download link for sparkle (i.e. the - * SUFeedURL). If null the default URL will be choosen (the - * SUFeedURL parameter in the .app/Contents/Info.pList). */ public native static void initSparkle(String pathToSparkleFramework, boolean updateAtStartup, - int checkInterval, - String downloadLink); + int checkInterval); /** * Whether updates are checked at startup @@ -68,21 +51,13 @@ public class SparkleActivator private static boolean sparkleLibLoaded = false; /** - * Property name for the update link in the configuration file. - */ - private static final String PROP_UPDATE_LINK = - "net.java.sip.communicator.UPDATE_LINK"; - - /** * Initialize and start Sparkle * * @param bundleContext BundleContext - * @throws Exception if something goes wrong during sparkle initialization + * @throws Exception */ public void start(BundleContext bundleContext) throws Exception { - SparkleActivator.bundleContext = bundleContext; - /** * Dynamically loads JNI object. Will fail if non-MacOSX * or when libinit_sparkle.dylib is outside of the LD_LIBRARY_PATH @@ -104,14 +79,10 @@ public class SparkleActivator return; } - String downloadLink = getConfigurationService().getString( - PROP_UPDATE_LINK); - - System.out.println("download link is: " + downloadLink); // TODO: better way to get the Sparkle Framework path? initSparkle(System.getProperty("user.dir") + "/../../Frameworks/Sparkle.framework", - updateAtStartup, checkInterval, downloadLink); + updateAtStartup, checkInterval); if (logger.isInfoEnabled()) logger.info("Sparkle Plugin ...[Started]"); } @@ -126,28 +97,7 @@ public class SparkleActivator */ public void stop(BundleContext bundleContext) throws Exception { - bundleContext = null; if (logger.isInfoEnabled()) logger.info("Sparkle Plugin ...[Stopped]"); } - - /** - * Returns a reference to a ConfigurationService implementation currently - * registered in the bundle context or null if no such implementation was - * found. - * - * @return a currently valid implementation of the ConfigurationService. - */ - public static ConfigurationService getConfigurationService() - { - if (configurationService == null) - { - ServiceReference confReference - = bundleContext.getServiceReference( - ConfigurationService.class.getName()); - configurationService - = (ConfigurationService)bundleContext.getService(confReference); - } - return configurationService; - } } |