Add support RTNL gateway change notifications
[connman] / src / storage.c
index 5e39041..e0e3dc5 100644 (file)
@@ -44,6 +44,15 @@ static int do_load(GKeyFile *keyfile, struct connman_element *element)
        DBG("element %p name %s", element, element->name);
 
        value = g_key_file_get_string(keyfile, element->path,
+                                               "Policy", NULL);
+       if (value != NULL)
+               element->policy = __connman_element_string2policy(value);
+
+       if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK)
+               element->remember = g_key_file_get_boolean(keyfile,
+                                       element->path, "Remember", NULL);
+
+       value = g_key_file_get_string(keyfile, element->path,
                                                "WiFi.Security", NULL);
        if (value != NULL)
                connman_element_set_property(element,
@@ -98,13 +107,22 @@ static void do_update(GKeyFile *keyfile, struct connman_element *element)
 {
        GSList *list;
        char *value;
+       const char *str;
 
        DBG("element %p name %s", element, element->name);
 
        g_key_file_set_string(keyfile, element->path, "Name", element->name);
 
-       g_key_file_set_boolean(keyfile, element->path, "Enabled",
-                                                       element->enabled);
+       str = __connman_element_policy2string(element->policy);
+       if (str != NULL)
+               g_key_file_set_string(keyfile, element->path, "Policy", str);
+
+       //g_key_file_set_boolean(keyfile, element->path, "Enabled",
+       //                                              element->enabled);
+
+       if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK)
+               g_key_file_set_boolean(keyfile, element->path, "Remember",
+                                                       element->remember);
 
        __connman_element_lock(element);
 
@@ -162,7 +180,7 @@ int __connman_element_store(struct connman_element *element)
 
        if (length > 0) {
                if (g_key_file_load_from_data(keyfile, data, length,
-                               G_KEY_FILE_KEEP_COMMENTS, NULL) == FALSE)
+                                                       0, NULL) == FALSE)
                        goto done;
        }