session: Call session_changed if setting changes
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 14 Apr 2011 11:45:33 +0000 (13:45 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Fri, 15 Apr 2011 14:24:38 +0000 (16:24 +0200)
src/session.c

index a381af414002f10cf858d0d2f7f9c233be1437ff..cf1f557da87540d1accc04cbd526c34b41c13ee9 100644 (file)
@@ -788,6 +788,7 @@ static DBusMessage *connect_session(DBusConnection *conn,
        DBG("session %p", session);
 
        info->connect = TRUE;
+       session->info_dirty = TRUE;
 
        g_timeout_add_seconds(0, session_cb, session);
 
@@ -803,6 +804,7 @@ static DBusMessage *disconnect_session(DBusConnection *conn,
        DBG("session %p", session);
 
        info->connect = FALSE;
+       session->info_dirty = TRUE;
 
        g_timeout_add_seconds(0, session_cb, session);
 
@@ -865,6 +867,7 @@ static void update_ecall(struct connman_session *session)
                        continue;
 
                session_iter->info.ecall = info->ecall;
+               session_iter->info_dirty = TRUE;
 
                g_timeout_add_seconds(0, session_cb, session_iter);
        }
@@ -886,7 +889,6 @@ static DBusMessage *change_session(DBusConnection *conn,
        DBusMessageIter iter, value;
        const char *name;
        GSList *allowed_bearers;
-       int err;
 
        DBG("session %p", session);
        if (dbus_message_iter_init(msg, &iter) == FALSE)
@@ -981,9 +983,8 @@ static DBusMessage *change_session(DBusConnection *conn,
                goto err;
        }
 
-       err = session_notify(session);
-       if (err < 0)
-               __connman_error_failed(msg, -err);
+       if (session->info_dirty == TRUE)
+               session_cb(session);
 
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);