Example #1
0
void
runcontrol_init(void)
{
  prop_t *rc;

  rc = prop_create(prop_get_global(), "runcontrol");

  prop_set(rc, "canStandby",   PROP_SET_INT,  !!gconf.can_standby);
  prop_set(rc, "canPowerOff",  PROP_SET_INT,  !!gconf.can_poweroff);
  prop_set(rc, "canLogout",    PROP_SET_INT,  !!gconf.can_logout);
  prop_set(rc, "canOpenShell", PROP_SET_INT,  !!gconf.can_open_shell);
  prop_set(rc, "canRestart",   PROP_SET_INT,  !!gconf.can_restart);
  prop_set(rc, "canExit",      PROP_SET_INT,   !gconf.can_not_exit);

  if(!(gconf.can_standby ||
       gconf.can_poweroff ||
       gconf.can_logout ||
       gconf.can_open_shell ||
       gconf.can_restart ||
       !gconf.can_not_exit))
    return;

  settings_create_separator(gconf.settings_general,
			  _p("Starting and stopping"));

  if(gconf.can_standby) {
    init_autostandby();
    init_sleeptimer(rc);
    settings_create_action(gconf.settings_general, _p("Standby"),
			   do_standby, NULL, 0, NULL);
  }

  if(gconf.can_poweroff)
    settings_create_action(gconf.settings_general, _p("Power off system"),
			   do_power_off, NULL, 0, NULL);

  if(gconf.can_logout)
    settings_create_action(gconf.settings_general, _p("Logout"),
			   do_logout, NULL, 0, NULL);

  if(gconf.can_open_shell)
    settings_create_action(gconf.settings_general, _p("Open shell"),
			   do_open_shell, NULL, 0, NULL);

  if(!gconf.can_not_exit)
    settings_create_action(gconf.settings_general, _p("Quit"),
			   do_exit, NULL, 0, NULL);

  if(gconf.shell_fd > 0) {

    settings_create_separator(gconf.settings_network, _p("SSH server"));

    setting_create(SETTING_BOOL, gconf.settings_network,SETTINGS_INITIAL_UPDATE,
		   SETTING_TITLE(_p("Enable SSH server")),
		   SETTING_VALUE(0),
		   SETTING_CALLBACK(set_ssh_server, NULL),
		   SETTING_STORE("runcontrol", "sshserver"),
		   NULL);
  }
}
Example #2
0
void
runcontrol_init(void)
{
    prop_t *rc;

    if(!(showtime_can_standby ||
            showtime_can_poweroff ||
            showtime_can_logout ||
            showtime_can_open_shell))
        return;

    settings_create_divider(settings_general,
                            _p("Starting and stopping Showtime"));

    rc = prop_create(prop_get_global(), "runcontrol");

    prop_set_int(prop_create(rc, "canStandby"),   !!showtime_can_standby);
    prop_set_int(prop_create(rc, "canPowerOff"),  !!showtime_can_poweroff);
    prop_set_int(prop_create(rc, "canLogout"),    !!showtime_can_logout);
    prop_set_int(prop_create(rc, "canOpenShell"), !!showtime_can_open_shell);

    if(showtime_can_standby)
        init_autostandby();

    if(showtime_can_poweroff)
        settings_create_action(settings_general, _p("Power off system"),
                               do_power_off, NULL, NULL);

    if(showtime_can_logout)
        settings_create_action(settings_general, _p("Logout"),
                               do_logout, NULL, NULL);

    if(showtime_can_open_shell)
        settings_create_action(settings_general, _p("Open shell"),
                               do_open_shell, NULL, NULL);
}