void session_shutdown(gboolean permanent) {}
GList* session_state_find(struct _ObClient *c) { return NULL; }
void session_request_logout(gboolean silent) {}
+gboolean session_connected(void) { return FALSE; }
#else
#include "debug.h"
}
}
+gboolean session_connected(void)
+{
+ return !!sm_conn;
+}
+
/*! Connect to the session manager and set up our callback functions */
static gboolean session_connect()
{
SmcSaveYourselfDone(conn, success);
}
-
static void sm_save_yourself(SmcConn conn, SmPointer data, gint save_type,
Bool shutdown, gint interact_style, Bool fast)
{
ObSMSaveData *savedata = NULL;
gchar *vendor;
- ob_debug_type(OB_DEBUG_SM, "Session save requested\n");
+#ifdef DEBUG
+ {
+ const gchar *sname =
+ (save_type == SmSaveLocal ? "SmSaveLocal" :
+ (save_type == SmSaveGlobal ? "SmSaveGlobal" :
+ (save_type == SmSaveBoth ? "SmSaveBoth" : "INVALID!!")));
+ ob_debug_type(OB_DEBUG_SM, "Session save requested, type %s\n", sname);
+ }
+#endif
+
+ if (save_type == SmSaveGlobal) {
+ /* we have no data to save. we only store state to get back to where
+ we were, we don't keep open writable files or anything */
+ SmcSaveYourselfDone(conn, TRUE);
+ return;
+ }
vendor = SmcVendor(sm_conn);
ob_debug_type(OB_DEBUG_SM, "Session manager's vendor: %s\n", vendor);
if (screen_desktop_names) {
gint i;
+ gchar *t;
fprintf(f, "<desktopnames>\n");
- for (i = 0; screen_desktop_names[i]; ++i)
- fprintf(f, " <name>%s</name>\n", screen_desktop_names[i]);
+ for (i = 0; screen_desktop_names[i]; ++i){
+ t = g_markup_escape_text(screen_desktop_names[i], -1);
+ fprintf(f, " <name>%s</name>\n", t);
+ g_free(t);
+ }
fprintf(f, "</desktopnames>\n");
}
if (c->sm_client_id)
fprintf(f, "<window id=\"%s\">\n", c->sm_client_id);
- else
- fprintf(f, "<window command=\"%s\">\n", c->wm_command);
+ else {
+ t = g_markup_escape_text(c->wm_command, -1);
+ fprintf(f, "<window command=\"%s\">\n", t);
+ g_free(t);
+ }
t = g_markup_escape_text(c->name, -1);
fprintf(f, "\t<name>%s</name>\n", t);
{
if (sm_conn) {
SmcRequestSaveYourself(sm_conn,
- SmSaveBoth,
+ SmSaveGlobal,
TRUE, /* logout */
(silent ?
SmInteractStyleNone : SmInteractStyleAny),