1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-04 13:08:31 +00:00

Let cmake check whether to build for old or new audacious

This commit is contained in:
Nikolas Garofil 2010-11-12 16:49:34 +01:00
parent 4d157a298b
commit e918ea4655
4 changed files with 15 additions and 21 deletions

View File

@ -119,11 +119,6 @@ if(BUILD_LUA)
endif(BUILD_LUA)
option(BUILD_AUDACIOUS "Build audacious (music player) support" false)
if(BUILD_AUDACIOUS)
option(BUILD_AUDACIOUS_LEGACY "Use legacy audacious (music player) support" false)
else(BUILD_AUDACIOUS)
set(BUILD_AUDACIOUS_LEGACY false)
endif(BUILD_AUDACIOUS)
option(BUILD_BMPX "Build BMPx (music player) support" false)

View File

@ -234,15 +234,14 @@ endif(BUILD_LUA)
if(BUILD_AUDACIOUS)
set(WANT_GLIB true)
if(NOT BUILD_AUDACIOUS_LEGACY)
pkg_check_modules(AUDACIOUS REQUIRED audacious>=1.4.0 audclient>=1.4.0 dbus-glib-1 gobject-2.0)
set(conky_libs ${conky_libs} ${AUDACIOUS_LIBRARIES})
set(conky_includes ${conky_includes} ${AUDACIOUS_INCLUDE_DIRS})
else(NOT BUILD_AUDACIOUS_LEGACY)
pkg_check_modules(NEW_AUDACIOUS audacious>=1.4.0)
if(NEW_AUDACIOUS_FOUND)
pkg_check_modules(AUDACIOUS REQUIRED audclient>=1.4.0)
else(NEW_AUDACIOUS_FOUND)
pkg_check_modules(AUDACIOUS REQUIRED audacious<1.4.0)
set(conky_libs ${conky_libs} ${AUDACIOUS_LIBRARIES})
set(conky_includes ${conky_includes} ${AUDACIOUS_INCLUDE_DIRS})
endif(NOT BUILD_AUDACIOUS_LEGACY)
endif(NEW_AUDACIOUS_FOUND)
set(conky_libs ${conky_libs} ${AUDACIOUS_LIBRARIES})
set(conky_includes ${conky_includes} ${AUDACIOUS_INCLUDE_DIRS})
endif(BUILD_AUDACIOUS)
if(BUILD_BMPX)

View File

@ -49,7 +49,7 @@
#cmakedefine BUILD_AUDACIOUS 1
#cmakedefine BUILD_AUDACIOUS_LEGACY 1
#cmakedefine NEW_AUDACIOUS_FOUND 1
#cmakedefine BUILD_MPD 1

View File

@ -29,11 +29,11 @@
#include <mutex>
#include <glib.h>
#ifndef BUILD_AUDACIOUS_LEGACY
#ifdef NEW_AUDACIOUS_FOUND
#include <glib-object.h>
#include <audacious/audctrl.h>
#include <audacious/dbus.h>
#else /* BUILD_AUDACIOUS_LEGACY */
#else /* NEW_AUDACIOUS_FOUND */
#include <audacious/beepctrl.h>
#define audacious_remote_is_running(x) \
xmms_remote_is_running(x)
@ -55,7 +55,7 @@
xmms_remote_get_playlist_file(x, y)
#define audacious_remote_get_playlist_length(x) \
xmms_remote_get_playlist_length(x)
#endif /* BUILD_AUDACIOUS_LEGACY */
#endif /* NEW_AUDACIOUS_FOUND */
/* access to this item array is synchronized */
static audacious_t audacious_items;
@ -125,7 +125,7 @@ void audacious_thread_func(thread_handle &handle)
gint rate, freq, chans, vol;
gchar *psong, *pfilename;
#ifndef BUILD_AUDACIOUS_LEGACY
#ifdef NEW_AUDACIOUS_FOUND
DBusGProxy *session = NULL;
DBusGConnection *connection = NULL;
#else
@ -136,7 +136,7 @@ void audacious_thread_func(thread_handle &handle)
psong = NULL;
pfilename = NULL;
#ifndef BUILD_AUDACIOUS_LEGACY
#ifdef NEW_AUDACIOUS_FOUND
g_type_init();
connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
if (!connection) {
@ -147,7 +147,7 @@ void audacious_thread_func(thread_handle &handle)
if (!session) {
CRIT_ERR(NULL, NULL, "unable to create dbus proxy");
}
#endif /* BUILD_AUDACIOUS_LEGACY */
#endif /* NEW_AUDACIOUS_FOUND */
/* Loop until the main thread resets the runnable signal. */
while (1) {
@ -242,7 +242,7 @@ void audacious_thread_func(thread_handle &handle)
}
if (handle.test(0)) {
#ifndef BUILD_AUDACIOUS_LEGACY
#ifdef NEW_AUDACIOUS_FOUND
/* release reference to dbus proxy */
g_object_unref(session);
#endif