summaryrefslogtreecommitdiff
path: root/mate-session/gsm-autostart-app.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-12-03 05:18:09 -0800
committerStefano Karapetsas <[email protected]>2012-12-03 05:18:09 -0800
commite77126e887b5742d646c23144cb46640d8479e26 (patch)
tree44aff3c171095a5efae49ced4b0cf25ff7b28a4b /mate-session/gsm-autostart-app.c
parentc870279717fd86fe4d51094f619f817322397440 (diff)
parentab54fb597daeeabde8ef7d2bcac259aa5769dc7b (diff)
downloadmate-session-manager-e77126e887b5742d646c23144cb46640d8479e26.tar.bz2
mate-session-manager-e77126e887b5742d646c23144cb46640d8479e26.tar.xz
Merge pull request #13 from leigh123linux/master
Add autostart condition through GSettings
Diffstat (limited to 'mate-session/gsm-autostart-app.c')
-rw-r--r--mate-session/gsm-autostart-app.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mate-session/gsm-autostart-app.c b/mate-session/gsm-autostart-app.c
index ef22911..f19f6b6 100644
--- a/mate-session/gsm-autostart-app.c
+++ b/mate-session/gsm-autostart-app.c
@@ -47,8 +47,9 @@ enum {
GSM_CONDITION_NONE = 0,
GSM_CONDITION_IF_EXISTS = 1,
GSM_CONDITION_UNLESS_EXISTS = 2,
- GSM_CONDITION_MATE = 3,
- GSM_CONDITION_UNKNOWN = 4
+ GSM_CONDITION_MATE = 3,
+ GSM_CONDITION_GSETTINGS = 4,
+ GSM_CONDITION_UNKNOWN = 5
};
#define GSM_SESSION_CLIENT_DBUS_INTERFACE "org.mate.SessionClient"
@@ -163,6 +164,8 @@ parse_condition_string (const char *condition_string,
kind = GSM_CONDITION_UNLESS_EXISTS;
} else if (!g_ascii_strncasecmp (condition_string, "MATE", len)) {
kind = GSM_CONDITION_MATE;
+ } else if (!g_ascii_strncasecmp (condition_string, "GSettings", len)) {
+ kind = GSM_CONDITION_GSETTINGS;
} else {
key = NULL;
kind = GSM_CONDITION_UNKNOWN;
@@ -389,6 +392,8 @@ setup_condition_monitor (GsmAutostartApp *app)
g_free (file_path);
} else if (kind == GSM_CONDITION_MATE) {
disabled = !setup_gsettings_condition_monitor (app, key);
+ } else if (kind == GSM_CONDITION_GSETTINGS) {
+ disabled = !setup_gsettings_condition_monitor (app, key);
} else {
disabled = TRUE;
}
@@ -578,6 +583,11 @@ gsm_autostart_app_dispose (GObject *object)
priv->condition_string = NULL;
}
+ if (priv->condition_settings) {
+ g_object_unref (priv->condition_settings);
+ priv->condition_settings = NULL;
+ }
+
if (priv->desktop_file) {
egg_desktop_file_free (priv->desktop_file);
priv->desktop_file = NULL;
@@ -671,6 +681,11 @@ is_conditionally_disabled (GsmApp *app)
elems = g_strsplit (key, " ", 2);
disabled = !g_settings_get_boolean (priv->condition_settings, elems[1]);
g_strfreev (elems);
+ } else if (kind == GSM_CONDITION_GSETTINGS && priv->condition_settings != NULL) {
+ char **elems;
+ elems = g_strsplit (key, " ", 2);
+ disabled = !g_settings_get_boolean (priv->condition_settings, elems[1]);
+ g_strfreev (elems);
} else {
disabled = TRUE;
}