[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
This commit is contained in:
Florian Müllner 2010-05-04 13:24:06 +02:00
parent 39a24b9a6d
commit b1486f54c8
5 changed files with 20 additions and 21 deletions

View File

@ -119,8 +119,7 @@ function loadExtension(dir, enabled, type) {
} }
function init() { function init() {
let userConfigPath = GLib.get_user_config_dir(); let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
let userExtensionsPath = GLib.build_filenamev([userConfigPath, 'gnome-shell', 'extensions']);
userExtensionsDir = Gio.file_new_for_path(userExtensionsPath); userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
try { try {
userExtensionsDir.make_directory_with_parents(null); userExtensionsDir.make_directory_with_parents(null);

View File

@ -442,7 +442,7 @@ function LookingGlass() {
LookingGlass.prototype = { LookingGlass.prototype = {
_init : function() { _init : function() {
this._idleHistorySaveId = 0; 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._historyFile = Gio.file_new_for_path(historyPath);
this._savedText = null; this._savedText = null;
this._historyNavIndex = -1; this._historyNavIndex = -1;

View File

@ -301,7 +301,7 @@ use an extension title clicktofocus@janedoe.example.com.'''
if uuid == '': if uuid == '':
uuid = sample_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): if os.path.exists(extension_path):
print "Extension path %r already exists" % (extension_path, ) print "Extension path %r already exists" % (extension_path, )
sys.exit(0) sys.exit(0)

View File

@ -381,7 +381,7 @@ on_session_status_changed (DBusGProxy *proxy,
static void static void
shell_app_usage_init (ShellAppUsage *self) shell_app_usage_init (ShellAppUsage *self)
{ {
char *shell_config_dir, *path; char *shell_userdata_dir, *path;
DBusGConnection *session_bus; DBusGConnection *session_bus;
ShellWindowTracker *tracker; ShellWindowTracker *tracker;
@ -404,9 +404,9 @@ shell_app_usage_init (ShellAppUsage *self)
self->currently_idle = FALSE; self->currently_idle = FALSE;
self->enable_monitoring = FALSE; self->enable_monitoring = FALSE;
g_object_get (shell_global_get(), "configdir", &shell_config_dir, NULL), g_object_get (shell_global_get(), "userdatadir", &shell_userdata_dir, NULL),
path = g_build_filename (shell_config_dir, DATA_FILENAME, NULL); path = g_build_filename (shell_userdata_dir, DATA_FILENAME, NULL);
g_free (shell_config_dir); g_free (shell_userdata_dir);
self->configfile = g_file_new_for_path (path); self->configfile = g_file_new_for_path (path);
g_free (path); g_free (path);
restore_from_file (self); restore_from_file (self);

View File

@ -50,7 +50,7 @@ struct _ShellGlobal {
ShellWM *wm; ShellWM *wm;
const char *datadir; const char *datadir;
const char *imagedir; const char *imagedir;
const char *configdir; const char *userdatadir;
/* Displays the root window; see shell_global_create_root_pixmap_actor() */ /* Displays the root window; see shell_global_create_root_pixmap_actor() */
ClutterActor *root_pixmap; ClutterActor *root_pixmap;
@ -70,7 +70,7 @@ enum {
PROP_WINDOW_MANAGER, PROP_WINDOW_MANAGER,
PROP_DATADIR, PROP_DATADIR,
PROP_IMAGEDIR, PROP_IMAGEDIR,
PROP_CONFIGDIR, PROP_USERDATADIR,
}; };
/* Signals */ /* Signals */
@ -145,8 +145,8 @@ shell_global_get_property(GObject *object,
case PROP_IMAGEDIR: case PROP_IMAGEDIR:
g_value_set_string (value, global->imagedir); g_value_set_string (value, global->imagedir);
break; break;
case PROP_CONFIGDIR: case PROP_USERDATADIR:
g_value_set_string (value, global->configdir); g_value_set_string (value, global->userdatadir);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 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"); const char *datadir = g_getenv ("GNOME_SHELL_DATADIR");
char *imagedir; char *imagedir;
GFile *conf_dir; GFile *userdata_dir;
if (!datadir) if (!datadir)
datadir = GNOME_SHELL_DATADIR; datadir = GNOME_SHELL_DATADIR;
@ -179,10 +179,10 @@ shell_global_init (ShellGlobal *global)
} }
/* Ensure config dir exists for later use */ /* Ensure config dir exists for later use */
global->configdir = g_build_filename (g_get_home_dir (), ".gnome2", "shell", NULL); global->userdatadir = g_build_filename (g_get_user_data_dir (), "gnome-shell", NULL);
conf_dir = g_file_new_for_path (global->configdir); userdata_dir = g_file_new_for_path (global->userdatadir);
g_file_make_directory (conf_dir, NULL, NULL); g_file_make_directory (userdata_dir, NULL, NULL);
g_object_unref (conf_dir); g_object_unref (userdata_dir);
global->grab_notifier = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL)); global->grab_notifier = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
g_signal_connect (global->grab_notifier, "grab-notify", G_CALLBACK (grab_notify), global); g_signal_connect (global->grab_notifier, "grab-notify", G_CALLBACK (grab_notify), global);
@ -278,10 +278,10 @@ shell_global_class_init (ShellGlobalClass *klass)
NULL, NULL,
G_PARAM_READABLE)); G_PARAM_READABLE));
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CONFIGDIR, PROP_USERDATADIR,
g_param_spec_string ("configdir", g_param_spec_string ("userdatadir",
"Configuration directory", "User data directory",
"Directory containing gnome-shell configuration files", "Directory containing gnome-shell user data",
NULL, NULL,
G_PARAM_READABLE)); G_PARAM_READABLE));
} }