From: Marcel Holtmann Date: Thu, 14 May 2009 03:49:18 +0000 (-0700) Subject: Ensure that favorite information are stored X-Git-Tag: 2.0_alpha~3800 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=254c95953680203a984aee5cd43443958c506ea9;p=framework%2Fconnectivity%2Fconnman.git Ensure that favorite information are stored --- diff --git a/src/service.c b/src/service.c index 2c64fd5..3a971fe 100644 --- a/src/service.c +++ b/src/service.c @@ -357,7 +357,6 @@ static DBusMessage *remove_service(DBusConnection *conn, } connman_service_set_favorite(service, FALSE); - __connman_storage_save_service(service); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); @@ -620,8 +619,10 @@ int __connman_service_indicate_state(struct connman_service *service, service->state = state; state_changed(service); - if (state == CONNMAN_SERVICE_STATE_READY) - return connman_service_set_favorite(service, TRUE); + if (state == CONNMAN_SERVICE_STATE_READY) { + connman_service_set_favorite(service, TRUE); + __connman_storage_save_service(service); + } return 0; } @@ -998,6 +999,17 @@ static int service_load(struct connman_service *service) g_free(data); + switch (service->type) { + case CONNMAN_SERVICE_TYPE_UNKNOWN: + case CONNMAN_SERVICE_TYPE_ETHERNET: + break; + case CONNMAN_SERVICE_TYPE_WIFI: + case CONNMAN_SERVICE_TYPE_WIMAX: + service->favorite = g_key_file_get_boolean(keyfile, + service->identifier, "Favorite", NULL); + break; + } + str = g_key_file_get_string(keyfile, service->identifier, "Passphrase", NULL); if (str != NULL) { @@ -1039,6 +1051,17 @@ static int service_save(struct connman_service *service) g_free(data); update: + switch (service->type) { + case CONNMAN_SERVICE_TYPE_UNKNOWN: + case CONNMAN_SERVICE_TYPE_ETHERNET: + break; + case CONNMAN_SERVICE_TYPE_WIFI: + case CONNMAN_SERVICE_TYPE_WIMAX: + g_key_file_set_boolean(keyfile, service->identifier, + "Favorite", service->favorite); + break; + } + if (service->passphrase != NULL) g_key_file_set_string(keyfile, service->identifier, "Passphrase", service->passphrase);