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); } }
static JSBool js_createAction(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { js_setting_group_t *jsg = JS_GetPrivate(cx, obj); const char *id; const char *title; JSObject *func; if(!JS_ConvertArguments(cx, argc, argv, "sso", &id, &title, &func)){ return JS_FALSE; } js_setting_t *jss = jss_create(cx, obj, id, rval, func, jsg, 0); if(jss == NULL) return JS_FALSE; jss->jss_s = settings_create_action(jsg->jsg_root, _p(title), js_action_function, jss, jsg->jsg_settings_flags, js_global_pc); jss->jss_cx = NULL; return JS_TRUE; }
void keyring_init(void) { hts_mutex_init(&keyring_mutex); if((persistent_keyring = htsmsg_store_load("keyring")) == NULL) persistent_keyring = htsmsg_create_map(); temporary_keyring = htsmsg_create_map(); settings_create_action(settings_general, _p("Forget remembered passwords"), keyring_clear, NULL, NULL); }
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); }