Commit fa5488f4 authored by Philippe De Swert's avatar Philippe De Swert

Split out appsync-dbus as an extra compile-time option

Signed-off-by: default avatarPhilippe De Swert <philippe.deswert@jollamobile.com>
parent fc7b073b
......@@ -70,6 +70,14 @@ AC_ARG_ENABLE([app_sync], AS_HELP_STRING([--enable-app-sync], [Enable applicatio
esac],[app_sync=true])
AM_CONDITIONAL([APP_SYNC], [test x$app_sync = xtrue])
AC_ARG_ENABLE([app_sync_dbus], AS_HELP_STRING([--enable-app-sync-dbus], [Enable application syncing with dbus @<:@default=false@:>@]),
[case "${enableval}" in
yes) app_sync_dbus=true ; CFLAGS="-DAPP_SYNC_DBUS $CFLAGS" ;;
no) app_sync_dbus=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-app-sync-dbus]) ;;
esac],[app_sync_dbus=false])
AM_CONDITIONAL([APP_SYNC_DBUS], [test x$app_sync_dbus = xtrue])
AC_ARG_ENABLE([udev], AS_HELP_STRING([--enable-udev], [Enable udev interface @<:@default=true@:>@]),
[case "${enableval}" in
yes) udev=true ; CFLAGS="-DUDEV -ludev $CFLAGS" ;;
......
......@@ -60,10 +60,14 @@ if APP_SYNC
usb_moded_SOURCES += \
usb_moded-appsync.c \
usb_moded-appsync.h \
usb_moded-systemd.c \
usb_moded-systemd.h
endif
if APP_SYNC_DBUS
usb_moded_SOURCES += \
usb_moded-appsync-dbus.c \
usb_moded-appsync-dbus.h \
usb_moded-systemd.c \
usb_moded-systemd.h \
usb_moded-appsync-dbus-private.h
endif
......
......@@ -49,6 +49,12 @@ static GList *sync_list = NULL;
static unsigned sync_tag = 0;
static unsigned enum_tag = 0;
static struct timeval sync_tv;
#ifdef APP_SYNC_DBUS
static int no_dbus = 0;
#else
static int no_dbus = 0;
#endif /* APP_SYNC_DBUS */
static void free_elem(gpointer aptr)
{
......@@ -100,7 +106,9 @@ cleanup:
if( sync_list )
{
log_debug("Sync list valid\n");
#ifdef APP_SYN_DBUS
usb_moded_app_sync_init_connection();
#endif
}
}
......@@ -154,7 +162,6 @@ int activate_sync(const char *mode)
{
GList *iter;
int count = 0, count2 = 0;
int no_dbus = 0;
log_debug("activate sync");
......@@ -192,12 +199,14 @@ int activate_sync(const char *mode)
return(0);
}
#ifdef APP_SYNC_DBUS
/* check dbus initialisation, skip dbus activated services if this fails */
if(!usb_moded_app_sync_init())
{
log_debug("dbus setup failed => skipping dbus launched apps \n");
no_dbus = 1;
}
#endif /* APP_SYNC_DBUS */
/* start timer */
log_debug("Starting appsync timer\n");
......@@ -228,14 +237,17 @@ int activate_sync(const char *mode)
#endif /* UPSTART */
else if(data->launch)
{
/* skipping if dbus session bus is not available */
/* skipping if dbus session bus is not available,
or not compiled in */
if(no_dbus)
mark_active(data->name);
#ifdef APP_SYNC_DBUS
else
if(usb_moded_dbus_app_launch(data->launch))
mark_active(data->name);
else
goto error;
#endif /* APP_SYNC_DBUS */
}
}
}
......@@ -315,8 +327,10 @@ static gboolean enumerate_usb(gpointer data)
timersub(&tv, &sync_tv, &tv);
log_debug("sync to enum: %.3f seconds", tv.tv_sec + tv.tv_usec * 1e-6);
#ifdef APP_SYNC_DBUS
/* remove dbus service */
usb_moded_appsync_cleanup();
#endif /* APP_SYNC_DBUS */
}
/* return false to stop the timer from repeating */
return FALSE;
......
......@@ -544,9 +544,10 @@ static void handle_exit(void)
#ifdef APP_SYNC
free_appsync_list();
#ifdef APP_SYNC_DBUS
usb_moded_appsync_cleanup();
#endif
#endif /* APP_SYNC_DBUS */
#endif /* APP_SYNC */
dbus_shutdown();
/* If the mainloop is initialised, unreference it */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment