syncevolution.org: drop binary compatibility hack for old libnotify
syncevolution.org binaries are going to support distros >= Ubuntu Trusty. All of those have libnotify.so.4, so the old binary compatibility hack is no longer needed.
This commit is contained in:
parent
bf3c8d5361
commit
499c1c72d5
12
configure.ac
12
configure.ac
|
@ -543,17 +543,6 @@ if test "$enable_dbus_service" != "no"; then
|
|||
[AC_DEFINE(HAS_NOTIFY, 1,
|
||||
[define if libnotify could be used in dbus service])])
|
||||
|
||||
AC_ARG_ENABLE(notify-compatibility,
|
||||
AS_HELP_STRING([--enable-notify-compatibility],
|
||||
[increase compatibility with binary libnotify installations by loading libnotify.so.1..4 dynamically instead of linking against it]),
|
||||
[enable_notify_compat="$enableval"],
|
||||
[enable_notify_compat="no"]
|
||||
)
|
||||
if test "$enable_notify_compat" = "yes"; then
|
||||
AC_DEFINE(NOTIFY_COMPATIBILITY, 1, [dynamically open libnotify])
|
||||
LIBNOTIFY_LIBS="`echo $LIBNOTIFY_LIBS | sed -e 's/\(-lnotify\|[^ ]*libnotify.la\)/-ldl/'`"
|
||||
fi
|
||||
|
||||
# Here we're using QtGui too because mlite fails to depend on it,
|
||||
# despite using QAction.
|
||||
PKG_CHECK_MODULES(MLITE, [mlite QtGui], HAVE_MLITE=yes, HAVE_MLITE=no)
|
||||
|
@ -638,7 +627,6 @@ if test "$enable_dbus_service" != "no"; then
|
|||
;;
|
||||
esac
|
||||
fi
|
||||
AM_CONDITIONAL([NOTIFY_COMPATIBILITY], [test "$enable_notify_compat" = "yes"])
|
||||
AM_CONDITIONAL([COND_DBUS_PIM], [test "$enable_dbus_pim" != "no"])
|
||||
|
||||
AC_SUBST(DBUS_CFLAGS)
|
||||
|
|
|
@ -33,40 +33,8 @@
|
|||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#ifdef NOTIFY_COMPATIBILITY
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
SE_BEGIN_CXX
|
||||
|
||||
#ifdef NOTIFY_COMPATIBILITY
|
||||
/**
|
||||
* set to real old C notify_notification_new() (with widget pointer) or new one (without);
|
||||
* because of the x86/AMD64 calling conventions, calling the newer function with
|
||||
* one extra parameter is okay
|
||||
*/
|
||||
gboolean (*notify_init)(const char *app_name);
|
||||
GList *(*notify_get_server_caps)(void);
|
||||
NotifyNotification *(*notify_notification_new)(const char *summary, const char *body, const char *icon, void *widget);
|
||||
void (*notify_notification_add_action)(NotifyNotification *notification,
|
||||
const char *action,
|
||||
const char *label,
|
||||
NotifyActionCallback callback,
|
||||
gpointer user_data,
|
||||
GFreeFunc free_func);
|
||||
void (*notify_notification_clear_actions)(NotifyNotification *notification);
|
||||
gboolean (*notify_notification_close)(NotifyNotification *notification,
|
||||
GError **error);
|
||||
gboolean (*notify_notification_show)(NotifyNotification *notification,
|
||||
GError **error);
|
||||
|
||||
static bool NotFound(const char *func)
|
||||
{
|
||||
SE_LOG_DEBUG(NULL, "%s: not found", func);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
NotificationBackendLibnotify::NotificationBackendLibnotify()
|
||||
: m_initialized(false),
|
||||
m_acceptsActions(false),
|
||||
|
@ -96,36 +64,6 @@ void NotificationBackendLibnotify::notifyAction(
|
|||
|
||||
bool NotificationBackendLibnotify::init()
|
||||
{
|
||||
#ifdef NOTIFY_COMPATIBILITY
|
||||
void *dlhandle = NULL;
|
||||
int i;
|
||||
for (i = 1; i <= 4; i++) {
|
||||
dlhandle = dlopen(StringPrintf("libnotify.so.%d", i).c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
||||
if (!dlhandle) {
|
||||
SE_LOG_DEBUG(NULL, "failed to load libnotify.so.%d: %s", i, dlerror());
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dlhandle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#define LOOKUP(_x) ((_x = reinterpret_cast<typeof(_x)>(dlsym(dlhandle, #_x))) || \
|
||||
NotFound(#_x))
|
||||
|
||||
if (!LOOKUP(notify_init) ||
|
||||
!LOOKUP(notify_get_server_caps) ||
|
||||
!LOOKUP(notify_notification_new) ||
|
||||
!LOOKUP(notify_notification_add_action) ||
|
||||
!LOOKUP(notify_notification_clear_actions) ||
|
||||
!LOOKUP(notify_notification_close) ||
|
||||
!LOOKUP(notify_notification_show)) {
|
||||
return false;
|
||||
}
|
||||
SE_LOG_DEBUG(NULL, "using libnotify.so.%d", i);
|
||||
#endif
|
||||
|
||||
m_initialized = notify_init("SyncEvolution");
|
||||
if(m_initialized) {
|
||||
GStringListFreeCXX list(notify_get_server_caps());
|
||||
|
@ -154,7 +92,7 @@ void NotificationBackendLibnotify::publish(
|
|||
#ifndef NOTIFY_CHECK_VERSION
|
||||
# define NOTIFY_CHECK_VERSION(_x,_y,_z) 0
|
||||
#endif
|
||||
#if !NOTIFY_CHECK_VERSION(0,7,0) || defined(NOTIFY_COMPATIBILITY)
|
||||
#if !NOTIFY_CHECK_VERSION(0,7,0)
|
||||
m_notification = notify_notification_new(summary.c_str(), body.c_str(), NULL, NULL);
|
||||
#else
|
||||
m_notification = notify_notification_new(summary.c_str(), body.c_str(), NULL);
|
||||
|
|
Loading…
Reference in New Issue