From bcb343fb6e307434a18bfd8ee0517aba62665134 Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Thu, 25 Aug 2011 18:26:16 -0400
Subject: [PATCH] * #6737: cleanup in dbus

---
 daemon/src/dbus/callmanager-introspec.xml |   2 +-
 gnome/src/dbus/callmanager-introspec.xml  |   2 +-
 gnome/src/dbus/dbus.c                     | 361 ++++++++--------------
 3 files changed, 127 insertions(+), 238 deletions(-)

diff --git a/daemon/src/dbus/callmanager-introspec.xml b/daemon/src/dbus/callmanager-introspec.xml
index 5c6591855e..030ac6366a 100644
--- a/daemon/src/dbus/callmanager-introspec.xml
+++ b/daemon/src/dbus/callmanager-introspec.xml
@@ -349,7 +349,7 @@
 			<arg type="s" name="filepath"/>
 		</signal>
 
-		<signal name="recordPlaybackStoped" tp:name-for-bindings="recordPlaybackStoped">
+		<signal name="recordPlaybackStopped" tp:name-for-bindings="recordPlaybackStopped">
 			<tp:docstring/>
 			<arg type="s" name="filepath" />
 		</signal>
diff --git a/gnome/src/dbus/callmanager-introspec.xml b/gnome/src/dbus/callmanager-introspec.xml
index 5c6591855e..030ac6366a 100644
--- a/gnome/src/dbus/callmanager-introspec.xml
+++ b/gnome/src/dbus/callmanager-introspec.xml
@@ -349,7 +349,7 @@
 			<arg type="s" name="filepath"/>
 		</signal>
 
-		<signal name="recordPlaybackStoped" tp:name-for-bindings="recordPlaybackStoped">
+		<signal name="recordPlaybackStopped" tp:name-for-bindings="recordPlaybackStopped">
 			<tp:docstring/>
 			<arg type="s" name="filepath" />
 		</signal>
diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c
index 62b7fe91db..19697c1e63 100644
--- a/gnome/src/dbus/dbus.c
+++ b/gnome/src/dbus/dbus.c
@@ -95,7 +95,7 @@ static void
 record_playback_filepath_cb (DBusGProxy *, const gchar *, const gchar *);
 
 static void
-record_playback_stoped_cb (DBusGProxy *, const gchar *);
+record_playback_stopped_cb (DBusGProxy *, const gchar *);
 
 static void
 accounts_changed_cb (DBusGProxy *, void *);
@@ -352,9 +352,8 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
         call_id = (gchar*) (part->data);
         call = calllist_get_call (current_calls, call_id);
 
-        if (call && call->_im_widget) {
+        if (call && call->_im_widget)
             im_widget_update_state (IM_WIDGET (call->_im_widget), TRUE);
-	}
 
         part = g_slist_next (part);
     }
@@ -369,9 +368,8 @@ conference_changed_cb (DBusGProxy *proxy UNUSED, const gchar* confID,
         call_id = (gchar*) (part->data);
         call = calllist_get_call (current_calls, call_id);
 
-        if (call && call->_im_widget) {
+        if (call && call->_im_widget)
             im_widget_update_state (IM_WIDGET (call->_im_widget), FALSE);
-	}
 
         part = g_slist_next (part);
     }
@@ -392,9 +390,8 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
     // Update conference list
     conference_participant_list_update (participants, new_conf);
 
-    gchar** part;
     // Add conference ID in in each calls
-    for (part = participants; *part; part++) {
+    for (gchar **part = participants; *part; part++) {
         const gchar *const call_id = (gchar*) (*part);
         callable_obj_t *call = calllist_get_call (current_calls, call_id);
 
@@ -429,17 +426,16 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
     conference_obj_t * c = conferencelist_get (current_calls, confID);
     calltree_remove_conference (current_calls, c, NULL);
 
-    GSList *participant = c->participant_list;
-    callable_obj_t *call;
-
     // deactivate instant messaging window for this conference
     if (c->_im_widget)
         im_widget_update_state (IM_WIDGET (c->_im_widget), FALSE);
 
+    GSList *participant = c->participant_list;
+
     // remove all participant for this conference
     while (participant) {
 
-        call = calllist_get_call (current_calls, (const gchar *) (participant->data));
+        callable_obj_t *call = calllist_get_call (current_calls, (const gchar *) (participant->data));
 
         if (call) {
             DEBUG ("DBUS: Remove participant %s", call->_callID);
@@ -463,79 +459,56 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
 static void
 record_playback_filepath_cb (DBusGProxy *proxy UNUSED, const gchar *id, const gchar *filepath)
 {
-    callable_obj_t *call = NULL;
-    conference_obj_t *conf = NULL;
-
-    DEBUG("DBUS: Filepath for %s: %s", id, filepath); 
+    DEBUG("DBUS: Filepath for %s: %s", id, filepath);
 
-    call = calllist_get_call(current_calls, id);
-    conf = conferencelist_get(current_calls, id);
+    callable_obj_t *call = calllist_get_call(current_calls, id);
+    conference_obj_t *conf = conferencelist_get(current_calls, id);
 
-    if(call && conf) {
-	ERROR("DBUS: Two object for this callid");
-	return;
+    if (call && conf) {
+        ERROR("DBUS: Two objects for this callid");
+        return;
     }
 
-    if(!call && !conf) {
+    if (!call && !conf) {
         ERROR("DBUS: Could not get object");
-	return;
-    } 
-
-    if(call) {
-	if(call->_recordfile == NULL) 
-            call->_recordfile = g_strdup(filepath);
-    }
-    else if(conf) {
-        if(conf->_recordfile == NULL)
-            conf->_recordfile = g_strdup(filepath); 
+        return;
     }
+
+    if(call && call->_recordfile == NULL)
+        call->_recordfile = g_strdup(filepath);
+    else if(conf && conf->_recordfile == NULL)
+        conf->_recordfile = g_strdup(filepath);
 }
 
 static void
-record_playback_stoped_cb (DBusGProxy *proxy UNUSED, const gchar *filepath)
+record_playback_stopped_cb (DBusGProxy *proxy UNUSED, const gchar *filepath)
 {
-    QueueElement *element;
-    callable_obj_t *call = NULL;
-    conference_obj_t *conf = NULL;
-    gint calllist_size, conflist_size;
-    gchar *recfile;
-    gint i;
-
-    DEBUG("DBUS: Playback stoped for %s", filepath);
+    DEBUG("DBUS: Playback stopped for %s", filepath);
 
-    calllist_size = calllist_get_size(history);
-    conflist_size = conferencelist_get_size(history);
+    const gint calllist_size = calllist_get_size(history);
 
-    for (i = 0; i < calllist_size; i++) {
-        recfile = NULL;
-        element = calllist_get_nth(history, i);	
+    for (gint i = 0; i < calllist_size; i++) {
+        QueueElement *element = calllist_get_nth(history, i);
         if (element == NULL) {
             ERROR("DBUS: ERROR: Could not find %dth call", i);
             break;
-        }
-	
-        if (element->type == HIST_CALL) {
-            call =  element->elem.call;
-            recfile = call->_recordfile;
-            if(recfile && (g_strcmp0(recfile, filepath) == 0)) {
-                call->_record_is_playing = FALSE;
-            }
-        }
+        } else if (element->type == HIST_CALL &&
+                g_strcmp0(element->elem.call->_recordfile, filepath) == 0)
+            element->elem.call->_record_is_playing = FALSE;
     }
 
-    for(i = 0; i < conflist_size; i++) {
-        conf = conferencelist_get_nth(history, i);
-        if(conf == NULL) {
+    const gint conflist_size = conferencelist_get_size(history);
+
+    for (gint i = 0; i < conflist_size; i++) {
+        conference_obj_t *conf = conferencelist_get_nth(history, i);
+        if (conf == NULL) {
             ERROR("DBUS: ERROR: Could not find %dth conf", i);
             break;
-        }
-
-        recfile = conf->_recordfile;
-        if (recfile && (g_strcmp0(recfile, filepath) == 0))
+        } else if (g_strcmp0(conf->_recordfile, filepath) == 0)
             conf->_record_is_playing = FALSE;
     }
 
-    update_actions();   
+    update_actions();
 }
 
 static void
@@ -627,9 +600,8 @@ show_zrtp_sas_cb (DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* sa
     DEBUG ("DBUS: Showing SAS");
     callable_obj_t * c = calllist_get_call (current_calls, callID);
 
-    if (c) {
+    if (c)
         sflphone_srtp_zrtp_show_sas (c, sas, verified);
-    }
 }
 
 static void
@@ -638,8 +610,9 @@ confirm_go_clear_cb (DBusGProxy *proxy UNUSED, const gchar* callID, void * foo
     DEBUG ("DBUS: Confirm Go Clear request");
 
     callable_obj_t * c = calllist_get_call (current_calls, callID);
+
     if (c)
-        main_window_confirm_go_clear (c);
+        sflphone_confirm_go_clear (c);
 }
 
 static void
@@ -658,11 +631,9 @@ static void
 sip_call_state_cb (DBusGProxy *proxy UNUSED, const gchar* callID,
                    const gchar* description, const guint code, void * foo  UNUSED)
 {
-    callable_obj_t * c = NULL;
-
     DEBUG("DBUS: Sip call state changed %s", callID);
 
-    c = calllist_get_call (current_calls, callID);
+    callable_obj_t *c = calllist_get_call (current_calls, callID);
     if (c == NULL) {
         ERROR("DBUS: Error call is NULL in state changed (call may not have been created yet)");
         return;
@@ -799,9 +770,9 @@ dbus_connect (GError **error)
 				G_TYPE_STRING, G_TYPE_INVALID);
     dbus_g_proxy_connect_signal (callManagerProxy, "recordPlaybackFilepath",
 				G_CALLBACK (record_playback_filepath_cb), NULL, NULL);
-    dbus_g_proxy_add_signal (callManagerProxy, "recordPlaybackStoped", G_TYPE_STRING, G_TYPE_INVALID);
-    dbus_g_proxy_connect_signal(callManagerProxy, "recordPlaybackStoped",
-    				G_CALLBACK (record_playback_stoped_cb), NULL, NULL);
+    dbus_g_proxy_add_signal (callManagerProxy, "recordPlaybackStopped", G_TYPE_STRING, G_TYPE_INVALID);
+    dbus_g_proxy_connect_signal(callManagerProxy, "recordPlaybackStopped",
+    				G_CALLBACK (record_playback_stopped_cb), NULL, NULL);
 
     /* Security related callbacks */
 
@@ -894,10 +865,9 @@ dbus_clean()
 void
 dbus_hold (const callable_obj_t * c)
 {
-    GError *error = NULL;
-    
     DEBUG ("DBUS: Hold %s\n", c->_callID);
-    
+
+    GError *error = NULL;
     org_sflphone_SFLphone_CallManager_hold (callManagerProxy, c->_callID, &error);
 
     if (error) {
@@ -910,10 +880,9 @@ dbus_hold (const callable_obj_t * c)
 void
 dbus_unhold (const callable_obj_t * c)
 {
-    GError *error = NULL;
-    
     DEBUG ("DBUS: Unhold call %s\n", c->_callID);
-    
+
+    GError *error = NULL;
     org_sflphone_SFLphone_CallManager_unhold (callManagerProxy, c->_callID, &error);
 
     if (error) {
@@ -966,9 +935,9 @@ dbus_start_recorded_file_playback(const gchar *filepath)
     org_sflphone_SFLphone_CallManager_start_recorded_file_playback(callManagerProxy,
 	filepath, &result, &error);
 
-    if(error) {
+    if (error) {
         ERROR("Failed to call recorded file playback: %s", error->message);
-	g_error_free(error);
+        g_error_free(error);
     }
 
     return result;
@@ -982,9 +951,9 @@ dbus_stop_recorded_file_playback(const gchar *filepath)
     org_sflphone_SFLphone_CallManager_stop_recorded_file_playback(callManagerProxy,
 	filepath, &error);
 
-    if(error) {
+    if (error) {
         ERROR("Failed to call stop recorded file playback: %s", error->message);
-	g_error_free(error);
+        g_error_free(error);
     }
 }
 
@@ -1044,7 +1013,7 @@ dbus_attended_transfer (const callable_obj_t *transfer, const callable_obj_t *ta
     org_sflphone_SFLphone_CallManager_attended_transfer (callManagerProxy, transfer->_callID,
         target->_callID, &error);
 
-    if(error) {
+    if (error) {
         ERROR("Failed to call transfer() on CallManager: %s",
               error->message);
         g_error_free(error);
@@ -1093,7 +1062,7 @@ void
 dbus_place_call (const callable_obj_t * c)
 {
     GError *error = NULL;
- 
+
     DEBUG("DBUS: Place call %s", c->_callID);
 
     org_sflphone_SFLphone_CallManager_place_call (callManagerProxy, c->_accountID,
@@ -1110,30 +1079,28 @@ gchar**
 dbus_account_list()
 {
     GError *error = NULL;
-    char ** array;
+    char ** array = NULL;
 
     if (!org_sflphone_SFLphone_ConfigurationManager_get_account_list (
                 configurationManagerProxy, &array, &error)) {
-        if (error->domain == DBUS_GERROR && error->code
-                == DBUS_GERROR_REMOTE_EXCEPTION) {
+        if (error->domain == DBUS_GERROR &&
+                error->code == DBUS_GERROR_REMOTE_EXCEPTION)
             ERROR ("Caught remote method (get_account_list) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-        } else {
+        else
             ERROR ("Error while calling get_account_list: %s", error->message);
-        }
 
         g_error_free (error);
-        return NULL;
-    } else {
+    } else
         DEBUG ("DBus called get_account_list() on ConfigurationManager");
-        return array;
-    }
+
+    return array;
 }
 
 GHashTable*
 dbus_get_account_details (gchar * accountID)
 {
     GError *error = NULL;
-    GHashTable * details;
+    GHashTable * details = NULL;
 
     DEBUG ("Dbus: Get account detail for %s", accountID);
 
@@ -1147,18 +1114,16 @@ dbus_get_account_details (gchar * accountID)
         }
 
         g_error_free (error);
-        return NULL;
-    } else {
-        return details;
     }
+    return details;
 }
 
 void
 dbus_set_credentials (account_t *a)
 {
-    GError *error = NULL;
     DEBUG ("DBUS: Sending credentials to server");
 
+    GError *error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_set_credentials (
         configurationManagerProxy, a->accountID, a->credential_information, &error);
 
@@ -1172,19 +1137,18 @@ dbus_set_credentials (account_t *a)
 void
 dbus_get_credentials (account_t *a)
 {
-    GError *error = NULL;
     DEBUG("DBUS: Get credential for account %s", a->accountID);
 
+    GError *error = NULL;
     if (org_sflphone_SFLphone_ConfigurationManager_get_credentials (
                 configurationManagerProxy, a->accountID, &a->credential_information, &error))
         return;
 
-    if (error->domain == DBUS_GERROR && error->code
-            == DBUS_GERROR_REMOTE_EXCEPTION) {
+    if (error->domain == DBUS_GERROR &&
+            error->code == DBUS_GERROR_REMOTE_EXCEPTION)
         ERROR ("Caught remote method (get_account_details) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-    } else {
+    else
         ERROR ("Error while calling get_account_details: %s", error->message);
-    }
 
     g_error_free (error);
 }
@@ -1193,22 +1157,19 @@ GHashTable*
 dbus_get_ip2_ip_details (void)
 {
     GError *error = NULL;
-    GHashTable * details;
+    GHashTable * details = NULL;
 
     if (!org_sflphone_SFLphone_ConfigurationManager_get_ip2_ip_details (
                 configurationManagerProxy, &details, &error)) {
-        if (error->domain == DBUS_GERROR && error->code
-                == DBUS_GERROR_REMOTE_EXCEPTION) {
+        if (error->domain == DBUS_GERROR &&
+                error->code == DBUS_GERROR_REMOTE_EXCEPTION)
             ERROR ("Caught remote method (get_ip2_ip_details) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-        } else {
+        else
             ERROR ("Error while calling get_ip2_ip_details: %s", error->message);
-        }
 
         g_error_free (error);
-        return NULL;
-    } else {
-        return details;
     }
+    return details;
 }
 
 void
@@ -1351,7 +1312,6 @@ dbus_unregister (int pid)
 gchar**
 dbus_audio_codec_list()
 {
-
     GError *error = NULL;
     gchar** array = NULL;
     org_sflphone_SFLphone_ConfigurationManager_get_audio_codec_list (
@@ -1369,7 +1329,6 @@ dbus_audio_codec_list()
 gchar**
 dbus_audio_codec_details (int payload)
 {
-
     GError *error = NULL;
     gchar ** array;
     org_sflphone_SFLphone_ConfigurationManager_get_audio_codec_details (
@@ -1387,7 +1346,6 @@ dbus_audio_codec_details (int payload)
 gchar*
 dbus_get_current_audio_codec_name (const callable_obj_t * c)
 {
-
     gchar* codecName = NULL;
     GError* error = NULL;
 
@@ -1409,7 +1367,7 @@ gchar**
 dbus_get_active_audio_codec_list (gchar *accountID)
 {
 
-    gchar ** array;
+    gchar ** array = NULL;
     GError *error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_get_active_audio_codec_list (
         configurationManagerProxy, accountID, &array, &error);
@@ -1438,30 +1396,26 @@ dbus_set_active_audio_codec_list (const gchar** list, const gchar *accountID)
     }
 }
 
-
 /**
  * Get a list of output supported audio plugins
  */
 gchar**
 dbus_get_audio_plugin_list()
 {
-    gchar** array;
+    gchar** array = NULL;
     GError* error = NULL;
 
     if (!org_sflphone_SFLphone_ConfigurationManager_get_audio_plugin_list (
                 configurationManagerProxy, &array, &error)) {
-        if (error->domain == DBUS_GERROR && error->code
-                == DBUS_GERROR_REMOTE_EXCEPTION) {
+        if (error->domain == DBUS_GERROR &&
+                error->code == DBUS_GERROR_REMOTE_EXCEPTION)
             ERROR ("Caught remote method (get_output_plugin_list) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-        } else {
+        else
             ERROR ("Error while calling get_out_plugin_list: %s", error->message);
-        }
 
         g_error_free (error);
-        return NULL;
-    } else {
-        return array;
     }
+    return array;
 }
 
 void
@@ -1483,7 +1437,7 @@ dbus_set_audio_plugin (gchar* audioPlugin)
 gchar**
 dbus_get_audio_output_device_list()
 {
-    gchar** array;
+    gchar** array = NULL;
     GError* error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_get_audio_output_device_list (
         configurationManagerProxy, &array, &error);
@@ -1550,7 +1504,7 @@ dbus_set_audio_ringtone_device (const int index)
 gchar**
 dbus_get_audio_input_device_list()
 {
-    gchar** array;
+    gchar** array = NULL;
     GError* error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_get_audio_input_device_list (
         configurationManagerProxy, &array, &error);
@@ -1569,7 +1523,7 @@ dbus_get_audio_input_device_list()
 gchar**
 dbus_get_current_audio_devices_index()
 {
-    gchar** array;
+    gchar** array = NULL;
     GError* error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_get_current_audio_devices_index (
         configurationManagerProxy, &array, &error);
@@ -1588,7 +1542,7 @@ dbus_get_current_audio_devices_index()
 int
 dbus_get_audio_device_index (const gchar *name)
 {
-    int index;
+    int index = 0;
     GError* error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_get_audio_device_index (
         configurationManagerProxy, name, &index, &error);
@@ -1689,7 +1643,7 @@ int
 dbus_get_echo_cancel_tail_length(void)
 {
     GError *error = NULL;
-    int length;
+    int length = 0;
 
     org_sflphone_SFLphone_ConfigurationManager_get_echo_cancel_tail_length(configurationManagerProxy, &length, &error);
 
@@ -1717,11 +1671,11 @@ int
 dbus_get_echo_cancel_delay(void)
 {
     GError *error = NULL;
-    int delay;
+    int delay = 0;
 
     org_sflphone_SFLphone_ConfigurationManager_get_echo_cancel_delay(configurationManagerProxy, &delay, &error);
 
-    if(error) {
+    if (error) {
         ERROR("DBus: Failed to call get_echo_cancel_tail_length() on ConfigurationManager: %s", error->message);
         g_error_free(error);
     }
@@ -1736,7 +1690,7 @@ dbus_set_echo_cancel_delay(int delay)
 
     org_sflphone_SFLphone_ConfigurationManager_set_echo_cancel_delay(configurationManagerProxy, delay, &error);
 
-    if(error) {
+    if (error) {
         ERROR("DBus: Failed to call get_echo_cancel_delay() on ConfigurationManager: %s", error->message);
         g_error_free(error);
     }
@@ -1746,14 +1700,13 @@ dbus_set_echo_cancel_delay(int delay)
 int
 dbus_is_iax2_enabled()
 {
-    int res;
+    int res = 0;
     GError* error = NULL;
     org_sflphone_SFLphone_ConfigurationManager_is_iax2_enabled (
         configurationManagerProxy, &res, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 
     return res;
 }
@@ -1769,9 +1722,8 @@ dbus_join_participant (const gchar* sel_callID, const gchar* drag_callID)
     org_sflphone_SFLphone_CallManager_join_participant (callManagerProxy,
             sel_callID, drag_callID, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 
 }
 
@@ -1785,16 +1737,15 @@ dbus_create_conf_from_participant_list(const gchar **list) {
     org_sflphone_SFLphone_CallManager_create_conf_from_participant_list(callManagerProxy,
 	list, &error);
 
-    if(error) {
-	DEBUG("DBUS: Error: %s", error->message);
-	g_error_free(error);
+    if (error) {
+        DEBUG("DBUS: Error: %s", error->message);
+        g_error_free(error);
     }
-}  
+}
 
 void
 dbus_add_participant (const gchar* callID, const gchar* confID)
 {
-
     DEBUG ("DBUS: Add participant %s to %s\n", callID, confID);
 
     GError* error = NULL;
@@ -1802,10 +1753,8 @@ dbus_add_participant (const gchar* callID, const gchar* confID)
     org_sflphone_SFLphone_CallManager_add_participant (callManagerProxy, callID,
             confID, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
-
 }
 
 void
@@ -1818,9 +1767,8 @@ dbus_add_main_participant (const gchar* confID)
     org_sflphone_SFLphone_CallManager_add_main_participant (callManagerProxy,
             confID, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 }
 
 void
@@ -1833,10 +1781,8 @@ dbus_detach_participant (const gchar* callID)
     org_sflphone_SFLphone_CallManager_detach_participant (callManagerProxy,
             callID, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
-
 }
 
 void
@@ -1850,10 +1796,8 @@ dbus_join_conference (const gchar* sel_confID, const gchar* drag_confID)
     org_sflphone_SFLphone_CallManager_join_conference (callManagerProxy,
             sel_confID, drag_confID, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
-
 }
 
 void
@@ -1864,9 +1808,8 @@ dbus_set_record (const gchar* id)
     GError* error = NULL;
     org_sflphone_SFLphone_CallManager_set_recording (callManagerProxy, id, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 }
 
 gboolean
@@ -1878,9 +1821,8 @@ dbus_get_is_recording (const callable_obj_t * c)
     org_sflphone_SFLphone_CallManager_get_is_recording (callManagerProxy,
             c->_callID, &isRecording, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 
     //DEBUG("RECORDING: %i",isRecording);
     return isRecording;
@@ -1893,9 +1835,8 @@ dbus_set_record_path (const gchar* path)
     org_sflphone_SFLphone_ConfigurationManager_set_record_path (
         configurationManagerProxy, path, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 }
 
 gchar*
@@ -1906,9 +1847,8 @@ dbus_get_record_path (void)
     org_sflphone_SFLphone_ConfigurationManager_get_record_path (
         configurationManagerProxy, &path, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 
     return path;
 }
@@ -1947,9 +1887,8 @@ dbus_set_history_limit (const guint days)
     org_sflphone_SFLphone_ConfigurationManager_set_history_limit (
         configurationManagerProxy, days, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 }
 
 guint
@@ -1960,9 +1899,8 @@ dbus_get_history_limit (void)
     org_sflphone_SFLphone_ConfigurationManager_get_history_limit (
         configurationManagerProxy, &days, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 
     return (guint) days;
 }
@@ -1974,9 +1912,8 @@ dbus_set_audio_manager (int api)
     org_sflphone_SFLphone_ConfigurationManager_set_audio_manager (
         configurationManagerProxy, api, &error);
 
-    if (error) {
+    if (error)
         g_error_free (error);
-    }
 }
 
 int
@@ -1995,40 +1932,6 @@ dbus_get_audio_manager (void)
     return api;
 }
 
-/*
-   void
-   dbus_set_sip_address( const gchar* address )
-   {
-   GError* error = NULL;
-   org_sflphone_SFLphone_ConfigurationManager_set_sip_address(
-   configurationManagerProxy,
-   address,
-   &error);
-   if(error)
-   {
-   g_error_free(error);
-   }
-   }
- */
-
-/*
-
-   gint
-   dbus_get_sip_address( void )
-   {
-   GError* error = NULL;
-   gint address;
-   org_sflphone_SFLphone_ConfigurationManager_get_sip_address(
-   configurationManagerProxy,
-   &address,
-   &error);
-   if(error)
-   {
-   g_error_free(error);
-   }
-   return address;
-   }
- */
 
 GHashTable*
 dbus_get_addressbook_settings (void)
@@ -2070,7 +1973,6 @@ dbus_set_addressbook_settings (GHashTable * settings)
 gchar**
 dbus_get_addressbook_list (void)
 {
-
     GError *error = NULL;
     gchar** array = NULL;
 
@@ -2088,7 +1990,6 @@ dbus_get_addressbook_list (void)
 void
 dbus_set_addressbook_list (const gchar** list)
 {
-
     GError *error = NULL;
 
     org_sflphone_SFLphone_ConfigurationManager_set_addressbook_list (
@@ -2123,7 +2024,6 @@ dbus_get_hook_settings (void)
 void
 dbus_set_hook_settings (GHashTable * settings)
 {
-
     GError *error = NULL;
 
     org_sflphone_SFLphone_ConfigurationManager_set_hook_settings (
@@ -2249,7 +2149,6 @@ dbus_get_history (void)
     if (error) {
         ERROR ("Error calling get history: %s", error->message);
         g_error_free (error);
-	return NULL;
     }
 
     return entries;
@@ -2333,7 +2232,7 @@ dbus_get_supported_tls_method()
     org_sflphone_SFLphone_ConfigurationManager_get_supported_tls_method (
         configurationManagerProxy, &array, &error);
 
-    if (error != NULL) {
+    if (error) {
         ERROR ("Failed to call get_supported_tls_method() on ConfigurationManager: %s",
                error->message);
         g_error_free (error);
@@ -2351,7 +2250,7 @@ dbus_get_tls_settings_default (void)
     org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default (
         configurationManagerProxy, &results, &error);
 
-    if (error != NULL) {
+    if (error) {
         ERROR ("Error calling org_sflphone_SFLphone_ConfigurationManager_get_tls_settings_default");
         g_error_free (error);
     }
@@ -2363,7 +2262,7 @@ gchar *
 dbus_get_address_from_interface_name (gchar* interface)
 {
     GError *error = NULL;
-    gchar * address;
+    gchar * address = NULL;
 
     org_sflphone_SFLphone_ConfigurationManager_get_addr_from_interface_name (
         configurationManagerProxy, interface, &address, &error);
@@ -2374,75 +2273,66 @@ dbus_get_address_from_interface_name (gchar* interface)
     }
 
     return address;
-
 }
 
 gchar **
 dbus_get_all_ip_interface (void)
 {
     GError *error = NULL;
-    gchar ** array;
+    gchar ** array = NULL;
 
     if (!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface (
                 configurationManagerProxy, &array, &error)) {
-        if (error->domain == DBUS_GERROR && error->code
-                == DBUS_GERROR_REMOTE_EXCEPTION) {
+        if (error->domain == DBUS_GERROR &&
+                error->code == DBUS_GERROR_REMOTE_EXCEPTION)
             ERROR ("Caught remote method (get_all_ip_interface) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-        } else {
+        else
             ERROR ("Error while calling get_all_ip_interface: %s", error->message);
-        }
 
         g_error_free (error);
-        return NULL;
-    } else {
+    } else
         DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager");
-        return array;
-    }
+    return array;
 }
 
 gchar **
 dbus_get_all_ip_interface_by_name (void)
 {
     GError *error = NULL;
-    gchar ** array;
+    gchar ** array = NULL;
 
     if (!org_sflphone_SFLphone_ConfigurationManager_get_all_ip_interface_by_name (
                 configurationManagerProxy, &array, &error)) {
-        if (error->domain == DBUS_GERROR && error->code
-                == DBUS_GERROR_REMOTE_EXCEPTION) {
+        if (error->domain == DBUS_GERROR &&
+                error->code == DBUS_GERROR_REMOTE_EXCEPTION)
             ERROR ("Caught remote method (get_all_ip_interface) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-        } else {
+        else
             ERROR ("Error while calling get_all_ip_interface: %s", error->message);
-        }
 
         g_error_free (error);
-        return NULL;
-    } else {
+    } else
         DEBUG ("DBus called get_all_ip_interface() on ConfigurationManager");
-        return array;
-    }
+    return array;
 }
 
 GHashTable*
 dbus_get_shortcuts (void)
 {
     GError *error = NULL;
-    GHashTable * shortcuts;
+    GHashTable * shortcuts = NULL;
 
     if (!org_sflphone_SFLphone_ConfigurationManager_get_shortcuts (
                 configurationManagerProxy, &shortcuts, &error)) {
-        if (error->domain == DBUS_GERROR && error->code
-                == DBUS_GERROR_REMOTE_EXCEPTION) {
-            ERROR ("Caught remote method (get_shortcuts) exception  %s: %s", dbus_g_error_get_name (error), error->message);
-        } else {
+        if (error->domain == DBUS_GERROR &&
+                error->code == DBUS_GERROR_REMOTE_EXCEPTION)
+            ERROR ("Caught remote method (get_shortcuts) exception  %s: %s",
+                    dbus_g_error_get_name (error), error->message);
+        else
             ERROR ("Error while calling get_shortcuts: %s", error->message);
-        }
 
         g_error_free (error);
-        return NULL;
-    } else {
-        return shortcuts;
     }
+    return shortcuts;
 }
 
 void
@@ -2452,7 +2342,6 @@ dbus_set_shortcuts (GHashTable * shortcuts)
     org_sflphone_SFLphone_ConfigurationManager_set_shortcuts (
         configurationManagerProxy, shortcuts, &error);
 
-
     if (error) {
         ERROR ("Failed to call set_shortcuts() on ConfigurationManager: %s",
                error->message);
-- 
GitLab