[glib/wip/gutils-splitup: 5/6] gutils: replace direct references to g_home_dir



commit 73e1b171150380df588b997805c7cde1b0668270
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Feb 4 14:40:03 2013 +0100

    gutils: replace direct references to g_home_dir
    
    Some code was directly calling g_get_any_init() and then expecting to be
    able to use the static 'g_home_dir' variable directly.  Change these
    over to g_get_home_dir() instead.

 glib/gutils.c |   35 +++++++++++------------------------
 1 files changed, 11 insertions(+), 24 deletions(-)
---
diff --git a/glib/gutils.c b/glib/gutils.c
index f307826..70c4cab 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -1208,13 +1208,10 @@ g_get_user_data_dir (void)
 #endif
       if (!data_dir || !data_dir[0])
 	{
-	  g_get_any_init ();
-
-	  if (g_home_dir)
-	    data_dir = g_build_filename (g_home_dir, ".local", 
-					 "share", NULL);
+          if (g_get_home_dir ())
+            data_dir = g_build_filename (g_get_home_dir (), ".local", "share", NULL);
 	  else
-	    data_dir = g_build_filename (g_get_tmp_dir (), g_user_name, ".local", "share", NULL);
+            data_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".local", "share", NULL);
 	}
 
       g_user_data_dir = data_dir;
@@ -1244,12 +1241,10 @@ g_init_user_config_dir (void)
 #endif
       if (!config_dir || !config_dir[0])
 	{
-	  g_get_any_init ();
-
-	  if (g_home_dir)
-	    config_dir = g_build_filename (g_home_dir, ".config", NULL);
+          if (g_get_home_dir ())
+            config_dir = g_build_filename (g_get_home_dir (), ".config", NULL);
 	  else
-	    config_dir = g_build_filename (g_get_tmp_dir (), g_user_name, ".config", NULL);
+            config_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".config", NULL);
 	}
 
       g_user_config_dir = config_dir;
@@ -1327,12 +1322,10 @@ g_get_user_cache_dir (void)
 #endif
       if (!cache_dir || !cache_dir[0])
 	{
-	  g_get_any_init ();
-	
-	  if (g_home_dir)
-	    cache_dir = g_build_filename (g_home_dir, ".cache", NULL);
+          if (g_get_home_dir ())
+            cache_dir = g_build_filename (g_get_home_dir (), ".cache", NULL);
 	  else
-	    cache_dir = g_build_filename (g_get_tmp_dir (), g_user_name, ".cache", NULL);
+            cache_dir = g_build_filename (g_get_tmp_dir (), g_get_user_name (), ".cache", NULL);
 	}
       g_user_cache_dir = cache_dir;
     }
@@ -1662,8 +1655,7 @@ load_user_special_dirs (void)
       
       if (is_relative)
         {
-          g_get_any_init ();
-          g_user_special_dirs[directory] = g_build_filename (g_home_dir, d, NULL);
+          g_user_special_dirs[directory] = g_build_filename (g_get_home_dir (), d, NULL);
         }
       else
 	g_user_special_dirs[directory] = g_strdup (d);
@@ -1769,12 +1761,7 @@ g_get_user_special_dir (GUserDirectory directory)
 
       /* Special-case desktop for historical compatibility */
       if (g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] == NULL)
-        {
-          g_get_any_init ();
-
-          g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] =
-            g_build_filename (g_home_dir, "Desktop", NULL);
-        }
+        g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = g_build_filename (g_get_home_dir (), "Desktop", NULL);
     }
 
   G_UNLOCK (g_utils_global);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]