]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Ensure configuration file warning get in the log, not stderr
authorRobert Ancell <robert.ancell@canonical.com>
Wed, 5 Aug 2015 04:37:01 +0000 (16:37 +1200)
committerRobert Ancell <robert.ancell@canonical.com>
Wed, 5 Aug 2015 04:37:01 +0000 (16:37 +1200)
common/configuration.c
common/configuration.h

index c150d86822af2b96797a3ca4fbabcc85edd39aa5..250d052b4b79e20022b89a6148a09c6000832b4c 100644 (file)
@@ -34,7 +34,7 @@ config_get_instance (void)
 }
 
 gboolean
-config_load_from_file (Configuration *config, const gchar *path, GError **error)
+config_load_from_file (Configuration *config, const gchar *path, GList **messages, GError **error)
 {
     GKeyFile *key_file;
     gchar *source_path, **groups;
@@ -60,7 +60,8 @@ config_load_from_file (Configuration *config, const gchar *path, GError **error)
         group = groups[i];
         if (strcmp (group, "SeatDefaults") == 0)
         {
-            g_printerr ("Configuration file %s contains a deprecated [SeatDefaults] section, use [Seat:*] instead\n", path);
+            if (messages)
+                *messages = g_list_append (*messages, g_strdup ("  [SeatDefaults] is now called [Seat:*], please update this configuration"));
             group = "Seat:*";
         }
 
@@ -145,7 +146,7 @@ load_config_directory (const gchar *path, GList **messages)
         {
             if (messages)
                 *messages = g_list_append (*messages, g_strdup_printf ("Loading configuration from %s", conf_path));
-            config_load_from_file (config_get_instance (), conf_path, &error);
+            config_load_from_file (config_get_instance (), conf_path, messages, &error);
             if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
                 g_printerr ("Failed to load configuration from %s: %s\n", filename, error->message);
             g_clear_error (&error);
@@ -202,7 +203,7 @@ config_load_from_standard_locations (Configuration *config, const gchar *config_
 
     if (messages)
         *messages = g_list_append (*messages, g_strdup_printf ("Loading configuration from %s", path));
-    if (!config_load_from_file (config, path, &error))
+    if (!config_load_from_file (config, path, messages, &error))
     {
         gboolean is_empty;
 
index 5f3004ccb348c2bd0206c0455a02807390453345..56005eff2fe64353ca1faca0d967ec47fe2c272a 100644 (file)
@@ -36,7 +36,7 @@ GType config_get_type (void);
 
 Configuration *config_get_instance (void);
 
-gboolean config_load_from_file (Configuration *config, const gchar *path, GError **error);
+gboolean config_load_from_file (Configuration *config, const gchar *path, GList **messages, GError **error);
 
 gboolean config_load_from_standard_locations (Configuration *config, const gchar *config_path, GList **messages);