Commit 3d309781 authored by Tristan Matthews's avatar Tristan Matthews

* #19683: gnome: use g_warning for non-fatal errors

parent 539fe1b2
......@@ -241,7 +241,7 @@ void account_list_remove(const gchar *accountID)
if (target) {
#if GLIB_CHECK_VERSION(2, 30, 0)
if (!g_queue_remove(accountQueue, target))
g_error("Could not remove account with ID %s", accountID);
g_warning("Could not remove account with ID %s", accountID);
#else
g_queue_remove(accountQueue, target);
#endif
......
......@@ -199,7 +199,7 @@ void sflphone_fill_account_list(void)
for (gchar **accountID = array; accountID && *accountID; ++accountID) {
account_t *acc = create_account_with_ID(*accountID);
if (acc->properties == NULL) {
g_error("SFLphone: Error: Could not fetch details for account %s",
g_warning("SFLphone: Error: Could not fetch details for account %s",
accountID);
break;
}
......@@ -214,17 +214,17 @@ void sflphone_fill_account_list(void)
acc->state = ACCOUNT_STATE_UNREGISTERED;
else if (g_strcmp0(status, "TRYING") == 0)
acc->state = ACCOUNT_STATE_TRYING;
else if (g_strcmp0(status, "g_error") == 0)
else if (g_strcmp0(status, "g_warning") == 0)
acc->state = ACCOUNT_STATE_ERROR;
else if (g_strcmp0(status, "g_error_AUTH") == 0)
else if (g_strcmp0(status, "g_warning_AUTH") == 0)
acc->state = ACCOUNT_STATE_ERROR_AUTH;
else if (g_strcmp0(status, "g_error_NETWORK") == 0)
else if (g_strcmp0(status, "g_warning_NETWORK") == 0)
acc->state = ACCOUNT_STATE_ERROR_NETWORK;
else if (g_strcmp0(status, "g_error_HOST") == 0)
else if (g_strcmp0(status, "g_warning_HOST") == 0)
acc->state = ACCOUNT_STATE_ERROR_HOST;
else if (g_strcmp0(status, "g_error_NOT_ACCEPTABLE") == 0)
else if (g_strcmp0(status, "g_warning_NOT_ACCEPTABLE") == 0)
acc->state = ACCOUNT_STATE_ERROR_NOT_ACCEPTABLE;
else if (g_strcmp0(status, "g_error_EXIST_STUN") == 0)
else if (g_strcmp0(status, "g_warning_EXIST_STUN") == 0)
acc->state = ACCOUNT_STATE_ERROR_EXIST_STUN;
else if (g_strcmp0(status, "ACCOUNT_STATE_IP2IP_READY") == 0)
acc->state = ACCOUNT_STATE_IP2IP_READY;
......@@ -502,7 +502,7 @@ sflphone_incoming_call(callable_obj_t * c, SFLPhoneClient *client)
}
account_t *account = account_list_get_by_id(c->_accountID);
if (!account) {
g_error("Account is NULL");
g_warning("Account is NULL");
} else if (account_has_autoanswer_on(account)) {
calltab_set_selected_call(active_calltree_tab, c);
sflphone_pick_up(client);
......@@ -720,19 +720,19 @@ sflphone_place_call(callable_obj_t * c, SFLPhoneClient *client)
account_t * account = NULL;
if (c == NULL) {
g_error("Callable object is NULL while making new call");
g_warning("Callable object is NULL while making new call");
return -1;
}
g_debug("Placing call from %s to %s using account %s", c->_display_name, c->_peer_number, c->_accountID);
if (c->_state != CALL_STATE_DIALING) {
g_error("Call not in state dialing, cannot place call");
g_warning("Call not in state dialing, cannot place call");
return -1;
}
if (!c->_peer_number || strlen(c->_peer_number) == 0) {
g_error("No peer number set for this call");
g_warning("No peer number set for this call");
return -1;
}
......@@ -759,7 +759,7 @@ sflphone_place_call(callable_obj_t * c, SFLPhoneClient *client)
g_debug("Could not find an account for this call, making ip to ip call");
account = account_list_get_by_id("IP2IP");
if (account == NULL) {
g_error("Actions: Could not determine any account for this call");
g_warning("Actions: Could not determine any account for this call");
return -1;
}
}
......@@ -801,7 +801,7 @@ sflphone_add_participant(const gchar* callID, const gchar* confID)
callable_obj_t *call = calllist_get_call(current_calls_tab, callID);
if (call == NULL) {
g_error("Could not find call");
g_warning("Could not find call");
return;
}
......@@ -884,7 +884,7 @@ sflphone_fill_audio_codec_list_per_account(account_t *account)
c->is_active = TRUE;
g_queue_push_tail(account->acodecs, c);
} else
g_error("Couldn't find codec %d %p", payload, orig);
g_warning("Couldn't find codec %d %p", payload, orig);
}
g_array_unref(order);
......@@ -1005,7 +1005,7 @@ sflphone_call_state_changed(callable_obj_t * c, const gchar * description, const
g_debug("Call State changed %s", description);
if (c == NULL) {
g_error("SFLphone: Error: callable obj is NULL in %s at %d", __FILE__, __LINE__);
g_warning("SFLphone: Error: callable obj is NULL in %s at %d", __FILE__, __LINE__);
return;
}
......
......@@ -322,7 +322,7 @@ void restore_call(const gchar *id)
// We fetch the details associated to the specified call
GHashTable *call_details = dbus_get_call_details(id);
if (!call_details) {
g_error("Invalid call ID");
g_warning("Invalid call ID");
return;
}
callable_obj_t *new_call = create_new_call_from_details(id, call_details);
......
......@@ -41,7 +41,7 @@ conference_obj_t *
create_new_conference(conference_state_t state, const gchar* const confID)
{
if (confID == NULL) {
g_error("Conference ID is NULL while creating new conference");
g_warning("Conference ID is NULL while creating new conference");
return NULL;
}
......@@ -109,7 +109,7 @@ void conference_add_participant_number(const gchar *call_id, conference_obj_t *c
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
if (!call) {
g_error("Could not find %s", call_id);
g_warning("Could not find %s", call_id);
return;
}
......@@ -138,7 +138,7 @@ void conference_remove_participant(const gchar* call_id, conference_obj_t* conf)
void conference_participant_list_update(gchar** participants, conference_obj_t* conf)
{
if (!conf) {
g_error("Conference is NULL");
g_warning("Conference is NULL");
return;
}
......
......@@ -244,7 +244,7 @@ create_basic_tab(account_t *account)
else if (account_is_IAX(account))
table = gtk_table_new(8, 2, FALSE);
else {
g_error("Unknown account type");
g_warning("Unknown account type");
return NULL;
}
......@@ -282,7 +282,7 @@ create_basic_tab(account_t *account)
else if (account_is_IAX(account))
gtk_combo_box_set_active(GTK_COMBO_BOX(protocol_combo), 1);
else {
g_error("Account protocol not valid");
g_warning("Account protocol not valid");
/* Should never come here, add debug message. */
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(protocol_combo), _("Unknown"));
gtk_combo_box_set_active(GTK_COMBO_BOX(protocol_combo), 2);
......@@ -595,7 +595,7 @@ static void local_interface_changed_cb(G_GNUC_UNUSED GtkWidget * widget, G_GNUC_
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(same_as_local_radio_button))) {
gchar *local_iface_name = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(local_address_combo));
if (!local_iface_name) {
g_error("Could not get local interface name");
g_warning("Could not get local interface name");
return;
}
gchar *local_iface_addr = get_interface_addr_from_name(local_iface_name);
......@@ -861,7 +861,7 @@ static GtkWidget* create_registration_expire(const account_t *account)
if (account && account->properties)
if (!g_hash_table_lookup_extended(account->properties, CONFIG_ACCOUNT_REGISTRATION_EXPIRE,
&orig_key, (gpointer) &account_expire))
g_error("Could not retrieve %s from account properties",
g_warning("Could not retrieve %s from account properties",
CONFIG_ACCOUNT_REGISTRATION_EXPIRE);
GtkWidget *table, *frame;
......@@ -924,7 +924,7 @@ create_network(const account_t *account)
local_address_entry = gtk_entry_new();
gchar *local_iface_name = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(local_address_combo));
if (!local_iface_name) {
g_error("Could not get local interface name");
g_warning("Could not get local interface name");
return frame;
}
gchar *local_iface_addr = get_interface_addr_from_name(local_iface_name);
......
......@@ -222,7 +222,7 @@ addressbook_config_book_active_toggled(
book_data = addrbook->get_book_data_by_uid(uid);
if (book_data == NULL) {
g_error("Could not find addressbook %s", uid);
g_warning("Could not find addressbook %s", uid);
return;
}
......
......@@ -379,7 +379,7 @@ codec_active_toggled(G_GNUC_UNUSED GtkCellRendererToggle *renderer, gchar *path,
account_t *acc = (account_t*) data;
if (!acc) {
g_error("no account selected");
g_warning("no account selected");
return;
}
......@@ -787,7 +787,7 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client)
gtk_action_set_sensitive(volumeToggle_, FALSE);
} else
g_error("Unexpected audio API state");
g_warning("Unexpected audio API state");
}
static const gchar *reverse_state(const gchar *state)
......@@ -834,7 +834,7 @@ static void record_path_changed(GtkFileChooser *chooser, G_GNUC_UNUSED gpointer
if (!g_access(path, W_OK)) {
dbus_set_record_path(path);
} else {
g_error("Directory %s is not writable", path);
g_warning("Directory %s is not writable", path);
restore_recording_path(chooser);
}
g_free(path);
......
......@@ -148,7 +148,7 @@ int main(void)
puts(acc.user);
puts(acc.passwd);
} else {
g_error("FAILED: %s", acc.reason);
g_warning("FAILED: %s", acc.reason);
}
}
#endif
......@@ -143,7 +143,7 @@ static void
preferences_dialog_fill_codec_list(account_t *acc)
{
if (!acc) {
g_error("Account is NULL");
g_warning("Account is NULL");
return;
}
// Get model of view and clear it
......@@ -222,7 +222,7 @@ codec_active_toggled(G_GNUC_UNUSED GtkCellRendererToggle *renderer, gchar *path,
account_t *acc = (account_t*) data;
if (!acc) {
g_error("No account selected");
g_warning("No account selected");
return;
}
......@@ -365,7 +365,7 @@ bitrate_edited_cb(G_GNUC_UNUSED GtkCellRenderer *renderer, gchar *path, gchar *n
account_t *acc = (account_t*) data;
if (!acc) {
g_error("No account selected");
g_warning("No account selected");
return;
}
g_debug("updating bitrate for %s", acc->accountID);
......@@ -401,7 +401,7 @@ bitrate_edited_cb(G_GNUC_UNUSED GtkCellRenderer *renderer, gchar *path, gchar *n
video_codec_set_bitrate(codec, bitrate);
dbus_set_video_codecs(acc->accountID, vcodecs);
} else {
g_error("Could not find codec %s", name);
g_warning("Could not find codec %s", name);
}
g_free(bitrate);
g_ptr_array_free(vcodecs, TRUE);
......@@ -415,7 +415,7 @@ parameters_edited_cb(G_GNUC_UNUSED GtkCellRenderer *renderer, gchar *path, gchar
account_t *acc = (account_t*) data;
if (!acc) {
g_error("No account selected");
g_warning("No account selected");
return;
}
......@@ -443,7 +443,7 @@ parameters_edited_cb(G_GNUC_UNUSED GtkCellRenderer *renderer, gchar *path, gchar
video_codec_set_parameters(codec, new_text);
dbus_set_video_codecs(acc->accountID, vcodecs);
} else {
g_error("Could not find codec %s", name);
g_warning("Could not find codec %s", name);
}
g_ptr_array_free(vcodecs, TRUE);
}
......@@ -609,7 +609,7 @@ preferences_dialog_fill_video_input_device_rate_list()
}
g_free(rate);
} else
g_error("No video rate list found for device");
g_warning("No video rate list found for device");
}
......@@ -662,7 +662,7 @@ preferences_dialog_fill_video_input_device_size_list()
}
g_free(size);
} else
g_error("No device size list found");
g_warning("No device size list found");
}
/**
......@@ -714,7 +714,7 @@ preferences_dialog_fill_video_input_device_channel_list()
}
g_free(channel);
} else
g_error("No channel list found");
g_warning("No channel list found");
}
/**
......@@ -742,7 +742,7 @@ preferences_dialog_fill_video_input_device_list()
// Call dbus to retrieve list
gchar **list = dbus_get_video_device_list();
if (!list || !*list) {
g_error("No device list found");
g_warning("No device list found");
return FALSE;
} else {
// For each device name included in list
......
......@@ -101,7 +101,7 @@ void abook_init()
#define LOAD(func) do { \
addrbook-> func = dlsym(handle, "addressbook_" #func); \
if (addrbook-> func == NULL) \
g_error("Couldn't load " # func); \
g_warning("Couldn't load " # func); \
} while(0)
......
......@@ -42,7 +42,7 @@ is_callID_callstruct(gconstpointer a, gconstpointer b)
// if it's null or not a call it's not the call we're looking for
if (c == NULL) {
g_error("NULL element in list");
g_warning("NULL element in list");
return 1;
}
......@@ -198,7 +198,7 @@ calllist_get_call(calltab_t* tab, const gchar * callID)
GList * c = g_queue_find_custom(tab->callQueue, callID, is_callID_callstruct);
if (c == NULL) {
g_error("Could not find call %s in tab %s", callID, tab->name);
g_warning("Could not find call %s in tab %s", callID, tab->name);
return NULL;
}
......
......@@ -111,7 +111,7 @@ calltab_create_searchbar(calltab_t* tab)
else if (calltab_has_name(tab, CONTACTS))
tab->searchbar = contacts_searchbar_new();
else
g_error("Current calls tab does not need a searchbar\n");
g_warning("Current calls tab does not need a searchbar\n");
}
gboolean
......
......@@ -540,7 +540,7 @@ calltree_remove_call(calltab_t* tab, const gchar *target_id)
static GdkPixbuf *history_state_to_pixbuf(callable_obj_t *call)
{
if(call == NULL) {
g_error("Not a valid call in history state to pixbuf");
g_warning("Not a valid call in history state to pixbuf");
return NULL;
}
......@@ -738,7 +738,7 @@ update_call(GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeIter *i
void calltree_update_call(calltab_t* tab, callable_obj_t * call, SFLPhoneClient *client)
{
if (!call) {
g_error("Call is NULL, ignoring");
g_warning("Call is NULL, ignoring");
return;
}
CallUpdateCtx ctx = {tab, call};
......@@ -892,10 +892,10 @@ void calltree_add_conference_to_current_calls(conference_obj_t* conf, SFLPhoneCl
account_t *account_details = NULL;
if (!conf) {
g_error("Conference is null");
g_warning("Conference is null");
return;
} else if (!conf->_confID) {
g_error("Conference ID is null");
g_warning("Conference ID is null");
return;
}
......@@ -953,13 +953,13 @@ void calltree_add_conference_to_current_calls(conference_obj_t* conf, SFLPhoneCl
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
if (call == NULL)
g_error("Could not find call %s in call list", call_id);
g_warning("Could not find call %s in call list", call_id);
else {
account_details = account_list_get_by_id(call->_accountID);
gchar *srtp_enabled = "";
if (!account_details)
g_error("Could not find account %s in account list", call->_accountID);
g_warning("Could not find account %s in account list", call->_accountID);
else
srtp_enabled = g_hash_table_lookup(account_details->properties, CONFIG_SRTP_ENABLE);
......@@ -1084,7 +1084,7 @@ remove_conference(GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeI
void calltree_remove_conference(calltab_t* tab, const conference_obj_t* conf, SFLPhoneClient *client)
{
if(conf == NULL) {
g_error("Could not remove conference, conference pointer is NULL");
g_warning("Could not remove conference, conference pointer is NULL");
return;
}
......@@ -1120,7 +1120,7 @@ void calltree_display(calltab_t *tab, SFLPhoneClient *client)
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(contactButton_), TRUE);
set_focus_on_addressbook_searchbar();
} else
g_error("Not a valid call tab (%d, %s)", __LINE__, __FILE__);
g_warning("Not a valid call tab (%d, %s)", __LINE__, __FILE__);
if (active_calltree_tab->mainwidget)
gtk_widget_hide(active_calltree_tab->mainwidget);
......@@ -1265,13 +1265,13 @@ static gboolean valid_drop(GtkTreeModel *model, GtkTreeIter *source_iter, GtkTre
gboolean result = TRUE;
GtkTreePath *source_path = gtk_tree_model_get_path(model, source_iter);
if (!gtk_tree_path_compare(source_path, dest_path)) {
g_error("invalid drop: source and destination are the same");
g_warning("invalid drop: source and destination are the same");
result = FALSE;
} else if (gtk_tree_path_is_ancestor(source_path, dest_path)) {
g_error("invalid drop: source is ancestor of destination");
g_warning("invalid drop: source is ancestor of destination");
result = FALSE;
} else if (gtk_tree_path_is_descendant(source_path, dest_path)) {
g_error("invalid drop: source is descendant of destination");
g_warning("invalid drop: source is descendant of destination");
result = FALSE;
}
gtk_tree_path_free(source_path);
......@@ -1284,7 +1284,7 @@ render_drop(GtkTreeModel *model, GtkTreePath *dest_path, GtkTreeViewDropPosition
{
GtkTreeIter dest_iter;
if (!gtk_tree_model_get_iter(model, &dest_iter, dest_path)) {
g_error("Could not get destination iterator");
g_warning("Could not get destination iterator");
return FALSE;
}
......@@ -1317,13 +1317,13 @@ void drag_data_received_cb(GtkWidget *widget, GdkDragContext *context,
GtkTreeSelection *tree_selection = gtk_tree_view_get_selection(tree_view);
GtkTreeIter source_iter;
if (!gtk_tree_selection_get_selected(tree_selection, NULL, &source_iter)) {
g_error("No tree element selected");
g_warning("No tree element selected");
return;
}
GtkTreePath *dest_path;
GtkTreeViewDropPosition dest_pos;
if (!gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dest_path, &dest_pos)) {
g_error("No row at given position");
g_warning("No row at given position");
return;
}
......@@ -1352,7 +1352,7 @@ menuitem_response(gchar * string)
dbus_attended_transfer(source_call, dest_call);
calltree_remove_call(current_calls_tab, popup_data->source_ID);
} else
g_error("Unknown option in menu %s", string);
g_warning("Unknown option in menu %s", string);
// Make sure the create conference option will appear next time the menu pops
// The create conference option will hide if tow call from the same conference are draged on each other
......
......@@ -43,7 +43,7 @@ static gint is_confID_confstruct(gconstpointer a, gconstpointer b)
void conferencelist_init(calltab_t *tab)
{
if (tab == NULL) {
g_error("Call tab is NULL");
g_warning("Call tab is NULL");
return;
}
......@@ -54,7 +54,7 @@ void conferencelist_init(calltab_t *tab)
void conferencelist_clean(calltab_t *tab)
{
if (tab == NULL) {
g_error("Calltab tab is NULL");
g_warning("Calltab tab is NULL");
return;
}
......@@ -64,7 +64,7 @@ void conferencelist_clean(calltab_t *tab)
void conferencelist_reset(calltab_t *tab)
{
if (tab == NULL) {
g_error("Calltab tab is NULL");
g_warning("Calltab tab is NULL");
return;
}
......@@ -76,12 +76,12 @@ void conferencelist_reset(calltab_t *tab)
void conferencelist_add(calltab_t *tab, const conference_obj_t* conf)
{
if (conf == NULL) {
g_error("Conference is NULL");
g_warning("Conference is NULL");
return;
}
if (tab == NULL) {
g_error("Tab is NULL");
g_warning("Tab is NULL");
return;
}
......@@ -98,12 +98,12 @@ void conferencelist_remove(calltab_t *tab, const gchar* const conf_id)
g_debug("Remove conference %s", conf_id);
if (conf_id == NULL) {
g_error("Conf id is NULL");
g_warning("Conf id is NULL");
return;
}
if (tab == NULL) {
g_error("Calltab is NULL");
g_warning("Calltab is NULL");
return;
}
......@@ -120,7 +120,7 @@ conference_obj_t* conferencelist_get(calltab_t *tab, const gchar* const conf_id)
g_debug("Conference list get %s", conf_id);
if (tab == NULL) {
g_error("Calltab is NULL");
g_warning("Calltab is NULL");
return NULL;
}
......@@ -135,14 +135,14 @@ conference_obj_t* conferencelist_get(calltab_t *tab, const gchar* const conf_id)
conference_obj_t* conferencelist_get_nth(calltab_t *tab, guint n)
{
if (tab == NULL) {
g_error("Calltab is NULL");
g_warning("Calltab is NULL");
return NULL;
}
conference_obj_t *c = g_queue_peek_nth(tab->conferenceQueue, n);
if (c == NULL) {
g_error("Could not fetch conference %d", n);
g_warning("Could not fetch conference %d", n);
return NULL;
}
......@@ -152,7 +152,7 @@ conference_obj_t* conferencelist_get_nth(calltab_t *tab, guint n)
conference_obj_t *conferencelist_pop_head(calltab_t *tab)
{
if (tab == NULL) {
g_error("Tab is NULL");
g_warning("Tab is NULL");
return NULL;
}
......@@ -162,7 +162,7 @@ conference_obj_t *conferencelist_pop_head(calltab_t *tab)
guint conferencelist_get_size(calltab_t *tab)
{
if (tab == NULL) {
g_error("Calltab is NULL");
g_warning("Calltab is NULL");
return 0;
}
......
......@@ -126,7 +126,7 @@ update_searchbar_addressbook_list()
books_data = addrbook->get_books_data();
if (books_data == NULL) {
g_error("Searchbar: No books data found");
g_warning("Searchbar: No books data found");
return;
}
......
......@@ -76,10 +76,10 @@ static GDBusProxy *session_manager_proxy;
static gboolean check_error(GError *error)
{
if (error) {
g_error("%s", error->message);
g_warning("%s", error->message);
if (g_error_matches(error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN)) {
g_error_free(error);
g_error("daemon crashed, quitting rudely...");
g_warning("daemon crashed, quitting rudely...");
exit(EXIT_FAILURE);
}
g_error_free(error);
......@@ -165,7 +165,7 @@ incoming_message_cb(G_GNUC_UNUSED DBusGProxy *proxy, const G_GNUC_UNUSED gchar *
} else {
conference_obj_t *conf = conferencelist_get(current_calls_tab, callID);
if (!conf) {
g_error("Message received, but no recipient found");
g_warning("Message received, but no recipient found");
return;
}
......@@ -180,10 +180,10 @@ static void
process_existing_call_state_change(callable_obj_t *c, const gchar *state, SFLPhoneClient *client)
{
if (c == NULL) {
g_error("Pointer to call is NULL in %s\n", __func__);
g_warning("Pointer to call is NULL in %s\n", __func__);
return;
} else if (state == NULL) {
g_error("Pointer to state is NULL in %s\n", __func__);
g_warning("Pointer to state is NULL in %s\n", __func__);
return;
}
......@@ -215,10 +215,10 @@ static void
process_nonexisting_call_state_change(const gchar *callID, const gchar *state, SFLPhoneClient *client)
{
if (callID == NULL) {
g_error("Pointer to call id is NULL in %s\n", __func__);
g_warning("Pointer to call id is NULL in %s\n", __func__);