diff --git a/sflphone-gtk/src/configurationmanager-glue.h b/sflphone-gtk/src/configurationmanager-glue.h index 58572f1dc5583c97286f16f6a84e02375b00c91f..b000ecbce353090af793f245f8ae806fecb3dc37 100644 --- a/sflphone-gtk/src/configurationmanager-glue.h +++ b/sflphone-gtk/src/configurationmanager-glue.h @@ -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; } diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index 53b45f10cf9bf6c18c9580dcbccb009c0aa9eddd..c8de379268d06a746b09b6dc663cd52cad73f35a 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -1,10 +1,11 @@ /* * 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) { diff --git a/sflphone-gtk/src/dbus.h b/sflphone-gtk/src/dbus.h index c84a20442b5b82ca52bf028748dbc0d29a63fc38..0f9d79c319ad929ffa4d1efc1a742c27ca46d58b 100644 --- a/sflphone-gtk/src/dbus.h +++ b/sflphone-gtk/src/dbus.h @@ -1,10 +1,11 @@ /* * 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 */ diff --git a/src/dbus/configurationmanager-glue.h b/src/dbus/configurationmanager-glue.h index 9ab30db68815b6b9fe90d2391a5863246e013bb1..2050874662a9cf18513250f7f8d5c73c2f42e787 100644 --- a/src/dbus/configurationmanager-glue.h +++ b/src/dbus/configurationmanager-glue.h @@ -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; diff --git a/src/dbus/configurationmanager-introspec.xml b/src/dbus/configurationmanager-introspec.xml index d46e5abac146840f1749b2e476e2b4ce3ecef8a7..11d733cf5b84edb122bab5e8320b01d9a55eabc5 100644 --- a/src/dbus/configurationmanager-introspec.xml +++ b/src/dbus/configurationmanager-introspec.xml @@ -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"> diff --git a/src/dbus/configurationmanager.cpp b/src/dbus/configurationmanager.cpp index d75df4b5ee7d0602b4f8af0cd60b003753765ff2..b736c5f38c94c2fa4f4910caa6b68ececba0209e 100644 --- a/src/dbus/configurationmanager.cpp +++ b/src/dbus/configurationmanager.cpp @@ -1,10 +1,11 @@ /* * 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(); } /* diff --git a/src/dbus/configurationmanager.h b/src/dbus/configurationmanager.h index fa157c69fe12cb9111369ec3baecc4aa4f1f4837..38e95846ee41679827c6ab25896866b76ef9778d 100644 --- a/src/dbus/configurationmanager.h +++ b/src/dbus/configurationmanager.h @@ -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 ); }; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 58f153bda5200d3b35c95a24fc976bcdc484f406..0e92c0c9711f5953afcf2e193ad1e8def3230385 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -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) { diff --git a/src/managerimpl.h b/src/managerimpl.h index a14cc24e016af095ae7eeb3014a246b93e41431e..0c49d8ee119b8d37215d4a5895ba60236a81b7cf 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -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 */