Commit 21690a7f authored by Mario Sanchez Prada's avatar Mario Sanchez Prada

autostart-app: Add support for absolute paths on AutostartCondition

This allows specifying in AutostartCondition paths to files that
we would like to monitor outside the user's config directory by
using absolute paths.

https://bugzilla.gnome.org/show_bug.cgi?id=777994
parent a9e98056
......@@ -470,6 +470,14 @@ unless_session_condition_cb (GObject *object,
}
}
static char *
resolve_conditional_file_path (const char *file)
{
if (g_path_is_absolute (file))
return g_strdup (file);
return g_build_filename (g_get_user_config_dir (), file, NULL);
}
static void
setup_condition_monitor (GsmAutostartApp *app)
{
......@@ -516,8 +524,7 @@ setup_condition_monitor (GsmAutostartApp *app)
char *file_path;
GFile *file;
file_path = g_build_filename (g_get_user_config_dir (), key, NULL);
file_path = resolve_conditional_file_path (key);
disabled = !g_file_test (file_path, G_FILE_TEST_EXISTS);
file = g_file_new_for_path (file_path);
......@@ -533,8 +540,7 @@ setup_condition_monitor (GsmAutostartApp *app)
char *file_path;
GFile *file;
file_path = g_build_filename (g_get_user_config_dir (), key, NULL);
file_path = resolve_conditional_file_path (key);
disabled = g_file_test (file_path, G_FILE_TEST_EXISTS);
file = g_file_new_for_path (file_path);
......@@ -835,13 +841,13 @@ is_conditionally_disabled (GsmApp *app)
if (kind == GSM_CONDITION_IF_EXISTS) {
char *file_path;
file_path = g_build_filename (g_get_user_config_dir (), key, NULL);
file_path = resolve_conditional_file_path (key);
disabled = !g_file_test (file_path, G_FILE_TEST_EXISTS);
g_free (file_path);
} else if (kind == GSM_CONDITION_UNLESS_EXISTS) {
char *file_path;
file_path = g_build_filename (g_get_user_config_dir (), key, NULL);
file_path = resolve_conditional_file_path (key);
disabled = g_file_test (file_path, G_FILE_TEST_EXISTS);
g_free (file_path);
#ifdef HAVE_GCONF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment