Commit 36745247 authored by Alexandre Bourget's avatar Alexandre Bourget
Browse files

Merge commit 'origin/master'

parents 67c9e135 8bf6ad03
......@@ -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,
......
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
])
......@@ -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) \
......
/*
* 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
......
/*
* 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
......
/*
* 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
......
/*
* 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
......
/*
* 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);
......
/*
* 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
*/
......
/*
* 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
......
/*
* 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
......
/*
* 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;
}
/*
* 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);
......
/*
* 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
......
/*
* 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
......
/*
* 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");
}
}
/*
* 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
/*
* 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
......
/*
* 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
......
/*
* 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
......
Supports Markdown
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