Merge commit 'origin/master'

This commit is contained in:
Alexandre Bourget
2007-11-02 16:31:44 -04:00
45 changed files with 499 additions and 68 deletions

View File

@ -273,6 +273,12 @@ dnl Datadir directory
sflphone_datadir=$datadir/sflphone
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
AC_MSG_CHECKING([whether to enable sflphoneqt])
AC_ARG_ENABLE(sflphoneqt,

40
m4/dbus.m4 Normal file
View File

@ -0,0 +1,40 @@
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
])

View File

@ -18,9 +18,9 @@ sflphone_gtk_SOURCES = \
statusicon.c
noinst_HEADERS = actions.h dbus.h mainwindow.h calllist.h dialpad.h \
callmanager-glue.h menus.h calltree.h screen.h configwindow.h \
callmanager-glue.h configurationmanager-glue.h instance-glue.h menus.h calltree.h screen.h configwindow.h \
accountlist.h accountwindow.h marshaller.h sliders.h statusicon.h
EXTRA_DIST = marshaller.list
EXTRA_DIST = marshaller.list
sflphone_gtk_LDADD = $(DEPS_LIBS)
AM_CPPFLAGS = $(DEPS_CFLAGS) \

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +30,9 @@
#include <string.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
void
sflphone_notify_voice_mail (guint count)
@ -61,8 +64,10 @@ sflphone_quit ()
if (quit)
{
dbus_unregister(getpid());
dbus_clean ();
//call_list_clean(); TODO
//account_list_clean()
gtk_main_quit ();
}
return quit;
@ -132,6 +137,7 @@ sflphone_fill_account_list()
}
toolbar_update_buttons();
}
gboolean
@ -146,6 +152,7 @@ sflphone_init()
}
else
{
dbus_register(getpid(), "Gtk+ Client");
sflphone_fill_account_list();
return TRUE;
}
@ -170,6 +177,9 @@ sflphone_hang_up()
case CALL_STATE_INCOMING:
dbus_refuse (selectedCall);
break;
case CALL_STATE_TRANSFERT:
dbus_hang_up (selectedCall);
break;
default:
g_warning("Should not happen!");
break;
@ -195,6 +205,9 @@ sflphone_pick_up()
case CALL_STATE_HOLD:
dbus_unhold (selectedCall);
break;
case CALL_STATE_TRANSFERT:
dbus_transfert (selectedCall);
break;
default:
g_warning("Should not happen!");
break;
@ -278,8 +291,23 @@ sflphone_set_transfert()
update_call_tree(c);
update_menus();
}
toolbar_update_buttons();
}
void
sflphone_unset_transfert()
{
call_t * c = call_get_selected();
if(c)
{
c->state = CALL_STATE_CURRENT;
c->to = g_strdup("");
screen_set_call(c);
update_call_tree(c);
update_menus();
}
toolbar_update_buttons();
}
void
sflphone_incoming_call (call_t * c)
{
@ -431,7 +459,7 @@ sflphone_keypad( guint keyval, gchar * key)
dbus_transfert(c);
break;
case 65307: /* ESCAPE */
sflphone_current(c); // Quit transfert
sflphone_hang_up(c);
break;
default: // When a call is on transfert, typing new numbers will add it to c->to
process_dialing(c, keyval, key);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,6 +52,7 @@ void sflphone_off_hold ();
call_t * sflphone_new_call();
void sflphone_notify_voice_mail (guint count);
void sflphone_set_transfert();
void sflphone_unset_transfert();
/**
* Accept / dial the current call
*/

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ GtkToolItem * hangupButton;
GtkToolItem * holdButton;
GtkToolItem * transfertButton;
GtkToolItem * unholdButton;
guint transfertButtonConnId; //The button toggled signal connection ID
/**
* Make a call
@ -74,9 +75,18 @@ hold( GtkWidget *widget, gpointer data )
* Transfert the line
*/
static void
transfert( GtkWidget *widget, gpointer data )
transfert (GtkToggleToolButton *toggle_tool_button,
gpointer user_data)
{
sflphone_set_transfert();
gboolean up = gtk_toggle_tool_button_get_active(toggle_tool_button);
if(up)
{
sflphone_set_transfert();
}
else
{
sflphone_unset_transfert();
}
}
/**
@ -89,7 +99,7 @@ unhold( GtkWidget *widget, gpointer data )
}
void
update_buttons ()
toolbar_update_buttons ()
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), FALSE);
@ -103,6 +113,10 @@ update_buttons ()
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), holdButton, 3);
gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), FALSE);
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
call_t * selectedCall = call_get_selected();
if (selectedCall)
{
@ -138,6 +152,16 @@ update_buttons ()
case CALL_STATE_FAILURE:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
case CALL_STATE_TRANSFERT:
gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE);
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
break;
default:
g_warning("Should not happen!");
break;
@ -145,7 +169,14 @@ update_buttons ()
}
else
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
if( account_list_get_size() > 0 )
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
}
else
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
}
}
}
/* Call back when the user click on a call in the list */
@ -164,7 +195,7 @@ selected(GtkTreeSelection *sel, GtkTreeModel *model)
call_select((call_t*) g_value_get_pointer(&val));
g_value_unset(&val);
update_buttons();
toolbar_update_buttons();
}
/* A row is activated when it is double clicked */
@ -245,9 +276,11 @@ create_toolbar (){
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(holdButton), -1);
image = gtk_image_new_from_file( ICONS_DIR "/transfert.svg");
transfertButton = gtk_tool_button_new (image, "Transfert");
transfertButton = gtk_toggle_tool_button_new ();
gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(transfertButton), image);
gtk_tool_button_set_label(GTK_TOOL_BUTTON(transfertButton), "Transfert");
gtk_widget_set_state( GTK_WIDGET(transfertButton), GTK_STATE_INSENSITIVE);
g_signal_connect (G_OBJECT (transfertButton), "clicked",
transfertButtonConnId = g_signal_connect (G_OBJECT (transfertButton), "toggled",
G_CALLBACK (transfert), NULL);
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(transfertButton), -1);
@ -309,6 +342,8 @@ create_call_tree (){
gtk_widget_show(ret);
toolbar_update_buttons();
return ret;
}
@ -340,7 +375,7 @@ update_call_tree_remove (call_t * c)
call_t * selectedCall = call_get_selected();
if(selectedCall == c)
call_select(NULL);
update_buttons();
toolbar_update_buttons();
}
void
@ -430,7 +465,7 @@ update_call_tree (call_t * c)
}
}
update_buttons();
toolbar_update_buttons();
//return row_ref;
}
@ -486,6 +521,6 @@ update_call_tree_add (call_t * c)
//g_free(markup);
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
gtk_tree_selection_select_iter(GTK_TREE_SELECTION(sel), &iter);
update_buttons();
toolbar_update_buttons();
//return row_ref;
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,6 +28,8 @@
*/
GtkWidget * create_call_tree();
void toolbar_update_buttons();
void update_call_tree_add (call_t * c);
void update_call_tree (call_t * c);
void update_call_tree_remove (call_t * c);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,6 +21,7 @@
#include <calllist.h>
#include <callmanager-glue.h>
#include <configurationmanager-glue.h>
#include <instance-glue.h>
#include <configwindow.h>
#include <mainwindow.h>
#include <marshaller.h>
@ -34,6 +35,7 @@
DBusGConnection * connection;
DBusGProxy * callManagerProxy;
DBusGProxy * configurationManagerProxy;
DBusGProxy * instanceProxy;
static void
incoming_call_cb (DBusGProxy *proxy,
@ -166,16 +168,26 @@ dbus_connect ()
/* Create a proxy object for the "bus driver" (name "org.freedesktop.DBus") */
callManagerProxy = dbus_g_proxy_new_for_name_owner (connection,
instanceProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/Instance",
"org.sflphone.SFLphone.Instance");
if (!instanceProxy)
{
g_printerr ("Failed to get proxy to Instance\n");
return FALSE;
}
g_print ("DBus connected to Instance\n");
callManagerProxy = dbus_g_proxy_new_for_name (connection,
"org.sflphone.SFLphone",
"/org/sflphone/SFLphone/CallManager",
"org.sflphone.SFLphone.CallManager",
&error);
if (error)
"org.sflphone.SFLphone.CallManager");
if (!callManagerProxy)
{
g_printerr ("Failed to get proxy to CallManager: %s\n",
error->message);
g_error_free (error);
g_printerr ("Failed to get proxy to CallManagers\n");
return FALSE;
}
@ -215,19 +227,16 @@ dbus_connect ()
dbus_g_proxy_connect_signal (callManagerProxy,
"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/ConfigurationManager",
"org.sflphone.SFLphone.ConfigurationManager",
&error);
if (error)
"org.sflphone.SFLphone.ConfigurationManager");
if (!configurationManagerProxy)
{
g_printerr ("Failed to get proxy to ConfigurationManager: %s\n",
error->message);
g_error_free (error);
g_printerr ("Failed to get proxy to ConfigurationManager\n");
return FALSE;
}
g_print ("DBus connected to ConfigurationManager\n");
dbus_g_proxy_add_signal (configurationManagerProxy,
"accountsChanged", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (configurationManagerProxy,
@ -375,12 +384,16 @@ dbus_place_call (const call_t * c)
gchar **
dbus_account_list()
{
g_print("Before");
GError *error = NULL;
char ** array;
org_sflphone_SFLphone_ConfigurationManager_get_account_list (
configurationManagerProxy,
&array,
&error);
g_print("After");
if (error)
{
g_printerr ("Failed to call get_account_list() on ConfigurationManager: %s\n",
@ -556,3 +569,49 @@ dbus_play_dtmf(const gchar * key)
}
}
void
dbus_register(int pid, gchar * name)
{
GError *error = NULL;
org_sflphone_SFLphone_Instance_register(
instanceProxy,
pid,
name,
&error);
if (error)
{
g_printerr ("Failed to call register() on instanceProxy: %s\n",
error->message);
g_error_free (error);
}
else
{
g_print ("DBus called register() on instanceProxy\n");
}
}
void
dbus_unregister(int pid)
{
GError *error = NULL;
org_sflphone_SFLphone_Instance_unregister(
instanceProxy,
pid,
&error);
if (error)
{
g_printerr ("Failed to call unregister() on instanceProxy: %s\n",
error->message);
g_error_free (error);
}
else
{
g_print ("DBus called unregister() on instanceProxy\n");
}
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -51,4 +51,10 @@ void dbus_set_volume(const gchar * device, gdouble value);
gdouble dbus_get_volume(const gchar * device);
void dbus_play_dtmf(const gchar * key);
/* Instance */
void dbus_register( int pid, gchar * name);
void dbus_unregister(int pid);
#endif

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -5,8 +5,9 @@ EXTRA_DIST = *.xml README
noinst_LTLIBRARIES = libdbus.la
libdbus_la_SOURCES = \
callmanager.cpp \
callmanager.cpp \
configurationmanager.cpp \
instance.cpp \
dbusmanagerimpl.cpp
libdbus_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\"
@ -17,5 +18,18 @@ noinst_HEADERS = \
callmanager-glue.h \
callmanager.h \
configurationmanager.h \
configurationmanager-glue.h \
instance.h \
instance-glue.h \
dbusmanager.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|" $<> $@

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,6 +32,7 @@ DBusManagerImpl::exec(){
_callManager = new CallManager(conn);
_configurationManager = new ConfigurationManager(conn);
_instanceManager = new Instance(conn);
// Register accounts
Manager::instance().initRegisterAccounts(); //getEvents();
@ -42,4 +43,9 @@ DBusManagerImpl::exec(){
return 1;
}
void
DBusManagerImpl::exit()
{
_dispatcher.leave();
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,18 +22,21 @@
#include "callmanager.h"
#include "configurationmanager.h"
#include "instance.h"
class DBusManagerImpl {
public:
CallManager * getCallManager(){ return _callManager; };
ConfigurationManager * getConfigurationManager(){ return _configurationManager; };
int exec();
void exit();
static const char* SERVER_NAME;
private:
CallManager * _callManager;
ConfigurationManager * _configurationManager;
DBus::BusDispatcher _dispatcher;
CallManager* _callManager;
ConfigurationManager* _configurationManager;
Instance* _instanceManager;
DBus::BusDispatcher _dispatcher;
};
#endif

109
src/dbus/instance-glue.h Normal file
View File

@ -0,0 +1,109 @@
/*
* This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
*/
#ifndef __dbusxx__instance_glue_h__ADAPTOR_MARSHAL_H
#define __dbusxx__instance_glue_h__ADAPTOR_MARSHAL_H
#include <dbus-c++/dbus.h>
namespace org {
namespace sflphone {
namespace SFLphone {
class Instance
: public ::DBus::InterfaceAdaptor
{
public:
Instance()
: ::DBus::InterfaceAdaptor("org.sflphone.SFLphone.Instance")
{
register_method(Instance, Register, _Register_stub);
register_method(Instance, Unregister, _Unregister_stub);
}
::DBus::IntrospectedInterface* const introspect() const
{
static ::DBus::IntrospectedArgument Register_args[] =
{
{ "pid", "i", true },
{ "name", "s", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument Unregister_args[] =
{
{ "pid", "i", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedMethod Instance_methods[] =
{
{ "Register", Register_args },
{ "Unregister", Unregister_args },
{ 0, 0 }
};
static ::DBus::IntrospectedMethod Instance_signals[] =
{
{ 0, 0 }
};
static ::DBus::IntrospectedProperty Instance_properties[] =
{
{ 0, 0, 0, 0 }
};
static ::DBus::IntrospectedInterface Instance_interface =
{
"org.sflphone.SFLphone.Instance",
Instance_methods,
Instance_signals,
Instance_properties
};
return &Instance_interface;
}
public:
/* properties exposed by this interface, use
* property() and property(value) to get and set a particular property
*/
public:
/* methods exported by this interface,
* you will have to implement them in your ObjectAdaptor
*/
virtual void Register( const ::DBus::Int32& pid, const ::DBus::String& name ) = 0;
virtual void Unregister( const ::DBus::Int32& pid ) = 0;
public:
/* signal emitters for this interface
*/
private:
/* unmarshalers (to unpack the DBus message before calling the actual interface method)
*/
::DBus::Message _Register_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::Int32 argin1; ri >> argin1;
::DBus::String argin2; ri >> argin2;
Register(argin1, argin2);
::DBus::ReturnMessage reply(call);
return reply;
}
::DBus::Message _Unregister_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
::DBus::Int32 argin1; ri >> argin1;
Unregister(argin1);
::DBus::ReturnMessage reply(call);
return reply;
}
};
} } }
#endif//__dbusxx__instance_glue_h__ADAPTOR_MARSHAL_H

View File

@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<node name="/org/sflphone/SFLphone">
<interface name="org.sflphone.SFLphone.Instance">
<method name="Register">
<arg type="i" name="pid" direction="in"/>
<arg type="s" name="name" direction="in"/>
</method>
<method name="Unregister">
<arg type="i" name="pid" direction="in"/>
</method>
</interface>
</node>

52
src/dbus/instance.cpp Normal file
View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <global.h>
#include <instance.h>
#include "../manager.h"
const char* Instance::SERVER_PATH = "/org/sflphone/SFLphone/Instance";
Instance::Instance( DBus::Connection& connection )
: DBus::ObjectAdaptor(connection, SERVER_PATH)
{
count = 0;
}
void
Instance::Register( const ::DBus::Int32& pid,
const ::DBus::String& name )
{
_debug("Instance::register received\n");
count++;
}
void
Instance::Unregister( const ::DBus::Int32& pid )
{
_debug("Instance::unregister received\n");
count --;
if(count <= 0)
{
_debug("0 client running, quitting...");
DBusManager::instance().exit();
}
}

46
src/dbus/instance.h Normal file
View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef INSTANCE_H
#define INSTANCE_H
#include "instance-glue.h"
#include <dbus-c++/dbus.h>
class Instance
: public org::sflphone::SFLphone::Instance,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
private:
int count;
public:
Instance(DBus::Connection& connection);
static const char* SERVER_PATH;
void Register( const ::DBus::Int32& pid, const ::DBus::String& name );
void Unregister( const ::DBus::Int32& pid );
};
#endif//INSTANCE_H

View File

@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.sflphone.SFLphone
Exec=bindir/sflphoned

View File

@ -1758,6 +1758,10 @@ ManagerImpl::addAccount(const std::map< ::DBus::String, ::DBus::String >& detail
_accountMap[newAccountID] = newAccount;
setAccountDetails(accountID.str(), details);
saveConfig();
if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
}
void
@ -1775,6 +1779,8 @@ ManagerImpl::removeAccount(const AccountID& accountID)
_config.removeSection(accountID);
saveConfig();
if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
}
//THREAD=Main

View File

@ -69,8 +69,8 @@ SIPVoIPLink::SIPVoIPLink(const AccountID& accountID)
SIPVoIPLink::~SIPVoIPLink()
{
delete _evThread; _evThread = 0;
terminate();
delete _evThread; _evThread = 0;
}
bool