syncevolution.org binaries: fix libnotify compatibility mode (BMC #22668)
Nightly testing showed that some problems had to be fixed: - "make dist" broken when --enable-notify-compatibility isn't set, because AM_CONDITIONAL() wasn't invoked. - libnotify.so.4 wasn't opened due to an off-by-one error in the loop; also added some debug statements to find this. - libnotify.so.4 binds to the specific notification daemon, so the method calls went to a specific bus address instead of the org.freedesktop.Notifications expected by test-dbus.py
This commit is contained in:
parent
d22753f4e4
commit
f5ea471500
|
@ -523,7 +523,6 @@ if test $enable_dbus_service = "yes"; then
|
|||
AC_DEFINE(NOTIFY_COMPATIBILITY, 1, [dynamically open libnotify])
|
||||
LIBNOTIFY_LIBS="`echo $LIBNOTIFY_LIBS | sed -e 's/\(-lnotify\|[^ ]*libnotify.la\)/-ldl/'`"
|
||||
fi
|
||||
AM_CONDITIONAL([NOTIFY_COMPATIBILITY], [test "$enable_notify_compat" = "yes"])
|
||||
|
||||
# Here we're using QtGui too because mlite fails to depend on it,
|
||||
# despite using QAction.
|
||||
|
@ -543,6 +542,8 @@ if test $enable_dbus_service = "yes"; then
|
|||
fi
|
||||
AC_DEFINE(DBUS_SERVICE, 1, [define if dbus service is enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([NOTIFY_COMPATIBILITY], [test "$enable_notify_compat" = "yes"])
|
||||
|
||||
AC_SUBST(DBUS_CFLAGS)
|
||||
AC_SUBST(DBUS_LIBS)
|
||||
AC_SUBST(DBUS_GLIB_CFLAGS)
|
||||
|
|
|
@ -85,6 +85,12 @@ void NotificationBackendLibnotify::notifyAction(
|
|||
// if dismissed, ignore.
|
||||
}
|
||||
|
||||
static bool NotFound(const char *func)
|
||||
{
|
||||
SE_LOG_DEBUG(NULL, NULL, "%s: not found", func);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NotificationBackendLibnotify::init()
|
||||
{
|
||||
bindtextdomain (GETTEXT_PACKAGE, SYNCEVOLUTION_LOCALEDIR);
|
||||
|
@ -93,14 +99,22 @@ bool NotificationBackendLibnotify::init()
|
|||
|
||||
#ifdef NOTIFY_COMPATIBILITY
|
||||
void *dlhandle = NULL;
|
||||
for (int i = 1; i < 4 && !dlhandle; i++) {
|
||||
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, 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)))
|
||||
#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) ||
|
||||
|
@ -110,6 +124,7 @@ bool NotificationBackendLibnotify::init()
|
|||
!LOOKUP(notify_notification_show)) {
|
||||
return false;
|
||||
}
|
||||
SE_LOG_DEBUG(NULL, NULL, "using libnotify.so.%d", i);
|
||||
#endif
|
||||
|
||||
m_initialized = notify_init("SyncEvolution");
|
||||
|
|
|
@ -54,7 +54,7 @@ configName = "dbus_unittest"
|
|||
|
||||
def GrepNotifications(dbuslog):
|
||||
'''finds all Notify calls and returns their parameters as list of line lists'''
|
||||
return re.findall(r'^method call .* dest=org.freedesktop.Notifications .*interface=org.freedesktop.Notifications; member=Notify\n((?:^ .*\n)*)',
|
||||
return re.findall(r'^method call .* dest=.* .*interface=org.freedesktop.Notifications; member=Notify\n((?:^ .*\n)*)',
|
||||
dbuslog,
|
||||
re.MULTILINE)
|
||||
|
||||
|
|
Loading…
Reference in New Issue