[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:
parent
39a24b9a6d
commit
b1486f54c8
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user