diff --git a/CMakeLists.txt b/CMakeLists.txt index d7b77ff21..3045895b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,11 @@ find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h) if (APPLE) find_library(GROWL Growl) + option(ENABLE_SPARKLE "Sparkle updating" ON) find_library(SPARKLE Sparkle) + if (ENABLE_SPARKLE AND SPARKLE) + set(HAVE_SPARKLE ON) + endif (ENABLE_SPARKLE AND SPARKLE) # Uses Darwin kernel version. # 9.8.0 -> 10.5/Leopard # 10.4.0 -> 10.6/Snow Leopard @@ -258,4 +262,5 @@ summary_add("devices: GIO backend" HAVE_GIO) summary_add("Gnome sound menu integration" HAVE_LIBINDICATE) summary_add("Wiimote support" ENABLE_WIIMOTEDEV) summary_add("Visualisations" ENABLE_VISUALISATIONS) +summary_add("Sparkle integration" HAVE_SPARKLE) summary_show() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6cdff072e..d50ee2d66 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,7 +4,6 @@ set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-Woverloaded-virtual -Wall -Wno-sign-compare ${CMAKE_CXX_FLAGS}") include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${SPARKLE}) include_directories(../3rdparty/gmock/gtest/include) if(WIN32) include_directories(../3rdparty/qtwin) @@ -809,14 +808,16 @@ endif(HAVE_LIBINDICATE) if (APPLE) target_link_libraries(clementine_lib ${GROWL} - ${SPARKLE} /System/Library/Frameworks/AppKit.framework /System/Library/Frameworks/Carbon.framework /System/Library/Frameworks/DiskArbitration.framework /System/Library/Frameworks/Foundation.framework /System/Library/Frameworks/IOKit.framework ) - include_directories(${SPARKLE}/Headers) + if (HAVE_SPARKLE) + include_directories(${SPARKLE}/Headers) + target_link_libraries(${SPARKLE}) + endif (HAVE_SPARKLE) else (APPLE) target_link_libraries(clementine_lib ${QXT_LIBRARIES}) endif (APPLE) @@ -888,8 +889,12 @@ if (APPLE) install(DIRECTORY "${QT_QTGUI_LIBRARY_RELEASE}/Versions/Current/Resources/" DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Resources") - install(DIRECTORY "${SPARKLE}/Versions/Current/Resources" - DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/Sparkle.framework") + + if (HAVE_SPARKLE) + install(DIRECTORY "${SPARKLE}/Versions/Current/Resources" + DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/Sparkle.framework") + endif (HAVE_SPARKLE) + install(DIRECTORY "${GROWL}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/Growl.framework") diff --git a/src/config.h.in b/src/config.h.in index 5ec3eefcf..e6b976034 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -32,6 +32,7 @@ #cmakedefine SNOW_LEOPARD #cmakedefine LEOPARD +#cmakedefine HAVE_SPARKLE #cmakedefine HAVE_GSTREAMER #cmakedefine HAVE_LIBVLC diff --git a/src/core/mac_startup.mm b/src/core/mac_startup.mm index 4973d439b..1dd2f6368 100644 --- a/src/core/mac_startup.mm +++ b/src/core/mac_startup.mm @@ -29,7 +29,6 @@ #import #import #import -#import #import @@ -39,6 +38,10 @@ #include "macglobalshortcutbackend.h" #include "utilities.h" +#ifdef HAVE_SPARKLE +#import +#endif + #include #include #include @@ -177,8 +180,10 @@ void MacMain() { [[NSAutoreleasePool alloc] init]; // Creates and sets the magic global variable so QApplication will find it. [MacApplication sharedApplication]; - // Creates and sets the magic global variable for Sparkle. - [[SUUpdater sharedUpdater] setDelegate: NSApp]; + #ifdef HAVE_SPARKLE + // Creates and sets the magic global variable for Sparkle. + [[SUUpdater sharedUpdater] setDelegate: NSApp]; + #endif } void SetShortcutHandler(MacGlobalShortcutBackend* handler) { @@ -190,7 +195,9 @@ void SetApplicationHandler(PlatformInterface* handler) { } void CheckForUpdates() { + #ifdef HAVE_SPARKLE [[SUUpdater sharedUpdater] checkForUpdates: NSApp]; + #endif } QString GetBundlePath() { diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index cada56fdf..1e2c0e9cc 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -481,10 +481,12 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent) connect(tray_icon_, SIGNAL(ChangeVolume(int)), SLOT(VolumeWheelEvent(int))); #ifdef Q_OS_DARWIN - // Add check for updates item to application menu. - QAction* check_updates = ui_->menuTools->addAction(tr("Check for updates...")); - check_updates->setMenuRole(QAction::ApplicationSpecificRole); - connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates())); + #ifdef HAVE_SPARKLE + // Add check for updates item to application menu. + QAction* check_updates = ui_->menuTools->addAction(tr("Check for updates...")); + check_updates->setMenuRole(QAction::ApplicationSpecificRole); + connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates())); + #endif // Force this menu to be the app "Preferences". ui_->action_configure->setMenuRole(QAction::PreferencesRole);