Exemplo n.º 1
0
    def shutdown_completed(self):
        if env.is_emulator():
            self._close_emulator()
        elif self._logout_mode != self.MODE_LOGOUT:
            bus = dbus.SystemBus()
            if have_systemd():
                try:
                    proxy = bus.get_object("org.freedesktop.login1", "/org/freedesktop/login1")
                    pm = dbus.Interface(proxy, "org.freedesktop.login1.Manager")

                    if self._logout_mode == self.MODE_SHUTDOWN:
                        pm.PowerOff(False)
                    elif self._logout_mode == self.MODE_REBOOT:
                        pm.Reboot(True)
                except:
                    logging.exception("Can not stop sugar")
                    self.session.cancel_shutdown()
                    return
            else:
                CONSOLEKIT_DBUS_PATH = "/org/freedesktop/ConsoleKit/Manager"
                try:
                    proxy = bus.get_object("org.freedesktop.ConsoleKit", CONSOLEKIT_DBUS_PATH)
                    pm = dbus.Interface(proxy, "org.freedesktop.ConsoleKit.Manager")

                    if self._logout_mode == self.MODE_SHUTDOWN:
                        pm.Stop()
                    elif self._logout_mode == self.MODE_REBOOT:
                        pm.Restart()
                except:
                    logging.exception("Can not stop sugar")
                    self.session.cancel_shutdown()
                    return

        session.SessionManager.shutdown_completed(self)
        gtk.main_quit()
Exemplo n.º 2
0
    def shutdown_completed(self):
        if env.is_emulator():
            self._close_emulator()
        elif self._logout_mode != self.MODE_LOGOUT:
            bus = dbus.SystemBus()
            if have_systemd():
                try:
                    proxy = bus.get_object('org.freedesktop.login1',
                                           '/org/freedesktop/login1')
                    pm = dbus.Interface(proxy,
                                        'org.freedesktop.login1.Manager')

                    if self._logout_mode == self.MODE_SHUTDOWN:
                        pm.PowerOff(False)
                    elif self._logout_mode == self.MODE_REBOOT:
                        pm.Reboot(True)
                except:
                    logging.exception('Can not stop sugar')
                    self.session.cancel_shutdown()
                    return
            else:
                CONSOLEKIT_DBUS_PATH = '/org/freedesktop/ConsoleKit/Manager'
                try:
                    proxy = bus.get_object('org.freedesktop.ConsoleKit',
                                           CONSOLEKIT_DBUS_PATH)
                    pm = dbus.Interface(proxy,
                                        'org.freedesktop.ConsoleKit.Manager')

                    if self._logout_mode == self.MODE_SHUTDOWN:
                        pm.Stop()
                    elif self._logout_mode == self.MODE_REBOOT:
                        pm.Restart()
                except:
                    logging.exception('Can not stop sugar')
                    self.session.cancel_shutdown()
                    return

        session.SessionManager.shutdown_completed(self)
        gtk.main_quit()
Exemplo n.º 3
0
def restore():
    if env.is_emulator() is False:
        client = gconf.client_get_default()
        set_volume(client.get_int('/desktop/sugar/sound/volume'))
Exemplo n.º 4
0
def save():
    if env.is_emulator() is False:
        client = gconf.client_get_default()
        client.set_int('/desktop/sugar/sound/volume', get_volume())
Exemplo n.º 5
0
def restore():
    if env.is_emulator() is False:
        client = gconf.client_get_default()
        set_volume(client.get_int('/desktop/sugar/sound/volume'))
Exemplo n.º 6
0
def save():
    if env.is_emulator() is False:
        client = gconf.client_get_default()
        client.set_int('/desktop/sugar/sound/volume', get_volume())