e: cleanup connman error detection.

SVN revision: 62237
This commit is contained in:
Cedric BAIL 2011-08-09 08:43:14 +00:00
parent 19d53a58eb
commit f64603d630
1 changed files with 33 additions and 18 deletions

View File

@ -588,19 +588,28 @@ _connman_service_connect_cb(void *data,
struct connman_service_connect_data *d = data;
if (error && dbus_error_is_set(error))
{
char *password_needed[] = {
"org.moblin.connman.Error.PassphraseRequired",
"org.moblin.connman.Error.Failed",
"net.connman.Error.PassphraseRequired",
"net.connman.Error.Failed",
NULL
};
char *dont_display_error[] = {
"org.moblin.connman.Error.AlreadyConnected",
"net.connman.Error.AlreadyConnected",
"net.connman.Error.OperationAborted",
NULL
};
int i;
for (i = 0; password_needed[i]; ++i)
if (strcmp(error->name, password_needed[i]) == 0)
{
/* TODO: cellular might ask for SetupRequired to enter APN,
* username and password
*/
if ((strcmp(error->name,
"org.moblin.connman.Error.PassphraseRequired") == 0) ||
(strcmp(error->name,
"org.moblin.connman.Error.Failed") == 0) ||
(strcmp(error->name,
"net.connman.Error.PassphraseRequired") == 0) ||
(strcmp(error->name,
"net.connman.Error.Failed") == 0))
{
E_Connman_Service *service;
service = _connman_ctxt_find_service_stringshare
@ -617,12 +626,18 @@ _connman_service_connect_cb(void *data,
/* TODO: cellular might ask for user and pass */
_connman_dbus_error_show(_("Connect to network service."),
error);
break;
}
else if ((strcmp(error->name,
"org.moblin.connman.Error.AlreadyConnected") != 0) ||
(strcmp(error->name,
"net.connman.Error.AlreadyConnected") != 0))
if (password_needed[i] == NULL)
{
for (i = 0; dont_display_error[i]; ++i)
if (strcmp(error->name, dont_display_error[i]) == 0)
break;
if (dont_display_error[i] == NULL)
_connman_dbus_error_show(_("Connect to network service."), error);
}
dbus_error_free(error);
}