Commit e26a2e55 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

Merge commit 'origin/master'

parents 3231f100 20671d89
......@@ -53,6 +53,14 @@ sflphone-gtk/doc/html/*
/libs/dbus/tools/dbusxx-*
/libs/dbus/dbus-c++-1.pc
/libs/dbus/doc
/libs/dbus/INSTALL
/libs/dbus/config.guess
/libs/dbus/config.sub
/libs/dbus/depcomp
/libs/dbus/install-sh
/libs/dbus/ltmain.sh
/libs/dbus/missing
# Ignore sflphone-gtk stuff
/sflphone-gtk/config.*
......@@ -71,7 +79,6 @@ sflphone-gtk/doc/html/*
# Ignore temp libs stuff
tools/portaudio
# Ignore sub-modules stuff
## libiax2
/libs/libiax2/doc/html
......
......@@ -35,10 +35,14 @@ GtkToolItem * transfertButton;
GtkToolItem * unholdButton;
guint transfertButtonConnId; //The button toggled signal connection ID
// list of the accounts to be displayed when the arrow beside the call button is pressed
// should be used to set a default account to make output calls
GtkWidget *accounts_list;
/**
* Make a call
*/
static void
static void
call_button( GtkWidget *widget, gpointer data )
{
sflphone_new_call();
......@@ -47,7 +51,7 @@ call_button( GtkWidget *widget, gpointer data )
/**
* Pick up
*/
static void
static void
pick_up( GtkWidget *widget, gpointer data )
{
sflphone_pick_up();
......@@ -56,7 +60,7 @@ pick_up( GtkWidget *widget, gpointer data )
/**
* Hang up the line
*/
static void
static void
hang_up( GtkWidget *widget, gpointer data )
{
sflphone_hang_up();
......@@ -65,7 +69,7 @@ hang_up( GtkWidget *widget, gpointer data )
/**
* Hold the line
*/
static void
static void
hold( GtkWidget *widget, gpointer data )
{
sflphone_on_hold();
......@@ -74,7 +78,7 @@ hold( GtkWidget *widget, gpointer data )
/**
* Transfert the line
*/
static void
static void
transfert (GtkToggleToolButton *toggle_tool_button,
gpointer user_data)
{
......@@ -92,13 +96,13 @@ transfert (GtkToggleToolButton *toggle_tool_button,
/**
* Unhold call
*/
static void
static void
unhold( GtkWidget *widget, gpointer data )
{
sflphone_off_hold();
}
void
void
toolbar_update_buttons ()
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), FALSE);
......@@ -180,7 +184,7 @@ toolbar_update_buttons ()
}
}
/* Call back when the user click on a call in the list */
static void
static void
selected(GtkTreeSelection *sel, GtkTreeModel *model)
{
GtkTreeIter iter;
......@@ -236,16 +240,32 @@ create_toolbar (){
GtkWidget *ret;
GtkWidget *image;
GtkWidget *item1;
GtkWidget *item2;
GtkWidget *item3;
ret = gtk_toolbar_new();
toolbar = ret;
accounts_list = gtk_menu_new();
item1 = gtk_menu_item_new_with_label("Compte A");
gtk_container_add(GTK_CONTAINER(accounts_list), item1);
gtk_widget_show(item1);
item2 = gtk_menu_item_new();
gtk_container_add(GTK_CONTAINER(accounts_list), item2);
item3 = gtk_menu_item_new();
gtk_container_add(GTK_CONTAINER(accounts_list), item3);
image = gtk_image_new_from_file( ICONS_DIR "/call.svg");
callButton = gtk_tool_button_new (image, "Place a Call");
callButton = gtk_menu_tool_button_new (image, "Place a Call");
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(callButton), GTK_MENU(accounts_list));
g_signal_connect (G_OBJECT (callButton), "clicked",
G_CALLBACK (call_button), NULL);
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(callButton), -1);
image = gtk_image_new_from_file( ICONS_DIR "/accept.svg");
pickupButton = gtk_tool_button_new (image, "Pick Up");
gtk_widget_set_state( GTK_WIDGET(pickupButton), GTK_STATE_INSENSITIVE);
......@@ -347,7 +367,7 @@ create_call_tree (){
return ret;
}
void
void
update_call_tree_remove (call_t * c)
{
GtkTreeIter iter;
......@@ -378,7 +398,7 @@ update_call_tree_remove (call_t * c)
toolbar_update_buttons();
}
void
void
update_call_tree (call_t * c)
{
GdkPixbuf *pixbuf;
......@@ -470,7 +490,7 @@ update_call_tree (call_t * c)
}
void
void
update_call_tree_add (call_t * c)
{
GdkPixbuf *pixbuf;
......
......@@ -542,22 +542,22 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_parameters (DBusGProxy *proxy, GHashTable** OUT_parameters, GError **error)
org_sflphone_SFLphone_ConfigurationManager_get_default_account (DBusGProxy *proxy, GHashTable** OUT_parameters, GError **error)
{
return dbus_g_proxy_call (proxy, "getParameters", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), OUT_parameters, G_TYPE_INVALID);
return dbus_g_proxy_call (proxy, "getDefaultAccount", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), OUT_parameters, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_parameters_reply) (DBusGProxy *proxy, GHashTable *OUT_parameters, GError *error, gpointer userdata);
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply) (DBusGProxy *proxy, GHashTable *OUT_parameters, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_get_parameters_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
org_sflphone_SFLphone_ConfigurationManager_get_default_account_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
GHashTable* OUT_parameters;
dbus_g_proxy_end_call (proxy, call, &error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), &OUT_parameters, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_get_parameters_reply)data->cb) (proxy, OUT_parameters, error, data->userdata);
(*(org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply)data->cb) (proxy, OUT_parameters, error, data->userdata);
return;
}
......@@ -566,35 +566,35 @@ static
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_get_parameters_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_parameters_reply callback, gpointer userdata)
org_sflphone_SFLphone_ConfigurationManager_get_default_account_async (DBusGProxy *proxy, org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "getParameters", org_sflphone_SFLphone_ConfigurationManager_get_parameters_async_callback, stuff, g_free, G_TYPE_INVALID);
return dbus_g_proxy_begin_call (proxy, "getDefaultAccount", org_sflphone_SFLphone_ConfigurationManager_get_default_account_async_callback, stuff, g_free, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_set_parameters (DBusGProxy *proxy, const GHashTable* IN_parameters, GError **error)
org_sflphone_SFLphone_ConfigurationManager_set_default_account (DBusGProxy *proxy, const char * IN_accountID, GError **error)
{
return dbus_g_proxy_call (proxy, "setParameters", error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), IN_parameters, G_TYPE_INVALID, G_TYPE_INVALID);
return dbus_g_proxy_call (proxy, "setDefaultAccount", error, G_TYPE_STRING, IN_accountID, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_parameters_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
typedef void (*org_sflphone_SFLphone_ConfigurationManager_set_default_account_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_ConfigurationManager_set_parameters_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
org_sflphone_SFLphone_ConfigurationManager_set_default_account_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_set_parameters_reply)data->cb) (proxy, error, data->userdata);
(*(org_sflphone_SFLphone_ConfigurationManager_set_default_account_reply)data->cb) (proxy, error, data->userdata);
return;
}
......@@ -603,14 +603,14 @@ static
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_ConfigurationManager_set_parameters_async (DBusGProxy *proxy, const GHashTable* IN_parameters, org_sflphone_SFLphone_ConfigurationManager_set_parameters_reply callback, gpointer userdata)
org_sflphone_SFLphone_ConfigurationManager_set_default_account_async (DBusGProxy *proxy, const char * IN_accountID, org_sflphone_SFLphone_ConfigurationManager_set_default_account_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "setParameters", org_sflphone_SFLphone_ConfigurationManager_set_parameters_async_callback, stuff, g_free, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING), IN_parameters, G_TYPE_INVALID);
return dbus_g_proxy_begin_call (proxy, "setDefaultAccount", org_sflphone_SFLphone_ConfigurationManager_set_default_account_async_callback, stuff, g_free, G_TYPE_STRING, IN_accountID, G_TYPE_INVALID);
}
#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_sflphone_SFLphone_ConfigurationManager */
......
......@@ -32,11 +32,12 @@ GtkListStore *account_store;
GtkWidget * addButton;
GtkWidget * editButton;
GtkWidget * deleteButton;
GtkWidget * defaultButton;
account_t * selectedAccount;
/** Fills the treelist with accounts */
void
void
config_window_fill_account_list ()
{
if(dialogOpen)
......@@ -64,12 +65,13 @@ config_window_fill_account_list ()
gtk_widget_set_sensitive( GTK_WIDGET(editButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(deleteButton), FALSE);
gtk_widget_set_sensitive( GTK_WIDGET(defaultButton), FALSE);
}
}
/**
* Delete an account
*/
static void
static void
delete_account( GtkWidget *widget, gpointer data )
{
if(selectedAccount)
......@@ -81,7 +83,7 @@ delete_account( GtkWidget *widget, gpointer data )
/**
* Edit an account
*/
static void
static void
edit_account( GtkWidget *widget, gpointer data )
{
if(selectedAccount)
......@@ -94,14 +96,26 @@ edit_account( GtkWidget *widget, gpointer data )
/**
* Add an account
*/
static void
static void
add_account( GtkWidget *widget, gpointer data )
{
show_account_window(NULL);
}
/*
* Should mark the account as default
*/
default_account(GtkWidget *widget, gpointer data)
{
// set account as default
if(selectedAccount)
{
dbus_set_default_account(selectedAccount->accountID);
}
}
/* Call back when the user click on an account in the list */
static void
static void
select_account(GtkTreeSelection *sel, GtkTreeModel *model)
{
GtkTreeIter iter;
......@@ -123,6 +137,7 @@ select_account(GtkTreeSelection *sel, GtkTreeModel *model)
{
gtk_widget_set_sensitive( GTK_WIDGET(editButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(deleteButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(defaultButton), TRUE);
}
g_print("select");
......@@ -130,7 +145,7 @@ select_account(GtkTreeSelection *sel, GtkTreeModel *model)
GtkWidget *
GtkWidget *
create_accounts_tab()
{
GtkWidget *ret;
......@@ -226,6 +241,12 @@ create_accounts_tab()
gtk_box_pack_start(GTK_BOX(bbox), deleteButton, FALSE, FALSE, 0);
gtk_widget_show(deleteButton);
defaultButton = gtk_button_new_with_mnemonic("Set as Default");
g_signal_connect_swapped(G_OBJECT(defaultButton), "clicked",
G_CALLBACK(default_account), NULL);
gtk_box_pack_start(GTK_BOX(bbox), defaultButton, FALSE, FALSE, 0);
gtk_widget_show(defaultButton);
gtk_widget_show_all(ret);
config_window_fill_account_list();
......@@ -233,7 +254,7 @@ create_accounts_tab()
return ret;
}
void
void
show_config_window ()
{
GtkDialog * dialog;
......@@ -263,6 +284,11 @@ show_config_window ()
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new("Accounts"));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
/*
GtkWidget* blob;//create_blob_tab();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), blob, gtk_label_new("Audio"));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), blob);
*/
gtk_dialog_run (dialog);
dialogOpen = FALSE;
......
......@@ -432,6 +432,25 @@ dbus_account_details(gchar * accountID)
return details;
}
void
dbus_set_default_account(gchar * accountID)
{
GError *error = NULL;
org_sflphone_SFLphone_ConfigurationManager_set_default_account (
configurationManagerProxy,
accountID,
&error);
if (error)
{
g_printerr("Failed to call set_default_account() on ConfigurationManager: %s\n",error->message);
g_error_free (error);
}
else
{
g_print ("DBus called set_default_account() on ConfigurationManager\n");
}
}
void
dbus_remove_account(gchar * accountID)
{
......
......@@ -50,6 +50,7 @@ void dbus_remove_account(gchar * accountID);
void dbus_set_volume(const gchar * device, gdouble value);
gdouble dbus_get_volume(const gchar * device);
void dbus_play_dtmf(const gchar * key);
void dbus_set_default_account(gchar * accountID);
/* Instance */
void dbus_register( int pid, gchar * name);
......
......@@ -34,8 +34,8 @@ public:
register_method(ConfigurationManager, getPlaybackDeviceList, _getPlaybackDeviceList_stub);
register_method(ConfigurationManager, getRecordDeviceList, _getRecordDeviceList_stub);
register_method(ConfigurationManager, getSampleRateList, _getSampleRateList_stub);
register_method(ConfigurationManager, getParameters, _getParameters_stub);
register_method(ConfigurationManager, setParameters, _setParameters_stub);
register_method(ConfigurationManager, getDefaultAccount, _getDefaultAccount_stub);
register_method(ConfigurationManager, setDefaultAccount, _setDefaultAccount_stub);
}
::DBus::IntrospectedInterface* const introspect() const
......@@ -112,14 +112,14 @@ public:
{ "list", "as", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument getParameters_args[] =
static ::DBus::IntrospectedArgument getDefaultAccount_args[] =
{
{ "parameters", "a{ss}", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setParameters_args[] =
static ::DBus::IntrospectedArgument setDefaultAccount_args[] =
{
{ "parameters", "a{ss}", true },
{ "accountID", "s", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument parametersChanged_args[] =
......@@ -147,8 +147,8 @@ public:
{ "getPlaybackDeviceList", getPlaybackDeviceList_args },
{ "getRecordDeviceList", getRecordDeviceList_args },
{ "getSampleRateList", getSampleRateList_args },
{ "getParameters", getParameters_args },
{ "setParameters", setParameters_args },
{ "getDefaultAccount", getDefaultAccount_args },
{ "setDefaultAccount", setDefaultAccount_args },
{ 0, 0 }
};
static ::DBus::IntrospectedMethod ConfigurationManager_signals[] =
......@@ -196,8 +196,8 @@ public:
virtual std::vector< ::DBus::String > getPlaybackDeviceList( ) = 0;
virtual std::vector< ::DBus::String > getRecordDeviceList( ) = 0;
virtual std::vector< ::DBus::String > getSampleRateList( ) = 0;
virtual std::map< ::DBus::String, ::DBus::String > getParameters( ) = 0;
virtual void setParameters( const std::map< ::DBus::String, ::DBus::String >& parameters ) = 0;
virtual std::map< ::DBus::String, ::DBus::String > getDefaultAccount( ) = 0;
virtual void setDefaultAccount( const ::DBus::String& accountID ) = 0;
public:
......@@ -358,22 +358,22 @@ private:
wi << argout1;
return reply;
}
::DBus::Message _getParameters_stub( const ::DBus::CallMessage& call )
::DBus::Message _getDefaultAccount_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
std::map< ::DBus::String, ::DBus::String > argout1 = getParameters();
std::map< ::DBus::String, ::DBus::String > argout1 = getDefaultAccount();
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
wi << argout1;
return reply;
}
::DBus::Message _setParameters_stub( const ::DBus::CallMessage& call )
::DBus::Message _setDefaultAccount_stub( const ::DBus::CallMessage& call )
{
::DBus::MessageIter ri = call.reader();
std::map< ::DBus::String, ::DBus::String > argin1; ri >> argin1;
setParameters(argin1);
::DBus::String argin1; ri >> argin1;
setDefaultAccount(argin1);
::DBus::ReturnMessage reply(call);
return reply;
}
......
......@@ -60,12 +60,12 @@
<arg type="as" name="list" direction="out"/>
</method>
<method name="getParameters">
<method name="getDefaultAccount">
<arg type="a{ss}" name="parameters" direction="out"/>
</method>
<method name="setParameters">
<arg type="a{ss}" name="parameters" direction="in"/>
<method name="setDefaultAccount">
<arg type="s" name="accountID" direction="in"/>
</method>
<signal name="parametersChanged">
......
......@@ -26,19 +26,19 @@ const char* ConfigurationManager::SERVER_PATH = "/org/sflphone/SFLphone/Configur
ConfigurationManager::ConfigurationManager( DBus::Connection& connection )
ConfigurationManager::ConfigurationManager( DBus::Connection& connection )
: DBus::ObjectAdaptor(connection, SERVER_PATH)
{
}
std::map< ::DBus::String, ::DBus::String >
std::map< ::DBus::String, ::DBus::String >
ConfigurationManager::getAccountDetails( const ::DBus::String& accountID )
{
_debug("ConfigurationManager::getAccountDetails received\n");
return Manager::instance().getAccountDetails(accountID);
}
void
void
ConfigurationManager::setAccountDetails( const ::DBus::String& accountID,
const std::map< ::DBus::String, ::DBus::String >& details )
{
......@@ -46,7 +46,7 @@ ConfigurationManager::setAccountDetails( const ::DBus::String& accountID,
Manager::instance().setAccountDetails(accountID, details);
}
void
void
ConfigurationManager::addAccount( const std::map< ::DBus::String, ::DBus::String >& details )
{
_debug("ConfigurationManager::addAccount received\n");
......@@ -54,14 +54,14 @@ ConfigurationManager::addAccount( const std::map< ::DBus::String, ::DBus::String
}
void
void
ConfigurationManager::removeAccount( const ::DBus::String& accoundID )
{
_debug("ConfigurationManager::removeAccount received\n");
return Manager::instance().removeAccount(accoundID);
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getAccountList( )
{
_debug("ConfigurationManager::getAccountList received\n");
......@@ -69,7 +69,7 @@ ConfigurationManager::getAccountList( )
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getToneLocaleList( )
{
_debug("ConfigurationManager::getToneLocaleList received\n");
......@@ -78,7 +78,7 @@ ConfigurationManager::getToneLocaleList( )
::DBus::String
::DBus::String
ConfigurationManager::getVersion( )
{
_debug("ConfigurationManager::getVersion received\n");
......@@ -86,7 +86,7 @@ ConfigurationManager::getVersion( )
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getRingtoneList( )
{
_debug("ConfigurationManager::getRingtoneList received\n");
......@@ -95,7 +95,7 @@ ConfigurationManager::getRingtoneList( )
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getCodecList( )
{
_debug("ConfigurationManager::getCodecList received\n");
......@@ -103,7 +103,7 @@ ConfigurationManager::getCodecList( )
}
void
void
ConfigurationManager::setCodecPreferedOrder( const std::vector< ::DBus::String >& ringtone )
{
_debug("ConfigurationManager::setCodecPreferedOrder received\n");
......@@ -111,7 +111,7 @@ ConfigurationManager::setCodecPreferedOrder( const std::vector< ::DBus::String >
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getCodecPreferedOrder( )
{
_debug("ConfigurationManager::getCodecPreferedOrder received\n");
......@@ -119,35 +119,40 @@ ConfigurationManager::getCodecPreferedOrder( )
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getPlaybackDeviceList( )
{
_debug("ConfigurationManager::getPlaybackDeviceList received\n");
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getRecordDeviceList( )
{
_debug("ConfigurationManager::getRecordDeviceList received\n");
}
std::vector< ::DBus::String >
std::vector< ::DBus::String >
ConfigurationManager::getSampleRateList( )
{
_debug("ConfigurationManager::getSampleRateList received\n");
}
std::map< ::DBus::String, ::DBus::String >
ConfigurationManager::getParameters( )