Commit 803613ad authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

implements the get_default_account function on the server side

parent f844e68f
......@@ -542,22 +542,22 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_ConfigurationManager_get_default_account (DBusGProxy *proxy, GHashTable** OUT_parameters, GError **error)
org_sflphone_SFLphone_ConfigurationManager_get_default_account (DBusGProxy *proxy, char ** OUT_accountID, GError **error)
{
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);
return dbus_g_proxy_call (proxy, "getDefaultAccount", error, G_TYPE_INVALID, G_TYPE_STRING, OUT_accountID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply) (DBusGProxy *proxy, GHashTable *OUT_parameters, GError *error, gpointer userdata);
typedef void (*org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply) (DBusGProxy *proxy, char * OUT_accountID, GError *error, gpointer userdata);
static void
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_default_account_reply)data->cb) (proxy, OUT_parameters, error, data->userdata);
char * OUT_accountID;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_STRING, &OUT_accountID, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_ConfigurationManager_get_default_account_reply)data->cb) (proxy, OUT_accountID, error, data->userdata);
return;
}
......
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......@@ -432,6 +433,28 @@ dbus_account_details(gchar * accountID)
return details;
}
gchar *
dbus_get_default_account( )
{
GError *error = NULL;
gchar * accountID;
org_sflphone_SFLphone_ConfigurationManager_get_default_account (
configurationManagerProxy,
&accountID,
&error);
if (error)
{
g_printerr("Failed to call get_default_account() on ConfigurationManager: %s\n",error->message);
g_error_free (error);
}
else
{
g_print ("DBus called get_default_account() on ConfigurationManager\n");
}
}
void
dbus_set_default_account(gchar * accountID)
{
......
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......@@ -50,6 +51,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);
gchar* dbus_get_default_account();
void dbus_set_default_account(gchar * accountID);
/* Instance */
......
......@@ -114,7 +114,7 @@ public:
};
static ::DBus::IntrospectedArgument getDefaultAccount_args[] =
{
{ "parameters", "a{ss}", false },
{ "accountID", "s", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setDefaultAccount_args[] =
......@@ -196,7 +196,7 @@ 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 > getDefaultAccount( ) = 0;
virtual ::DBus::String getDefaultAccount( ) = 0;
virtual void setDefaultAccount( const ::DBus::String& accountID ) = 0;
public:
......@@ -362,7 +362,7 @@ private:
{
::DBus::MessageIter ri = call.reader();
std::map< ::DBus::String, ::DBus::String > argout1 = getDefaultAccount();
::DBus::String argout1 = getDefaultAccount();
::DBus::ReturnMessage reply(call);
::DBus::MessageIter wi = reply.writer();
wi << argout1;
......
......@@ -61,7 +61,7 @@
</method>
<method name="getDefaultAccount">
<arg type="a{ss}" name="parameters" direction="out"/>
<arg type="s" name="accountID" direction="out"/>
</method>
<method name="setDefaultAccount">
......
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......@@ -140,10 +141,11 @@ ConfigurationManager::getSampleRateList( )
}
std::map< ::DBus::String, ::DBus::String >
::DBus::String
ConfigurationManager::getDefaultAccount( )
{
_debug("ConfigurationManager::getDefaultAccount received\n");
return Manager::instance().getDefaultAccount();
}
/*
......
......@@ -2,10 +2,11 @@
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......@@ -51,7 +52,7 @@ public:
std::vector< ::DBus::String > getPlaybackDeviceList( );
std::vector< ::DBus::String > getRecordDeviceList( );
std::vector< ::DBus::String > getSampleRateList( );
std::map< ::DBus::String, ::DBus::String > getDefaultAccount( );
::DBus::String getDefaultAccount( );
void setDefaultAccount( const ::DBus::String& accountID );
};
......
......@@ -3,10 +3,11 @@
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......@@ -1783,6 +1784,15 @@ ManagerImpl::removeAccount(const AccountID& accountID)
if (_dbus) _dbus->getConfigurationManager()->accountsChanged();
}
std::string
ManagerImpl::getDefaultAccount()
{
std::string id;
id = getConfigString(PREFERENCES, "DefaultAccount");
_debug("Default Account = %s\n",id.c_str());
return id;
}
void
ManagerImpl::setDefaultAccount(const AccountID& accountID)
{
......
......@@ -2,10 +2,11 @@
* Copyright (C) 2004-2005 Savoir-Faire Linux inc.
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
* Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......@@ -254,6 +255,11 @@ public:
*/
void removeAccount(const AccountID& accountID);
/*
* get the default account
*/
std::string getDefaultAccount();
/*
* Set an account as default
*/
......
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