netreg: Refactor register_callback

This commit is contained in:
Denis Kenzior 2011-04-14 12:31:45 -05:00
parent 41c42f1606
commit 59f32bd353
1 changed files with 3 additions and 10 deletions

View File

@ -217,28 +217,21 @@ static void set_registration_mode(struct ofono_netreg *netreg, int mode)
static void register_callback(const struct ofono_error *error, void *data)
{
struct ofono_netreg *netreg = data;
DBusConnection *conn = ofono_dbus_get_connection();
DBusMessage *reply;
if (netreg->pending == NULL)
goto out;
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
reply = dbus_message_new_method_return(netreg->pending);
else
reply = __ofono_error_failed(netreg->pending);
g_dbus_send_message(conn, reply);
__ofono_dbus_pending_reply(&netreg->pending, reply);
dbus_message_unref(netreg->pending);
netreg->pending = NULL;
out:
if (netreg->driver->registration_status == NULL)
return;
netreg->driver->registration_status(netreg,
registration_status_callback, netreg);
registration_status_callback,
netreg);
}
static struct network_operator_data *