diff options
author | infirit <[email protected]> | 2014-11-07 12:59:59 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-11-07 14:31:51 +0100 |
commit | acbe76ca6d576c397112c08b86bb9c301102f4ab (patch) | |
tree | c1b9e91e637363304f5d61d83289bd3b92f3efa3 | |
parent | 50b6f0d9f4b8a47bb2886756cc337cd5ffe66338 (diff) | |
download | mate-session-manager-acbe76ca6d576c397112c08b86bb9c301102f4ab.tar.bz2 mate-session-manager-acbe76ca6d576c397112c08b86bb9c301102f4ab.tar.xz |
gsm: Do not assume XSMP clients set the SmProgram property
Since setting some properties can be skipped, there is no guarantee that
SmProgram is set.
Based on gnome-session commit: 35a9945ae1339297de2e0eeff543e876186dea6e
From: Vincent Untz <[email protected]>
Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=590828
-rw-r--r-- | mate-session/gsm-xsmp-client.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/mate-session/gsm-xsmp-client.c b/mate-session/gsm-xsmp-client.c index f8b78c2..759e2ab 100644 --- a/mate-session/gsm-xsmp-client.c +++ b/mate-session/gsm-xsmp-client.c @@ -524,6 +524,11 @@ get_desktop_file_path (GsmXSMPClient *client) /* If we can't get desktop file from GsmDesktopFile then we * try to find the desktop file from its program name */ prop = find_property (client, SmProgram, NULL); + + if (!prop) { + goto out; + } + program_name = prop->vals[0].value; dirs = gsm_util_get_autostart_dirs (); @@ -551,7 +556,16 @@ set_desktop_file_keys_from_client (GsmClient *client, char *comment; prop = find_property (GSM_XSMP_CLIENT (client), SmProgram, NULL); - name = g_strdup (prop->vals[0].value); + + if (prop) { + name = g_strdup (prop->vals[0].value); + } else { + /* It'd be really surprising to reach this code: if we're here, + * then the XSMP client already has set several XSMP + * properties. But it could still be that SmProgram is not set. + */ + name = g_strdup (_("Remembered Application")); + } comment = g_strdup_printf ("Client %s which was automatically saved", gsm_client_peek_startup_id (client)); @@ -639,6 +653,7 @@ xsmp_save (GsmClient *client, desktop_file_path = get_desktop_file_path (GSM_XSMP_CLIENT (client)); + /* this can accept desktop_file_path == NULL */ keyfile = create_client_key_file (client, desktop_file_path, &local_error); @@ -778,10 +793,12 @@ static char * xsmp_get_app_name (GsmClient *client) { SmProp *prop; - char *name; + char *name = NULL; prop = find_property (GSM_XSMP_CLIENT (client), SmProgram, NULL); - name = prop_to_command (prop); + if (prop) { + name = prop_to_command (prop); + } return name; } |