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 void * connman_thread(void *aux) { GError *err; GDBusProxy *mgr; GMainContext *ctx = g_main_context_new(); GMainLoop *mainloop = g_main_loop_new(ctx, FALSE); connman_courier = glib_courier_create(ctx); g_main_context_push_thread_default(ctx); again: err = NULL; mgr = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START , NULL, "net.connman", "/", "net.connman.Manager", NULL, &err); if(mgr == NULL) { TRACE(TRACE_ERROR, "CONNMAN", "Unable to connect to connman -- %s", err->message); g_error_free(err); sleep(5); goto again; } g_signal_connect(G_OBJECT(mgr), "g-signal", G_CALLBACK(connman_mgr_signal), NULL); g_bus_own_name(G_BUS_TYPE_SYSTEM, "com.showtimemediacenter.showtime.network.agent", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, mgr, NULL); connman_getpropreties(mgr); connman_getservices(mgr); connman_gettechnologies(mgr); if(have_wifi) { setting_create(SETTING_BOOL, connman_settings, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Enable Wi-Fi")), SETTING_CALLBACK(set_wifi_enable, NULL), SETTING_STORE("connman", "enable_wifi"), NULL); } g_main_loop_run(mainloop); return NULL; }
static void rpi_tv_init(void) { prop_t *set = setting_get_dir("settings:tv"); setting_create(SETTING_BOOL, set, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Match display and content framerate")), SETTING_VALUE(0), SETTING_CALLBACK(set_framerate, NULL), SETTING_STORE("rpitv", "setframerate"), NULL); }
static int locatedb_init(void) { prop_t *s = search_get_settings(); setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Search using Unix locatedb")), SETTING_VALUE(1), SETTING_WRITE_BOOL(&locatedb_enabled), SETTING_STORE("locatedb", "enable"), NULL); return 0; }
int glw_ps3_start(void) { glw_ps3_t *gp = calloc(1, sizeof(glw_ps3_t)); glwps3 = gp; prop_t *root = gp->gr.gr_prop_ui = prop_create(prop_get_global(), "ui"); gp->gr.gr_prop_nav = nav_spawn(); prop_set_int(prop_create(root, "fullscreen"), 1); if(glw_ps3_init(gp)) return 1; gp->gr.gr_prop_maxtime = 10000; glw_root_t *gr = &gp->gr; if(glw_init2(gr, GLW_INIT_KEYBOARD_MODE | GLW_INIT_OVERSCAN | GLW_INIT_IN_FULLSCREEN)) return 1; settings_create_separator(glw_settings.gs_settings, _p("Dual-Shock Remote")); setting_create(SETTING_MULTIOPT, glw_settings.gs_settings, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Seek using L2 and R2 button")), SETTING_OPTION("0", _p("Yes")), SETTING_OPTION("1", _p("Yes with Select button")), SETTING_OPTION("2", _p("No")), SETTING_COURIER(gr->gr_courier), SETTING_CALLBACK(set_seekmode, gp), SETTING_STORE("glw", "analogseekmode"), NULL); gr->gr_open_osk = osk_open; TRACE(TRACE_DEBUG, "GLW", "loading universe"); glw_load_universe(gr); glw_ps3_mainloop(gp); glw_unload_universe(gr); glw_reap(gr); glw_reap(gr); return 0; }
static void init_autostandby(void) { setting_create(SETTING_INT, gconf.settings_general, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Automatic standby")), SETTING_STORE("runcontrol", "autostandby"), SETTING_WRITE_INT(&standby_delay), SETTING_RANGE(0, 60), SETTING_STEP(5), SETTING_UNIT_CSTR("min"), SETTING_ZERO_TEXT(_p("Off")), NULL); last_activity = arch_get_ts(); prop_subscribe(0, PROP_TAG_NAME("global", "media", "current", "playstatus"), PROP_TAG_CALLBACK_STRING, current_media_playstatus, NULL, NULL); callout_arm(&autostandby_timer, check_autostandby, NULL, 1); }
void notifications_init(void) { hts_mutex_init(&news_mutex); prop_t *root = prop_create(prop_get_global(), "notifications"); if((dismissed_news_in = htsmsg_store_load("dismissed_news")) == NULL) dismissed_news_in = htsmsg_create_map(); dismissed_news_out = htsmsg_create_map(); notify_prop_entries = prop_create(root, "nodes"); #if ENABLE_WEBPOPUP prop_t *dir = setting_get_dir("general:misc"); setting_create(SETTING_BOOL, dir, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Show news on home screen")), SETTING_VALUE(1), SETTING_WRITE_BOOL(&shownews), SETTING_STORE("notifications", "shownews"), NULL); #endif }
static void * libcec_init_thread(void *aux) { prop_t *set = setting_get_dir("settings:tv"); libcec_clear_configuration(&cec_config); cec_config.callbacks = &g_callbacks; snprintf(cec_config.strDeviceName, sizeof(cec_config.strDeviceName), "%s", APPNAMEUSER); cec_config.deviceTypes.types[0] = CEC_DEVICE_TYPE_RECORDING_DEVICE; conn = libcec_initialise(&cec_config); if(conn == NULL) { TRACE(TRACE_ERROR, "CEC", "Unable to init libcec"); return NULL; } libcec_init_video_standalone(conn); cec_adapter ca; int num_adapters = libcec_find_adapters(conn, &ca, 1, NULL); if(num_adapters < 1) { libcec_destroy(conn); conn = NULL; TRACE(TRACE_ERROR, "CEC", "No adapters found"); return NULL; } TRACE(TRACE_DEBUG, "CEC", "Using adapter %s on %s", ca.comm, ca.path); setting_create(SETTING_BOOL, set, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Switch TV input source")), SETTING_VALUE(1), SETTING_CALLBACK(set_activate_source, NULL), SETTING_STORE("cec", "controlinput"), NULL); setting_create(SETTING_BOOL, set, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Use STOP key for combo input")), SETTING_VALUE(1), SETTING_CALLBACK(set_stop_combo_mode, NULL), SETTING_STORE("cec", "stopcombo"), NULL); setting_create(SETTING_BOOL, set, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Longpress SELECT for item menu")), SETTING_VALUE(1), SETTING_CALLBACK(set_longpress_select, NULL), SETTING_STORE("cec", "longpress_select"), NULL); #if 0 setting_create(SETTING_BOOL, set, SETTINGS_INITIAL_UPDATE, SETTING_TITLE_CSTR("Shutdown UI when TV is off"), SETTING_WRITE_BOOL(&auto_ui_shutdown), SETTING_STORE("cec", "auto_shutdown"), NULL); #endif if(!libcec_open(conn, ca.comm, 5000)) { TRACE(TRACE_ERROR, "CEC", "Unable to open connection to %s", ca.comm); libcec_destroy(conn); conn = NULL; return NULL; } return NULL; }
void i18n_init(void) { prop_t *s = settings_add_dir(NULL, _p("Languages"), "i18n", NULL, _p("Preferred languages"), "settings:i18n"); int i; nls_init(s); #ifdef STOS setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Timezone")), SETTING_CALLBACK(set_timezone, NULL), SETTING_STORE("i18n", "timezone"), NULL); #endif setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Time format")), SETTING_STORE("i18n", "timeformat"), SETTING_WRITE_INT(&gconf.time_format), SETTING_OPTION(gconf.time_format_system ? "0" : NULL, _p("System default")), SETTING_OPTION("1", _p("24 Hour")), SETTING_OPTION("2", _p("12 Hour")), NULL); settings_create_info(s, NULL, _p("Language codes should be configured as three character ISO codes, example (eng, swe, fra)")); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Primary audio language code")), SETTING_CALLBACK(set_lang, &lang_audio[0]), SETTING_STORE("i18n", "audio1"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Secondary audio language code")), SETTING_CALLBACK(set_lang, &lang_audio[1]), SETTING_STORE("i18n", "audio2"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Tertiary audio language code")), SETTING_CALLBACK(set_lang, &lang_audio[2]), SETTING_STORE("i18n", "audio3"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Primary subtitle language code")), SETTING_CALLBACK(&set_lang, &lang_subtitle[0]), SETTING_STORE("i18n", "subtitle1"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Secondary subtitle language code")), SETTING_CALLBACK(&set_lang, &lang_subtitle[1]), SETTING_STORE("i18n", "subtitle2"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Tertiary subtitle language code")), SETTING_CALLBACK(&set_lang, &lang_subtitle[2]), SETTING_STORE("i18n", "subtitle3"), NULL); const char **optlist = NULL; const charset_t *cs; for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) {} optlist = alloca((i * 2 + 3) * sizeof(const char *)); optlist[0] = "auto"; optlist[1] = "Auto"; for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) { optlist[i * 2 + 2] = cs->id; optlist[i * 2 + 3] = cs->title; } optlist[i * 2 + 2] = NULL; setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Default character set")), SETTING_STORE("i18n", "default_charset"), SETTING_CALLBACK(set_default_charset, NULL), SETTING_OPTION_LIST(optlist), NULL); setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Ignore 'The' at beginning of words when sorting")), SETTING_STORE("i18n", "skipthe"), SETTING_WRITE_BOOL(&gconf.ignore_the_prefix), NULL); }
void video_settings_init(void) { prop_t *s; s = settings_add_dir(NULL, _p("Video playback"), "video", NULL, _p("Video acceleration and display behaviour"), "settings:video"); #if ENABLE_VDPAU setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Enable VDPAU")), SETTING_VALUE(1), SETTING_WRITE_BOOL(&video_settings.vdpau), SETTING_STORE("videoplayback", "vdpau"), NULL); setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Preferred VDPAU deinterlacer method")), SETTING_STORE("videoplayback", "vdpau_deinterlace"), SETTING_WRITE_INT(&video_settings.vdpau_deinterlace), SETTING_OPTION("2", _p("Temporal/Spatial")), SETTING_OPTION("1", _p("Temporal")), SETTING_OPTION("0", _p("Off")), NULL); setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Maximum resolution for deinterlacer")), SETTING_STORE("videoplayback", "vdpau_deinterlace_resolution_limit"), SETTING_WRITE_INT(&video_settings. vdpau_deinterlace_resolution_limit), SETTING_OPTION ("0", _p("No limit")), SETTING_OPTION_CSTR("576", "576"), SETTING_OPTION_CSTR("720", "720"), SETTING_OPTION_CSTR("1080", "1080"), NULL); #endif #if defined(__APPLE__) || defined(__ANDROID__) setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Hardware accelerated decoding")), SETTING_STORE("videoplayback", "videoaccel"), #if defined(__APPLE__) SETTING_VALUE(1), #else SETTING_VALUE(0), #endif SETTING_WRITE_BOOL(&video_settings.video_accel), NULL); #endif video_settings.vzoom_setting = setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Video zoom")), SETTING_UNIT_CSTR("%"), SETTING_RANGE(50, 200), SETTING_VALUE(100), SETTING_STORE("videoplayback", "vzoom"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.pan_horizontal_setting = setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Horizontal pan")), SETTING_UNIT_CSTR("%"), SETTING_RANGE(-100, 100), SETTING_VALUE(0), SETTING_STORE("videoplayback", "horizontalpan"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.pan_vertical_setting = setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Vertical pan")), SETTING_UNIT_CSTR("%"), SETTING_RANGE(-100, 100), SETTING_VALUE(0), SETTING_STORE("videoplayback", "verticalpan"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.scale_horizontal_setting = setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Horizontal scale")), SETTING_UNIT_CSTR("%"), SETTING_RANGE(10, 300), SETTING_VALUE(100), SETTING_STORE("videoplayback", "horizontalscale"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.scale_vertical_setting = setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Vertical scale")), SETTING_UNIT_CSTR("%"), SETTING_RANGE(10, 300), SETTING_VALUE(100), SETTING_STORE("videoplayback", "verticalscale"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.stretch_horizontal_setting = setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Stretch video to widescreen")), SETTING_STORE("videoplayback", "stretch_horizontal"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.stretch_fullscreen_setting = setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Stretch video to fullscreen")), SETTING_STORE("videoplayback", "stretch_fullscreen"), SETTING_VALUE_ORIGIN("global"), NULL); video_settings.vinterpolate_setting = setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Video frame interpolation")), SETTING_STORE("videoplayback", "vinterpolate"), SETTING_VALUE_ORIGIN("global"), SETTING_VALUE(1), NULL); setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Resume video playback")), SETTING_WRITE_INT(&video_settings.resume_mode), SETTING_STORE("videoplayback", "resumemode"), SETTING_OPTION("2", _p("Ask")), SETTING_OPTION("1", _p("Always")), SETTING_OPTION("0", _p("Never")), NULL); setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Count video as played when reaching")), SETTING_VALUE(90), SETTING_RANGE(1, 100), SETTING_UNIT_CSTR("%"), SETTING_WRITE_INT(&video_settings.played_threshold), SETTING_STORE("videoplayback", "played_threshold"), NULL); setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Automatically play next video in list")), SETTING_STORE("videoplayback", "continuous_playback"), SETTING_WRITE_BOOL(&video_settings.continuous_playback), NULL); setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Up / Down during video playback controls")), SETTING_WRITE_INT(&video_settings.dpad_up_down_mode), SETTING_STORE("videoplayback", "dpad_up_down_mode"), SETTING_OPTION("0", _p("Master volume")), SETTING_OPTION("1", _p("Per-file volume")), NULL); setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Show clock during playback")), SETTING_STORE("videoplayback", "show_clock"), SETTING_WRITE_PROP(prop_create(prop_create(prop_get_global(), "clock"), "showDuringVideo")), NULL); setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Step when seeking backward")), SETTING_VALUE(15), SETTING_RANGE(3, 60), SETTING_UNIT_CSTR("s"), SETTING_WRITE_INT(&video_settings.seek_back_step), SETTING_STORE("videoplayback", "seekbackstep"), NULL); setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Step when seeking forward")), SETTING_VALUE(30), SETTING_RANGE(3, 60), SETTING_UNIT_CSTR("s"), SETTING_WRITE_INT(&video_settings.seek_fwd_step), SETTING_STORE("videoplayback", "seekfwdstep"), NULL); setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Video buffer size")), SETTING_VALUE(48), SETTING_RANGE(16, gconf.max_video_buffer_size ?: 128), SETTING_UNIT_CSTR("MB"), SETTING_STORE("videoplayback", "videobuffersize"), SETTING_WRITE_INT(&video_settings.video_buffer_size), NULL); }
void torrent_settings_init(void) { prop_t *dir = setting_get_dir("general:filebrowse"); prop_t *s = settings_add_dir(dir, _p("BitTorrent"), NULL, NULL, NULL, "settings:bittorrent"); char defpath[1024]; int freespace = 10; #ifdef STOS freespace = 75; #endif snprintf(defpath, sizeof(defpath), "%s/bittorrentcache", gconf.cache_path); setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Enable bittorrent")), SETTING_MUTEX(&bittorrent_mutex), SETTING_WRITE_BOOL(&btg.btg_enabled), SETTING_VALUE(1), SETTING_STORE("bittorrent", "enable"), NULL); setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Max upload speed")), SETTING_MUTEX(&bittorrent_mutex), SETTING_CALLBACK(set_torrent_upload_speed, NULL), SETTING_VALUE(5), SETTING_RANGE(0, 100), SETTING_UNIT_CSTR("Mbit/s"), SETTING_STORE("bittorrent", "uploadspeed"), NULL); setting_create(SETTING_INT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Max usage of free space for caching torrents")), SETTING_MUTEX(&bittorrent_mutex), SETTING_CALLBACK(set_torrent_free_percentage, NULL), SETTING_VALUE(freespace), SETTING_RANGE(1, 90), SETTING_UNIT_CSTR("%"), SETTING_STORE("bittorrent", "freepercentage"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE | SETTINGS_DIR, SETTING_TITLE(_p("Torrent cache path")), SETTING_MUTEX(&bittorrent_mutex), SETTING_CALLBACK(set_torrent_cache_path, NULL), SETTING_VALUE(defpath), SETTING_STORE("bittorrent", "path"), NULL); setting_create(SETTING_ACTION, s, 0, SETTING_TITLE(_p("Clear cache")), SETTING_MUTEX(&bittorrent_mutex), SETTING_CALLBACK(torrent_diskio_cache_clear, NULL), NULL); settings_create_separator(s, _p("Status")); btg.btg_torrent_status = prop_create_root(NULL); settings_create_info(s, NULL, btg.btg_torrent_status); btg.btg_disk_status = prop_create_root(NULL); settings_create_info(s, NULL, btg.btg_disk_status); allow_update = 1; torrent_diskio_scan(0); }