aboutsummaryrefslogtreecommitdiffstats
path: root/src/native/macosx
diff options
context:
space:
mode:
authorSebastien Vincent <seb@jitsi.org>2010-10-04 09:27:20 +0000
committerSebastien Vincent <seb@jitsi.org>2010-10-04 09:27:20 +0000
commitf7078b197ba877dc981592b927886f8d9a7fd143 (patch)
tree2a72f902e80b5a0a6e2a6bafe7b3001807b11bc5 /src/native/macosx
parent23cd620acccc8e7945c54bf7c8d387519b872560 (diff)
downloadjitsi-f7078b197ba877dc981592b927886f8d9a7fd143.zip
jitsi-f7078b197ba877dc981592b927886f8d9a7fd143.tar.gz
jitsi-f7078b197ba877dc981592b927886f8d9a7fd143.tar.bz2
If an update link is provided by provisioning configuration, use it instead of default ones.
Diffstat (limited to 'src/native/macosx')
-rw-r--r--src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.h4
-rw-r--r--src/native/macosx/sparkle/net_java_sip_communicator_impl_sparkle_SparkleActivator.m28
2 files changed, 22 insertions, 10 deletions
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 f81b0df..d1b765f 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;ZI)V
+ * Signature: (Ljava/lang/String;ZILjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_sparkle_SparkleActivator_initSparkle
- (JNIEnv *, jclass, jstring, jboolean, jint);
+ (JNIEnv *, jclass, jstring, jboolean, jint, jstring);
#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 c5df1a9..f5d4126 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;ZI)V
+ * Signature: (Ljava/lang/String;ZILjava/lang/String;)V
*/
JNIEXPORT void JNICALL
Java_net_java_sip_communicator_impl_sparkle_SparkleActivator_initSparkle
(JNIEnv *env, jclass obj, jstring pathToSparkleFramework,
- jboolean updateAtStartup, jint checkInterval)
+ jboolean updateAtStartup, jint checkInterval, jstring downloadLink)
{
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,9 +49,21 @@ 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]
@@ -61,7 +73,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];