Commit 8ceb4332 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

Autostart deamon on first dbus method call

parent 19793ffa
...@@ -273,6 +273,12 @@ dnl Datadir directory ...@@ -273,6 +273,12 @@ dnl Datadir directory
sflphone_datadir=$datadir/sflphone sflphone_datadir=$datadir/sflphone
AC_SUBST(sflphone_datadir) AC_SUBST(sflphone_datadir)
dnl Dbus Service activation part
DBUS_SERVICES_DIR="$datadir/dbus-1/services"
AC_SUBST(DBUS_SERVICES_DIR)
AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
dnl QT interface dnl QT interface
AC_MSG_CHECKING([whether to enable sflphoneqt]) AC_MSG_CHECKING([whether to enable sflphoneqt])
AC_ARG_ENABLE(sflphoneqt, AC_ARG_ENABLE(sflphoneqt,
......
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
dnl
dnl example
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
AC_DEFUN([AS_AC_EXPAND],
[
EXP_VAR=[$1]
FROM_VAR=[$2]
dnl first expand prefix and exec_prefix if necessary
prefix_save=$prefix
exec_prefix_save=$exec_prefix
dnl if no prefix given, then use /usr/local, the default prefix
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
fi
dnl if no exec_prefix given, then use prefix
if test "x$exec_prefix" = "xNONE"; then
exec_prefix=$prefix
fi
full_var="$FROM_VAR"
dnl loop until it doesn't change anymore
while true; do
new_full_var="`eval echo $full_var`"
if test "x$new_full_var"="x$full_var"; then break; fi
full_var=$new_full_var
done
dnl clean up
full_var=$new_full_var
AC_SUBST([$1], "$full_var")
dnl restore prefix and exec_prefix
prefix=$prefix_save
exec_prefix=$exec_prefix_save
])
...@@ -166,16 +166,13 @@ dbus_connect () ...@@ -166,16 +166,13 @@ dbus_connect ()
/* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */ /* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */
callManagerProxy = dbus_g_proxy_new_for_name_owner (connection, callManagerProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone", "org.sflphone.SFLphone",
"/org/sflphone/SFLphone/CallManager", "/org/sflphone/SFLphone/CallManager",
"org.sflphone.SFLphone.CallManager", "org.sflphone.SFLphone.CallManager");
&error); if (!callManagerProxy)
if (error)
{ {
g_printerr ("Failed to get proxy to CallManager: %s\n", g_printerr ("Failed to get proxy to CallManagers\n");
error->message);
g_error_free (error);
return FALSE; return FALSE;
} }
...@@ -215,19 +212,16 @@ dbus_connect () ...@@ -215,19 +212,16 @@ dbus_connect ()
dbus_g_proxy_connect_signal (callManagerProxy, dbus_g_proxy_connect_signal (callManagerProxy,
"volumeChanged", G_CALLBACK(volume_changed_cb), NULL, NULL); "volumeChanged", G_CALLBACK(volume_changed_cb), NULL, NULL);
configurationManagerProxy = dbus_g_proxy_new_for_name_owner (connection, configurationManagerProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone", "org.sflphone.SFLphone",
"/org/sflphone/SFLphone/ConfigurationManager", "/org/sflphone/SFLphone/ConfigurationManager",
"org.sflphone.SFLphone.ConfigurationManager", "org.sflphone.SFLphone.ConfigurationManager");
&error); if (!configurationManagerProxy)
if (error)
{ {
g_printerr ("Failed to get proxy to ConfigurationManager: %s\n", g_printerr ("Failed to get proxy to ConfigurationManager\n");
error->message);
g_error_free (error);
return FALSE; return FALSE;
} }
g_print ("DBus connected to ConfigurationManager\n");
dbus_g_proxy_add_signal (configurationManagerProxy, dbus_g_proxy_add_signal (configurationManagerProxy,
"accountsChanged", G_TYPE_INVALID); "accountsChanged", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (configurationManagerProxy, dbus_g_proxy_connect_signal (configurationManagerProxy,
...@@ -375,12 +369,16 @@ dbus_place_call (const call_t * c) ...@@ -375,12 +369,16 @@ dbus_place_call (const call_t * c)
gchar ** gchar **
dbus_account_list() dbus_account_list()
{ {
g_print("Before");
GError *error = NULL; GError *error = NULL;
char ** array; char ** array;
org_sflphone_SFLphone_ConfigurationManager_get_account_list ( org_sflphone_SFLphone_ConfigurationManager_get_account_list (
configurationManagerProxy, configurationManagerProxy,
&array, &array,
&error); &error);
g_print("After");
if (error) if (error)
{ {
g_printerr ("Failed to call get_account_list() on ConfigurationManager: %s\n", g_printerr ("Failed to call get_account_list() on ConfigurationManager: %s\n",
......
...@@ -19,3 +19,13 @@ noinst_HEADERS = \ ...@@ -19,3 +19,13 @@ noinst_HEADERS = \
configurationmanager.h \ configurationmanager.h \
dbusmanager.h \ dbusmanager.h \
dbusmanagerimpl.h dbusmanagerimpl.h
# Dbus service file
servicedir = $(DBUS_SERVICES_DIR)
service_in_files = org.sflphone.SFLphone.service.in
service_DATA = $(service_in_files:.service.in=.service)
# Rule to make the service file with bindir expanded
$(service_DATA): $(service_in_files) Makefile
sed -e "s|bindir|$(prefix)/libexec|" $<> $@
[D-BUS Service]
Name=org.sflphone.SFLphone.CallManager
Exec=bindir/sflphoned
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