diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 6b1aaf7c3fcad92b30537b8902025cd593704ba7..bbe634b742fa3140bb8c26072ae5d75678e28bc4 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -141,19 +141,25 @@ sflphone_hung_up( call_t * c) void sflphone_fill_account_list(gboolean toolbarInitialized) { + + gchar** array; + gchar** accountID; + unsigned int i; + account_list_clear ( ); - gchar ** array = (gchar **)dbus_account_list(); - gchar ** accountID; - for (accountID = array; *accountID; accountID++) - { - account_t * a = g_new0(account_t,1); - a->accountID = g_strdup(*accountID); - account_list_add(a); - } - g_strfreev (array); + array = (gchar **)dbus_account_list(); + if(array) + { + for (accountID = array; *accountID; accountID++) + { + account_t * a = g_new0(account_t,1); + a->accountID = g_strdup(*accountID); + account_list_add(a); + } + g_strfreev (array); + } - unsigned int i; for( i = 0; i < account_list_get_size(); i++) { account_t * a = account_list_get_nth (i); diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index 2303dc6489ceca7d832806cb2ceb0452a3eeded8..a5f037e1a39a213d286a8b32fddb6dacd2573838 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -418,55 +418,45 @@ dbus_place_call (const call_t * c) } -gchar ** -dbus_account_list() +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", - error->message); - g_error_free (error); - } - else - { - g_print ("DBus called get_account_list() on ConfigurationManager\n"); + GError *error = NULL; + char ** array; - } - return array; + if(!org_sflphone_SFLphone_ConfigurationManager_get_account_list ( configurationManagerProxy, &array, &error)) + { + if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + g_printerr ("Caught remote method (get_account_list) exception %s: %s\n", dbus_g_error_get_name(error), error->message); + else + g_printerr("Error while calling get_account_list: %s\n", error->message); + g_error_free (error); + return NULL; + } + else{ + g_print ("DBus called get_account_list() on ConfigurationManager\n"); + return array; + } } -GHashTable * -dbus_account_details(gchar * accountID) -{ - GError *error = NULL; - GHashTable * details; - org_sflphone_SFLphone_ConfigurationManager_get_account_details ( - configurationManagerProxy, - accountID, - &details, - &error); - if (error) - { - g_printerr ("Failed to call get_account_details() on ConfigurationManager: %s\n", - error->message); - g_error_free (error); - } - else - { - g_print ("DBus called get_account_details() on ConfigurationManager\n"); - } - return details; +GHashTable* dbus_account_details(gchar * accountID) +{ + GError *error = NULL; + GHashTable * details; + + if(!org_sflphone_SFLphone_ConfigurationManager_get_account_details( configurationManagerProxy, accountID, &details, &error)) + { + if(error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION) + g_printerr ("Caught remote method (get_account_details) exception %s: %s\n", dbus_g_error_get_name(error), error->message); + else + g_printerr("Error while calling get_account_details: %s\n", error->message); + g_error_free (error); + return NULL; + } + else{ + g_print ("DBus called get_account_details() on ConfigurationManager\n"); + return details; + } } void