コード例 #1
0
        private void OnQueryEndSession(uint flags)
        {
            Logger.Info("Received end session query");

            // The session might not actually end but it would be nice to start
            // some cleanup actions like saving notes here

            // Let the session manager know its OK to continue
            try {
                ClientPrivate client = Bus.Session.GetObject <ClientPrivate> (Constants.SessionManagerInterfaceName,
                                                                              session_client_id);
                client.EndSessionResponse(true, String.Empty);
            } catch (Exception e) {
                Logger.Debug("Failed to respond to session manager: {0}", e.Message);
            }
        }
コード例 #2
0
        private void OnEndSession(uint flags)
        {
            Logger.Info("Received end session signal");

            if (ExitingEvent != null)
            {
                ExitingEvent(null, new EventArgs());
            }

            // Let the session manager know its OK to continue
            // Ideally we would wait for all the exit events to finish
            try {
                ClientPrivate client = Bus.Session.GetObject <ClientPrivate> (Constants.SessionManagerInterfaceName,
                                                                              session_client_id);
                client.EndSessionResponse(true, String.Empty);
            } catch (Exception e) {
                Logger.Debug("Failed to respond to session manager: {0}", e.Message);
            }
        }
コード例 #3
0
        public void Initialize(string locale_dir,
                               string display_name,
                               string process_name,
                               string [] args)
        {
            try {
                SetProcessName(process_name);
            } catch {}             // Ignore exception if fail (not needed to run)

            // Register handler for saving session when logging out of Gnome
            BusG.Init();
            string startup_id = Environment.GetEnvironmentVariable("DESKTOP_AUTOSTART_ID");

            if (String.IsNullOrEmpty(startup_id))
            {
                startup_id = display_name;
            }

            try {
                SessionManager session = Bus.Session.GetObject <SessionManager> (Constants.SessionManagerInterfaceName,
                                                                                 new ObjectPath(Constants.SessionManagerPath));
                session_client_id = session.RegisterClient(display_name, startup_id);

                ClientPrivate client = Bus.Session.GetObject <ClientPrivate> (Constants.SessionManagerInterfaceName,
                                                                              session_client_id);
                client.QueryEndSession += OnQueryEndSession;
                client.EndSession      += OnEndSession;
                client.Stop            += OnStop;
            } catch (Exception e) {
                Logger.Debug("Failed to register with session manager: {0}", e.Message);
            }

            Gtk.Application.Init();
#if PANEL_APPLET
            program = new Gnome.Program(display_name,
                                        Defines.VERSION,
                                        Gnome.Modules.UI,
                                        args);
#endif
        }