From c51ef797a707f4e2c6f9688d4378f2b0e9898a66 Mon Sep 17 00:00:00 2001 From: Perberos Date: Thu, 1 Dec 2011 22:56:10 -0300 Subject: moving from https://github.com/perberos/mate-desktop-environment --- mate-panel/panel-session.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 mate-panel/panel-session.c (limited to 'mate-panel/panel-session.c') diff --git a/mate-panel/panel-session.c b/mate-panel/panel-session.c new file mode 100644 index 00000000..1175b3dc --- /dev/null +++ b/mate-panel/panel-session.c @@ -0,0 +1,80 @@ +/* + * panel-session.c: panel session management routines + * + * Copyright (C) 2003 Sun Microsystems, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Authors: + * Mark McLoughlin + */ + +#include + +#include + +#include + +#include + +#include "panel-shell.h" + +#include "panel-session.h" + +static gboolean do_not_restart = FALSE; + +static void +panel_session_handle_quit (EggSMClient *client, + gpointer data) +{ + panel_shell_quit (); +} + +void +panel_session_do_not_restart (void) +{ + do_not_restart = TRUE; + + if (egg_sm_client_get_mode () != EGG_SM_CLIENT_MODE_DISABLED) + egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_NO_RESTART); +} + +void +panel_session_init (void) +{ + EggSMClientMode mode; + EggSMClient *client; + + /* Explicitly tell the session manager we're ready -- we don't do it + * before. Note: this depends on setting the mode to DISABLED early + * during startup. */ + + if (do_not_restart || getenv ("MATE_PANEL_DEBUG")) + mode = EGG_SM_CLIENT_MODE_NO_RESTART; + else + mode = EGG_SM_CLIENT_MODE_NORMAL; + + egg_sm_client_set_mode (mode); + + client = egg_sm_client_get (); + + g_signal_connect (client, "quit", + G_CALLBACK (panel_session_handle_quit), NULL); + + /* We don't want the WM to try and save/restore our + * window position */ + gdk_set_sm_client_id (NULL); +} -- cgit v1.2.1