[gnome-shell] [ShellGlobal] Change location for user files to XDG_DATA_HOME



commit b1486f54c8b64156db1b2a539d1fc18461bfafc7
Author: Florian Müllner <fmuellner src gnome org>
Date:   Tue May 4 13:24:06 2010 +0200

    [ShellGlobal] Change location for user files to XDG_DATA_HOME
    
    While the extension system already uses an XDG location (XDG_CONFIG_HOME),
    other components use the deprecated $HOME/.gnome2 directory.
    Replace both with XDG_DATA_HOME - the existing data (app usage stats,
    looking glass history and extensions) is not migrated to the new location.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=617555

 js/ui/extensionSystem.js |    3 +--
 js/ui/lookingGlass.js    |    2 +-
 src/gnome-shell.in       |    2 +-
 src/shell-app-usage.c    |    8 ++++----
 src/shell-global.c       |   26 +++++++++++++-------------
 5 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 6e28623..8c0ab4c 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -119,8 +119,7 @@ function loadExtension(dir, enabled, type) {
 }
 
 function init() {
-    let userConfigPath = GLib.get_user_config_dir();
-    let userExtensionsPath = GLib.build_filenamev([userConfigPath, 'gnome-shell', 'extensions']);
+    let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
     userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
     try {
         userExtensionsDir.make_directory_with_parents(null);
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 5283850..a2c4970 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -442,7 +442,7 @@ function LookingGlass() {
 LookingGlass.prototype = {
     _init : function() {
         this._idleHistorySaveId = 0;
-        let historyPath = global.configdir + "/lookingglass-history.txt";
+        let historyPath = global.userdatadir + "/lookingglass-history.txt";
         this._historyFile = Gio.file_new_for_path(historyPath);
         this._savedText = null;
         this._historyNavIndex = -1;
diff --git a/src/gnome-shell.in b/src/gnome-shell.in
index 51ab4b7..27f7b0d 100644
--- a/src/gnome-shell.in
+++ b/src/gnome-shell.in
@@ -301,7 +301,7 @@ use an extension title clicktofocus janedoe example com '''
     if uuid == '':
         uuid = sample_uuid
 
-    extension_path = os.path.join(os.path.expanduser('~/.config'), 'gnome-shell', 'extensions', uuid)
+    extension_path = os.path.join(os.path.expanduser('~/.local'), 'share', 'gnome-shell', 'extensions', uuid)
     if os.path.exists(extension_path):
         print "Extension path %r already exists" % (extension_path, )
         sys.exit(0)
diff --git a/src/shell-app-usage.c b/src/shell-app-usage.c
index cd086bb..2210f17 100644
--- a/src/shell-app-usage.c
+++ b/src/shell-app-usage.c
@@ -381,7 +381,7 @@ on_session_status_changed (DBusGProxy      *proxy,
 static void
 shell_app_usage_init (ShellAppUsage *self)
 {
-  char *shell_config_dir, *path;
+  char *shell_userdata_dir, *path;
   DBusGConnection *session_bus;
   ShellWindowTracker *tracker;
 
@@ -404,9 +404,9 @@ shell_app_usage_init (ShellAppUsage *self)
   self->currently_idle = FALSE;
   self->enable_monitoring = FALSE;
 
-  g_object_get (shell_global_get(), "configdir", &shell_config_dir, NULL),
-  path = g_build_filename (shell_config_dir, DATA_FILENAME, NULL);
-  g_free (shell_config_dir);
+  g_object_get (shell_global_get(), "userdatadir", &shell_userdata_dir, NULL),
+  path = g_build_filename (shell_userdata_dir, DATA_FILENAME, NULL);
+  g_free (shell_userdata_dir);
   self->configfile = g_file_new_for_path (path);
   g_free (path);
   restore_from_file (self);
diff --git a/src/shell-global.c b/src/shell-global.c
index d2d2908..7040bf1 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -50,7 +50,7 @@ struct _ShellGlobal {
   ShellWM *wm;
   const char *datadir;
   const char *imagedir;
-  const char *configdir;
+  const char *userdatadir;
 
   /* Displays the root window; see shell_global_create_root_pixmap_actor() */
   ClutterActor *root_pixmap;
@@ -70,7 +70,7 @@ enum {
   PROP_WINDOW_MANAGER,
   PROP_DATADIR,
   PROP_IMAGEDIR,
-  PROP_CONFIGDIR,
+  PROP_USERDATADIR,
 };
 
 /* Signals */
@@ -145,8 +145,8 @@ shell_global_get_property(GObject         *object,
     case PROP_IMAGEDIR:
       g_value_set_string (value, global->imagedir);
       break;
-    case PROP_CONFIGDIR:
-      g_value_set_string (value, global->configdir);
+    case PROP_USERDATADIR:
+      g_value_set_string (value, global->userdatadir);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -159,7 +159,7 @@ shell_global_init (ShellGlobal *global)
 {
   const char *datadir = g_getenv ("GNOME_SHELL_DATADIR");
   char *imagedir;
-  GFile *conf_dir;
+  GFile *userdata_dir;
 
   if (!datadir)
     datadir = GNOME_SHELL_DATADIR;
@@ -179,10 +179,10 @@ shell_global_init (ShellGlobal *global)
     }
 
   /* Ensure config dir exists for later use */
-  global->configdir = g_build_filename (g_get_home_dir (), ".gnome2", "shell", NULL);
-  conf_dir = g_file_new_for_path (global->configdir);
-  g_file_make_directory (conf_dir, NULL, NULL);
-  g_object_unref (conf_dir);
+  global->userdatadir = g_build_filename (g_get_user_data_dir (), "gnome-shell", NULL);
+  userdata_dir = g_file_new_for_path (global->userdatadir);
+  g_file_make_directory (userdata_dir, NULL, NULL);
+  g_object_unref (userdata_dir);
   
   global->grab_notifier = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
   g_signal_connect (global->grab_notifier, "grab-notify", G_CALLBACK (grab_notify), global);
@@ -278,10 +278,10 @@ shell_global_class_init (ShellGlobalClass *klass)
                                                         NULL,
                                                         G_PARAM_READABLE));
   g_object_class_install_property (gobject_class,
-                                   PROP_CONFIGDIR,
-                                   g_param_spec_string ("configdir",
-                                                        "Configuration directory",
-                                                        "Directory containing gnome-shell configuration files",
+                                   PROP_USERDATADIR,
+                                   g_param_spec_string ("userdatadir",
+                                                        "User data directory",
+                                                        "Directory containing gnome-shell user data",
                                                         NULL,
                                                         G_PARAM_READABLE));
 }



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