Replace deprecated APIs of Glib v2.62.3 with suggested GLib APIs 11/224111/2 accepted/tizen/unified/20200224.081431 submit/tizen/20200203.160801 submit/tizen/20200211.061437 submit/tizen/20200212.120218 submit/tizen/20200217.011016
authorNishant Chaprana <n.chaprana@samsung.com>
Thu, 6 Feb 2020 08:29:29 +0000 (13:59 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Thu, 6 Feb 2020 11:06:15 +0000 (16:36 +0530)
Below Glib API calls are replaced:-
1. GTimeVal => GDateTime
2. g_get_current_time => g_get_real_time
3. g_time_val_to_iso8601 => g_date_time_format_iso8601

Change-Id: I0d7354d1c3cb06901135843e91745d15f3eb2b33
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
packaging/net-config.spec
src/wifi-config.c

index 0dd7a68..58d8bda 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          net-config
 Summary:       TIZEN Network Configuration service
 Name:          net-config
 Summary:       TIZEN Network Configuration service
-Version:       1.1.147
+Version:       1.1.148
 Release:       3
 Group:         System/Network
 License:       Apache-2.0
 Release:       3
 Group:         System/Network
 License:       Apache-2.0
index 680246d..97b9c6d 100755 (executable)
@@ -87,7 +87,6 @@ struct wifi_config {
        gchar *security_type;
        gboolean favorite;
        gboolean autoconnect;
        gchar *security_type;
        gboolean favorite;
        gboolean autoconnect;
-       GTimeVal modified;
        gchar *is_hidden;
        gboolean is_created;
        gchar *proxy_address;
        gchar *is_hidden;
        gboolean is_created;
        gchar *proxy_address;
@@ -1301,13 +1300,32 @@ gboolean handle_save_configuration(Wifi *wifi, GDBusMethodInvocation *context,
 
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
 
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
        g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
-       g_get_current_time(&conf->modified);
-       gchar *str = g_time_val_to_iso8601(&conf->modified);
+
+#if GLIB_CHECK_VERSION(2,62,0)
+       gint64 real_time = 0;
+       GDateTime *dt_real_time = NULL;
+
+       real_time = g_get_real_time();
+       dt_real_time = g_date_time_new_from_unix_utc(real_time);
+       if (dt_real_time) {
+               gchar *str = g_date_time_format_iso8601(dt_real_time);
+               g_date_time_unref(dt_real_time);
+               if (str) {
+                       g_key_file_set_string(keyfile, group_name,
+                                             WIFI_CONFIG_MODIFIED, str);
+                       g_free(str);
+               }
+       }
+#else /* GLIB_CHECK_VERSION(2,62,0) */
+       GTimeVal modified;
+       g_get_current_time(&modified);
+       gchar *str = g_time_val_to_iso8601(&modified);
        if (str) {
                g_key_file_set_string(keyfile, group_name,
        if (str) {
                g_key_file_set_string(keyfile, group_name,
-                               WIFI_CONFIG_MODIFIED, str);
+                                     WIFI_CONFIG_MODIFIED, str);
                g_free(str);
        }
                g_free(str);
        }
+#endif /* GLIB_CHECK_VERSION(2,62,0) */
 
        /* Optional field */
        if (conf->proxy_address != NULL) {
 
        /* Optional field */
        if (conf->proxy_address != NULL) {