diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-07-18 15:51:29 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-07-20 22:04:18 -0700 |
commit | be4dd35ffecbf49aff13aa9f604a44c9b665ae92 (patch) | |
tree | a2fd5be944f95ff6da8e36d675f1d44a338e52ac /hw | |
parent | 2415e2dce918efd49d5e6d71f705255a234a866b (diff) |
XQuartz: Initial support for automatic updates through Sparkle
(cherry picked from commit c45f1be36426bceeef9af67c26351114f14f5277)
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xquartz/X11Application.h | 2 | ||||
-rw-r--r-- | hw/xquartz/X11Application.m | 36 | ||||
-rw-r--r-- | hw/xquartz/bundle/Info.plist.cpp | 8 | ||||
-rw-r--r-- | hw/xquartz/bundle/Makefile.am | 4 | ||||
-rw-r--r-- | hw/xquartz/mach-startup/Makefile.am | 5 |
5 files changed, 54 insertions, 1 deletions
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h index 80aee5932..c02073eb6 100644 --- a/hw/xquartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -47,6 +47,7 @@ - (const char *) prefs_get_string:(NSString *)key default:(const char *)def; - (float) prefs_get_float:(NSString *)key default:(float)def; - (int) prefs_get_boolean:(NSString *)key default:(int)def; +- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def; - (NSArray *) prefs_get_array:(NSString *)key; - (void) prefs_set_integer:(NSString *)key value:(int)value; - (void) prefs_set_float:(NSString *)key value:(float)value; @@ -95,6 +96,7 @@ extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu; #define PREFS_TEST_EXTENSIONS "enable_test_extensions" #define PREFS_XP_OPTIONS "xp_options" #define PREFS_LOGIN_SHELL "login_shell" +#define PREFS_UPDATE_FEED "update_feed" #define PREFS_CLICK_THROUGH "wm_click_through" #define PREFS_FFM "wm_ffm" #define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window" diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index b31634de0..736d4e61e 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -50,6 +50,10 @@ #include <unistd.h> #include <AvailabilityMacros.h> +#ifdef XQUARTZ_SPARKLE +#include <Sparkle/SUUpdater.h> +#endif + #include <Xplugin.h> // pbproxy/pbproxy.h @@ -585,6 +589,23 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { return ret != NULL ? ret : def; } +- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def { + CFPropertyListRef value; + NSURL *ret = NULL; + + value = [self prefs_get:key]; + + if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) { + NSString *s = (NSString *) value; + + ret = [NSURL URLWithString:s]; + } + + if (value != NULL) CFRelease (value); + + return ret != NULL ? ret : def; +} + - (float) prefs_get_float:(NSString *)key default:(float)def { CFPropertyListRef value; float ret = def; @@ -746,6 +767,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS default:FALSE]; + +#if XQUARTZ_SPARKLE + NSURL *url = [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil]; + if(url) { + [[SUUpdater sharedUpdater] setFeedURL:url]; + CFRelease(url); + } +#endif } /* This will end up at the end of the responder chain. */ @@ -935,7 +964,12 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { if(!xpbproxy_init()) fprintf(stderr, "Error initializing xpbproxy\n"); - + +#if XQUARTZ_SPARKLE + [[SUUpdater sharedUpdater] resetUpdateCycle]; +// [[SUUpdater sharedUpdater] checkForUpdates:X11App]; +#endif + [NSApp run]; /* not reached */ } diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp index 90628161d..6d951ada8 100644 --- a/hw/xquartz/bundle/Info.plist.cpp +++ b/hw/xquartz/bundle/Info.plist.cpp @@ -26,6 +26,14 @@ <string>x11a</string> <key>CSResourcesFileMapped</key> <true/> +#ifdef XQUARTZ_SPARKLE + <key>SUEnableAutomaticChecks</key> + <true/> + <key>SUPublicDSAKeyFile</key> + <string>sparkle.pem</string> + <key>SUFeedURL</key> + <string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string> +#endif <key>NSHumanReadableCopyright</key> <string>© 2003-2009 Apple Inc. © 2003 XFree86 Project, Inc. diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am index 963327bb9..ea02cd620 100644 --- a/hw/xquartz/bundle/Makefile.am +++ b/hw/xquartz/bundle/Makefile.am @@ -4,6 +4,10 @@ CPP_FILES_FLAGS = \ -DAPPLE_APPLICATION_ID="$(APPLE_APPLICATION_ID)" \ -DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)" +if XQUARTZ_SPARKLE +CPP_FILES_FLAGS += -DXQUARTZ_SPARKLE +endif + install-data-hook: $(srcdir)/mk_bundke.sh $(srcdir) $(builddir) $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am index 0c609e384..2901b6559 100644 --- a/hw/xquartz/mach-startup/Makefile.am +++ b/hw/xquartz/mach-startup/Makefile.am @@ -39,6 +39,11 @@ X11_bin_LDFLAGS += \ -Wl,-framework,OpenGL endif +if XQUARTZ_SPARKLE +X11_bin_LDFLAGS += \ + -Wl,-framework,Sparkle +endif + if RECORD X11_bin_LDADD += \ $(top_builddir)/record/librecord.la |