use a global config dir (for app monitor)

Ensure a configuration dir exists, and provide its path as 'configdir' property of ShellGlobal. This will be used by ShellAppMonitor.
This commit is contained in:
Milan Bouchet-Valat 2009-04-23 23:10:37 +02:00 committed by Colin Walters
parent 81b3f7cf44
commit 17a4a3a949

View File

@ -42,6 +42,7 @@ struct _ShellGlobal {
ShellWM *wm; ShellWM *wm;
gboolean keyboard_grabbed; gboolean keyboard_grabbed;
const char *imagedir; const char *imagedir;
const char *configdir;
/* Displays the root window; see shell_global_create_root_pixmap_actor() */ /* Displays the root window; see shell_global_create_root_pixmap_actor() */
ClutterGLXTexturePixmap *root_pixmap; ClutterGLXTexturePixmap *root_pixmap;
@ -57,7 +58,8 @@ enum {
PROP_STAGE, PROP_STAGE,
PROP_WINDOW_GROUP, PROP_WINDOW_GROUP,
PROP_WINDOW_MANAGER, PROP_WINDOW_MANAGER,
PROP_IMAGEDIR PROP_IMAGEDIR,
PROP_CONFIGDIR,
}; };
/* Signals */ /* Signals */
@ -130,6 +132,9 @@ 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:
g_value_set_string (value, global->configdir);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -141,6 +146,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;
if (!datadir) if (!datadir)
datadir = GNOME_SHELL_DATADIR; datadir = GNOME_SHELL_DATADIR;
@ -158,6 +164,12 @@ shell_global_init (ShellGlobal *global)
global->imagedir = g_strdup_printf ("%s/", datadir); global->imagedir = g_strdup_printf ("%s/", datadir);
} }
/* 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->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);
global->grab_active = FALSE; global->grab_active = FALSE;
@ -248,6 +260,13 @@ shell_global_class_init (ShellGlobalClass *klass)
"Directory containing gnome-shell image files", "Directory containing gnome-shell image files",
NULL, NULL,
G_PARAM_READABLE)); 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",
NULL,
G_PARAM_READABLE));
} }
/** /**