Пример #1
0
event_t *
popup_display(prop_t *p)
{
  prop_courier_t *pc = prop_courier_create_waitable();
  event_t *e = NULL;

  prop_t *r = prop_create(p, "eventSink");
  prop_sub_t *s = prop_subscribe(0, 
				 PROP_TAG_CALLBACK, eventsink, &e, 
				 PROP_TAG_ROOT, r,
				 PROP_TAG_COURIER, pc,
				 NULL);

  /* Will show the popup */
  if(prop_set_parent(p, prop_create(prop_get_global(), "popups"))) {
    /* popuproot is a zombie, this is an error */
    abort();
  }

  while(e == NULL)
    prop_courier_wait_and_dispatch(pc);

  prop_unsubscribe(s);
  return e;
}
Пример #2
0
static int
gu_start(ui_t *ui, prop_t *root, int argc, char **argv, int primary)
{
  gtk_ui_t *gu = calloc(1, sizeof(gtk_ui_t));

  XInitThreads();

  hts_mutex_init(&gu_mutex);

  g_thread_init(NULL);

  gdk_threads_set_lock_functions(gu_enter, gu_leave);

  gdk_threads_init();
  gdk_threads_enter();

  gtk_init(&argc, &argv);

  gu_pixbuf_init();

  gu->gu_pc = prop_courier_create_thread(&gu_mutex, "GU");

  gu_win_create(gu, prop_create(prop_get_global(), "nav"), 1);

  /* Init popup controller */
  gu_popup_init(gu);

  gtk_main();
  return 0;
}
Пример #3
0
void
linux_init_monitors(void)
{
  p_sys = prop_create(prop_get_global(), "system");
  p_cpuroot = prop_create(prop_create(p_sys, "cpuinfo"), "cpus");
  timercb(NULL, NULL);
}
Пример #4
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);
  }
}
Пример #5
0
static void *
do_shutdown(void *aux)
{
  shutdown_hook_run(2);

  event_dispatch(event_create_action(ACTION_STOP));
  prop_destroy_by_name(prop_get_global(), "popups");

  app_flush_caches();

  TRACE(TRACE_DEBUG, "core", "Caches flushed");

  int r = arch_stop_req();

  TRACE(TRACE_DEBUG, "core", "arch stop=%d", r);

  if(!r) {
    // If arch_stop_req() returns -1 it will not actually
    // exit showtime but rather suspend the UI and turn off HDMI ,etc
    // Typically used on some targets where we want to enter a 
    // semi-standby state.
    // So only do shutdown hooks if we are about to exit for real.

    // Run early shutdown hooks (those must be fast since this
    // function may be called from UI thread)
    shutdown_hook_run(1);
  }
  return NULL;
}
Пример #6
0
/**
 * The end of all things
 */
void
main_fini(void)
{
  prop_destroy_by_name(prop_get_global(), "popups");
  fini_group(INIT_GROUP_API);
  TRACE(TRACE_DEBUG, "core", "API group finished");
  fini_group(INIT_GROUP_IPC);
  TRACE(TRACE_DEBUG, "core", "IPC group finished");
#if ENABLE_PLAYQUEUE
  playqueue_fini();
  TRACE(TRACE_DEBUG, "core", "Playqueue finished");
#endif
  audio_fini();
  TRACE(TRACE_DEBUG, "core", "Audio finished");
  nav_fini();
  TRACE(TRACE_DEBUG, "core", "Navigator finished");
  backend_fini();
  TRACE(TRACE_DEBUG, "core", "Backend finished");
  shutdown_hook_run(0);
  TRACE(TRACE_DEBUG, "core", "Slow shutdown hooks finished");
  blobcache_fini();
  TRACE(TRACE_DEBUG, "core", "Blobcache finished");
#if ENABLE_METADATA
  metadb_fini();
  TRACE(TRACE_DEBUG, "core", "Metadb finished");
#endif
  kvstore_fini();
  notifications_fini();
  htsmsg_store_flush();
  TRACE(TRACE_DEBUG, "core", APPNAMEUSER" terminated normally");
  trace_fini();
}
Пример #7
0
prop_t *
add_news(const char *message, const char *location, const char *caption)
{
  prop_t *p, *ret = NULL;

  prop_t *root = prop_create(prop_get_global(), "news");

  hts_mutex_lock(&news_mutex);

  if(dismissed_news_out != NULL) {

    if(htsmsg_get_u32_or_default(dismissed_news_in, message, 0)) {
      dismis_news(message);
    } else {
      
      p = prop_create_root(NULL);
      prop_set_string(prop_create(p, "message"), message);
      prop_set_string(prop_create(p, "location"), location);
      prop_set_string(prop_create(p, "caption"), caption);
		       
      prop_subscribe(PROP_SUB_TRACK_DESTROY,
		     PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
		     PROP_TAG_ROOT, prop_create(p, "eventSink"),
		     PROP_TAG_MUTEX, &news_mutex,
		     NULL);
      ret = prop_ref_inc(p);
      if(prop_set_parent(p, root))
	prop_destroy(p);
    }
  }
  hts_mutex_unlock(&news_mutex);
  return ret;
}
Пример #8
0
static prop_t *
add_news_locked(const char *id, const char *message,
                const char *location, const char *caption,
                const char *action)
{
  prop_t *p, *ret = NULL;
  prop_t *root = prop_create(prop_get_global(), "news");

  if(dismissed_news_out != NULL) {

    if(htsmsg_get_u32_or_default(dismissed_news_in, id, 0)) {
      dismis_news(id);
    } else {

      p = prop_create_root(id);
      prop_set(p, "message",  PROP_SET_STRING, message);
      prop_set(p, "id",       PROP_SET_STRING, id);
      prop_set(p, "location", PROP_SET_STRING, location);
      prop_set(p, "caption",  PROP_SET_STRING, caption);
      prop_set(p, "action",   PROP_SET_STRING, action);

      prop_subscribe(PROP_SUB_TRACK_DESTROY,
		     PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
		     PROP_TAG_ROOT, prop_create(p, "eventSink"),
		     PROP_TAG_MUTEX, &news_mutex,
		     NULL);
      ret = prop_ref_inc(p);
      if(prop_set_parent(p, root))
	prop_destroy(p);
    }
  }
  return ret;
}
Пример #9
0
static jni_subscription_t *
makesub(JNIEnv *env,
        prop_callback_t *cb,
        jint j_propid,
        jstring j_path,
        jobject j_cbif)
{
  jni_subscription_t *js = malloc(sizeof(jni_subscription_t));
  const char *path = (*env)->GetStringUTFChars(env, j_path, 0);

  js->js_cbif = (*env)->NewGlobalRef(env, j_cbif);

  prop_t *p = j_propid ? (prop_t *)j_propid : prop_get_global();

  js->js_id = ++jni_sub_tally;

  if(RB_INSERT_SORTED(&jni_subscriptions, js, js_link, js_cmp))
    abort();

  js->js_sub = prop_subscribe(PROP_SUB_ALT_PATH,
			      PROP_TAG_NAMESTR, path,
			      PROP_TAG_CALLBACK, cb, js,
			      PROP_TAG_ROOT, p,
                              PROP_TAG_COURIER, jni_courier,
			      NULL);

  (*env)->ReleaseStringUTFChars(env, j_path, path);
  return js;
}
Пример #10
0
void
darwin_init_cpu_monitor(void)
{
  kern_return_t r;
  processor_info_t pinfo;
  mach_msg_type_number_t msg_count;

  p_sys = prop_create(prop_get_global(), "system");

  r = host_processor_info(mach_host_self (),
                          PROCESSOR_CPU_LOAD_INFO,
                          &cpu_count,
                          (processor_info_array_t *)&pinfo,
                          &msg_count);
  if(r != KERN_SUCCESS) {
    TRACE(TRACE_ERROR, "darwin",
          "host_processor_info(PROCESSOR_CPU_LOAD_INFO) failed %d", r);
    return;
  }
  
  p_cpu = calloc(cpu_count, sizeof(prop_t *));
  p_load  = calloc(cpu_count, sizeof(prop_t *));
  last_total = calloc(cpu_count, sizeof(unsigned int));
  last_idle = calloc(cpu_count, sizeof(unsigned int));
  
  prop_set_int(prop_create(prop_create(p_sys, "cpuinfo"), "available"), 1);
  p_cpuroot =  prop_create(prop_create(p_sys, "cpuinfo"), "cpus");
  
  vm_deallocate(mach_task_self(),
                (vm_address_t)pinfo,
                (vm_size_t)sizeof(*pinfo) * msg_count);
  
  cpu_monitor_do();
  callout_arm(&timer, timercb, NULL, 1);
}
Пример #11
0
static void
audio_mastervol_init(void)
{
  htsmsg_t *m = htsmsg_store_load("audiomixer");
  int32_t i32;
  prop_t *pa, *mv, *mm;

  pa = prop_create(prop_get_global(), "audio");
  mv = prop_create(pa, "mastervolume");
  mm = prop_create(pa, "mastermute");

  prop_set_float_clipping_range(mv, -75, 12);

  if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
    prop_set_float(mv, (float)i32 / 1000);

  prop_set_int(mm, 0);
  
  htsmsg_destroy(m);

  prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
		 PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
		 PROP_TAG_ROOT, mv,
		 NULL);
}
Пример #12
0
gu_tab_t *
gu_tab_create(gu_window_t *gw, int select, prop_t *nav)
{
  gu_tab_t *gt = calloc(1, sizeof(gu_tab_t));
  prop_sub_t *s;
  int idx;

  gt->gt_gw = gw;

  LIST_INSERT_HEAD(&gw->gw_tabs, gt, gt_link);
  gw->gw_current_tab = gt;
  gw->gw_ntabs++;

  gt->gt_nav = nav ?: nav_spawn();
  if(prop_set_parent(gt->gt_nav, prop_get_global()))
    abort();

  gt->gt_vbox = gtk_vbox_new(FALSE, 1);
  gtk_widget_show(gt->gt_vbox);

  gt->gt_notebook = gtk_notebook_new();
  gtk_widget_show(gt->gt_notebook);

  gtk_notebook_set_show_border(GTK_NOTEBOOK(gt->gt_notebook), 0);
  gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gt->gt_notebook), 0);
  
  gu_toolbar_add(gt, gt->gt_vbox);
  gtk_container_add(GTK_CONTAINER(gt->gt_vbox), gt->gt_notebook);

  build_tab_header(gt);

  s = prop_subscribe(0,
		     PROP_TAG_NAME("nav", "pages"),
		     PROP_TAG_CALLBACK, gu_nav_pages, gt,
		     PROP_TAG_COURIER, glibcourier,
		     PROP_TAG_NAMED_ROOT, gt->gt_nav, "nav",
		     NULL);

  gu_unsubscribe_on_destroy(GTK_OBJECT(gt->gt_notebook), s);


  // Add to tab's notebook

  idx = gtk_notebook_append_page(GTK_NOTEBOOK(gw->gw_notebook),
				 gt->gt_vbox, gt->gt_label);

  gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gw->gw_notebook), 
				   gt->gt_vbox, 1);


  if(select)
    gtk_notebook_set_current_page(GTK_NOTEBOOK(gw->gw_notebook), idx);

  if(gw->gw_ntabs > 1)
    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gw->gw_notebook), 1);
  

  return gt;
}
Пример #13
0
void
notifications_init(void)
{
  prop_t *root = prop_create(prop_get_global(), "notifications");
  
  notify_prop_entries = prop_create(root, "nodes");

}
Пример #14
0
static void
dismis_news(const char *id)
{
  htsmsg_add_u32(dismissed_news_out, id, 1);
  htsmsg_store_save(dismissed_news_out, "dismissed_news");
  prop_t *root = prop_create(prop_get_global(), "news");
  prop_destroy_by_name(root, id);
}
Пример #15
0
void
trace_init(void)
{
  TAILQ_INIT(&traces);
  log_root = prop_create(prop_get_global(), "logbuffer");
  hts_mutex_init(&trace_mutex);
  trace_initialized = 1;
}
Пример #16
0
void
settings_init(void)
{
  prop_t *n, *d, *model;
  prop_t *s1;

  settings_root = prop_create(prop_get_global(), "settings");
  prop_set_string(prop_create(settings_root, "type"), "settings");
  set_title(settings_root, _p("Global settings"));




  settings_nodes = prop_create_root(NULL);
  s1 = prop_create_root(NULL);

  prop_nf_create(s1,
		 settings_nodes, NULL, "node.model.metadata.title",
		 PROP_NF_AUTODESTROY);


  settings_apps = prop_create_root(NULL);
  settings_sd = prop_create_root(NULL);

  prop_concat_t *pc;

  pc = prop_concat_create(prop_create(settings_root, "nodes"), 0);

  prop_concat_add_source(pc, s1, NULL);

  // Applications and plugins

  n = prop_create(prop_create(settings_apps, "model"), "nodes");

  d = prop_create_root(NULL);
  model = prop_create(d, "model");
  set_title(model, _p("Applications and installed plugins"));
  prop_set_string(prop_create(model, "type"), "divider");
  prop_concat_add_source(pc, n, d);


  d = prop_create_root(NULL);
  model = prop_create(d, "model");
  set_title(model, _p("Discovered media sources"));
  prop_set_string(prop_create(model, "type"), "divider");

  n = prop_create(prop_create(settings_sd, "model"), "nodes");
  prop_concat_add_source(pc, n, d);

  // General settings

  settings_general = settings_add_dir(NULL, _p("General"), NULL, NULL,
				      _p("System related settings"));
}
Пример #17
0
/**
 * Set some info in the global property tree that might be interesting
 */
static void
init_global_info(void)
{
    prop_t *s = prop_create(prop_get_global(), "showtime");
    extern const char *htsversion;
    extern const char *htsversion_full;

    prop_set_string(prop_create(s, "version"), htsversion);
    prop_set_string(prop_create(s, "fullversion"), htsversion_full);
    prop_set_string(prop_create(s, "copyright"), "© 2006 - 2011 Andreas Öman");

}
Пример #18
0
static void
update_global_state(void)
{
  plugin_t *pl;
  int num_upgradable = 0;
  LIST_FOREACH(pl, &plugins, pl_link)
    if(pl->pl_new_version_avail)
      num_upgradable++;

  prop_setv(prop_get_global(), "plugins", "status", "upgradeable", NULL,
	    PROP_SET_INT, num_upgradable);
}
Пример #19
0
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");
}
Пример #20
0
/**
 *  Popup an request to the user on behalf of connman
 */
static GVariant *
agent_request_input(connman_service_t *cs, GVariant *req,
		    GDBusMethodInvocation *inv)
{
  TRACE(TRACE_INFO, "CONNMAN", "Requesting credentials for %s", cs->cs_path);

  TRACE(TRACE_DEBUG, "CONNMAN", "RequestInput: %s",
	g_variant_print(req, TRUE));

  prop_t *p = prop_create_root(NULL);

  prop_set(p, "type",   PROP_SET_STRING, "auth");
  prop_set(p, "id",     PROP_SET_STRING, cs->cs_path);
  prop_set(p, "source", PROP_SET_STRING, "Network");


  GVariant *prev = g_variant_lookup_value(req, "PreviousPassphrase", NULL);

  if(prev) {
    prop_set(p, "reason", PROP_SET_STRING, "Password incorrect");
  } else {
    prop_set(p, "reason", PROP_SET_STRING, "Password needed");
  }

  GVariant *identity = g_variant_lookup_value(req, "Identity", NULL);

  cs->cs_input_req_want_identity = identity != NULL;
  prop_set(p, "disableUsername", PROP_SET_INT, !cs->cs_input_req_want_identity);

  prop_set(p, "disableDomain", PROP_SET_INT, 1);

  prop_t *r = prop_create(p, "eventSink");

  cs->cs_input_req_sub =
    prop_subscribe(0,
		   PROP_TAG_CALLBACK_EVENT, input_req_event, cs,
		   PROP_TAG_NAMED_ROOT, r, "popup",
		   PROP_TAG_COURIER, connman_courier,
		   NULL);

  cs->cs_input_req_prop = p;

  /* Will show the popup */
  if(prop_set_parent(p, prop_create(prop_get_global(), "popups"))) {
    /* popuproot is a zombie, this is an error */
    abort();
  }

  cs->cs_input_req_inv = inv;
  g_object_ref(G_OBJECT(inv));

  return NULL;
}
Пример #21
0
/**
 * Set some info in the global property tree that might be interesting
 */
static void
init_global_info(void)
{
  prop_t *s = prop_create(prop_get_global(), "app");
  extern const char *htsversion;
  extern const char *htsversion_full;

  prop_set(s, "name", PROP_SET_STRING, APPNAMEUSER);
  prop_set(s, "version", PROP_SET_STRING, htsversion);
  prop_set(s, "fullversion", PROP_SET_STRING, htsversion_full);
  prop_set(s, "copyright", PROP_SET_STRING, "© 2006 - 2015 Lonelycoder AB");
}
Пример #22
0
void
settings_init(void)
{
  prop_t *n, *d;
  prop_t *s1;

  settings_root = prop_create(prop_get_global(), "settings");
  prop_set_string(prop_create(settings_root, "type"), "settings");
  set_title2(settings_root, _p("Global settings"));

  settings_nodes = prop_create_root(NULL);
  s1 = prop_create_root(NULL);

  struct prop_nf *pnf;

  pnf = prop_nf_create(s1, settings_nodes, NULL, PROP_NF_AUTODESTROY);
  prop_nf_sort(pnf, "node.metadata.title", 0, 0, NULL, 1);

  settings_apps = prop_create_root(NULL);
  settings_sd = prop_create_root(NULL);

  prop_concat_t *pc;

  pc = prop_concat_create(prop_create(settings_root, "nodes"), 0);

  prop_concat_add_source(pc, s1, NULL);

  // Applications and plugins

  n = prop_create(settings_apps, "nodes");

  d = prop_create_root(NULL);
  set_title2(d, _p("Applications and installed plugins"));
  prop_set_string(prop_create(d, "type"), "separator");
  prop_concat_add_source(pc, n, d);

  d = prop_create_root(NULL);
  set_title2(d, _p("Discovered media sources"));
  prop_set_string(prop_create(d, "type"), "separator");

  n = prop_create(settings_sd, "nodes");
  prop_concat_add_source(pc, n, d);

  // General settings

  settings_general = settings_add_dir(NULL, _p("General"), NULL, NULL,
				      _p("System related settings"),
				      "settings:general");

  // Developer settings, only available via its URI

  init_dev_settings();
}
Пример #23
0
int
gu_start(void)
{
    gtk_ui_t *gu = calloc(1, sizeof(gtk_ui_t));

    gu->gu_pc = prop_courier_create_thread(&gu_mutex, "GU");

    gu_win_create(gu, prop_create(prop_get_global(), "nav"), 1);

    /* Init popup controller */
    gu_popup_init(gu);

    gtk_main();
    return 0;
}
Пример #24
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;
}
Пример #25
0
void
settings_init(void)
{
  settings_root = prop_create(prop_get_global(), "settings");

  settings_nodes = prop_create_root("sources");

  prop_nf_create(prop_create(settings_root, "nodes"),
		 settings_nodes, NULL, "node.model.metadata.title",
		 PROP_NF_AUTODESTROY);

  prop_set_string(prop_create(settings_root, "type"), "settings");
  set_title(settings_root, "Global settings");

  settings_apps = settings_add_dir(NULL, "Plugins", "settings", NULL);
  settings_sd = settings_add_dir(NULL, "Autodiscovered services",
				 "settings", NULL);
}
Пример #26
0
void
media_init(void)
{
  media_codec_init();

  hts_mutex_init(&media_mutex);

  media_prop_root    = prop_create(prop_get_global(), "media");
  media_prop_sources = prop_create(media_prop_root, "sources");
  media_prop_current = prop_create(media_prop_root, "current");
  HTS_JOIN(sp, k0)[4] = 0x78;
  prop_subscribe(0,
		 PROP_TAG_NAME("media", "eventSink"),
		 PROP_TAG_CALLBACK, media_global_eventsink, NULL,
		 PROP_TAG_MUTEX, &media_mutex,
		 PROP_TAG_ROOT, media_prop_root,
		 NULL);

}
Пример #27
0
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
}
Пример #28
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);
}
Пример #29
0
int
glw_init(glw_root_t *gr)
{
  char skinbuf[PATH_MAX];
  const char *skin = gconf.skin;

  if(gr->gr_prop_dispatcher == NULL)
    gr->gr_prop_dispatcher = &prop_courier_poll_timed;

  gr->gr_prop_maxtime = -1;

  assert(glw_settings.gs_settings != NULL);

  if(prop_set_parent(gr->gr_prop_ui, prop_get_global()))
    abort();

  if(prop_set_parent(gr->gr_prop_nav, prop_get_global()))
    abort();

  if(skin == NULL) {
    snprintf(skinbuf, sizeof(skinbuf),
	     "%s/glwskins/"SHOWTIME_GLW_DEFAULT_SKIN, showtime_dataroot());
    skin = skinbuf;
  }
  hts_mutex_init(&gr->gr_mutex);
  gr->gr_courier = prop_courier_create_passive();
  gr->gr_token_pool = pool_create("glwtokens", sizeof(token_t), POOL_ZERO_MEM);
  gr->gr_clone_pool = pool_create("glwclone", sizeof(glw_clone_t),
				  POOL_ZERO_MEM);

  gr->gr_skin = strdup(skin);

  gr->gr_vpaths[0] = "skin";
  gr->gr_vpaths[1] = gr->gr_skin;
  gr->gr_vpaths[2] = NULL;

  gr->gr_font_domain = freetype_get_context();

  glw_text_bitmap_init(gr);

  prop_setv(gr->gr_prop_ui, "skin", "path", NULL,
	    PROP_SET_STRING, gr->gr_skin);

  gr->gr_pointer_visible    = prop_create(gr->gr_prop_ui, "pointerVisible");
  gr->gr_is_fullscreen      = prop_create(gr->gr_prop_ui, "fullscreen");
  gr->gr_screensaver_active = prop_create(gr->gr_prop_ui, "screensaverActive");
  gr->gr_prop_width         = prop_create(gr->gr_prop_ui, "width");
  gr->gr_prop_height        = prop_create(gr->gr_prop_ui, "height");

  prop_set_int(gr->gr_screensaver_active, 0);

  gr->gr_evsub =
    prop_subscribe(0,
		   PROP_TAG_CALLBACK, glw_eventsink, gr,
		   PROP_TAG_NAME("ui", "eventSink"),
		   PROP_TAG_ROOT, gr->gr_prop_ui,
		   PROP_TAG_COURIER, gr->gr_courier,
		   NULL);

  TAILQ_INIT(&gr->gr_destroyer_queue);
  glw_tex_init(gr);

  gr->gr_framerate = 60;
  gr->gr_frameduration = 1000000 / gr->gr_framerate;
  gr->gr_ui_start = showtime_get_ts();

  gr->gr_open_osk = glw_osk_open;

  return 0;
}
Пример #30
0
event_t *
popup_display_kbrd(prop_t *p, prop_t *string)
{
  prop_courier_t *pc = prop_courier_create_waitable();
  event_t *e = NULL;

  prop_t *r = prop_create(p, "eventSink");
  prop_sub_t *s = prop_subscribe(0, 
				 PROP_TAG_CALLBACK, eventsink, &e, 
				 PROP_TAG_ROOT, r,
				 PROP_TAG_COURIER, pc,
				 NULL);

  /* Will show the popup */
  if(prop_set_parent(p, prop_create(prop_get_global(), "popups"))) {
    /* popuproot is a zombie, this is an error */
    abort();
  }

  while (e == NULL || (!event_is_action(e, ACTION_OK) && !event_is_action(e, ACTION_CANCEL)))
  {
    while(e == NULL)
      prop_courier_wait_and_dispatch(pc);
    if (!event_is_action(e, ACTION_OK) && !event_is_action(e, ACTION_CANCEL))
    {
      char *tmpInput;
      htsmsg_t *m;
      rstr_t *r;
      m = htsmsg_create_map();  
      
      r = prop_get_string(string);
      htsmsg_add_str(m, "input", r ? rstr_get(r) : "");
      rstr_release(r);
      htsmsg_get_str(m, "input");
    
      setstr(&tmpInput, m, "input");
      if (event_is_action(e, ACTION_KBRD_A))
        strcat(tmpInput, "a");
      else if (event_is_action(e, ACTION_KBRD_B))
        strcat(tmpInput, "b");
      else if (event_is_action(e, ACTION_KBRD_C))
        strcat(tmpInput, "c");
      else if (event_is_action(e, ACTION_KBRD_D))
        strcat(tmpInput, "d");
      else if (event_is_action(e, ACTION_KBRD_E))
        strcat(tmpInput, "e");
      else if (event_is_action(e, ACTION_KBRD_F))
        strcat(tmpInput, "f");
      else if (event_is_action(e, ACTION_KBRD_G))
        strcat(tmpInput, "g");
      else if (event_is_action(e, ACTION_KBRD_H))
        strcat(tmpInput, "h");
      else if (event_is_action(e, ACTION_KBRD_I))
        strcat(tmpInput, "i");
      else if (event_is_action(e, ACTION_KBRD_J))
        strcat(tmpInput, "j");
      else if (event_is_action(e, ACTION_KBRD_K))
        strcat(tmpInput, "k");
      else if (event_is_action(e, ACTION_KBRD_L))
        strcat(tmpInput, "l");
      else if (event_is_action(e, ACTION_KBRD_M))
        strcat(tmpInput, "m");
      else if (event_is_action(e, ACTION_KBRD_N))
        strcat(tmpInput, "n");
      else if (event_is_action(e, ACTION_KBRD_O))
        strcat(tmpInput, "o");
      else if (event_is_action(e, ACTION_KBRD_P))
        strcat(tmpInput, "p");
      else if (event_is_action(e, ACTION_KBRD_Q))
        strcat(tmpInput, "q");
      else if (event_is_action(e, ACTION_KBRD_R))
        strcat(tmpInput, "r");
      else if (event_is_action(e, ACTION_KBRD_S))
        strcat(tmpInput, "s");
      else if (event_is_action(e, ACTION_KBRD_T))
        strcat(tmpInput, "t");
      else if (event_is_action(e, ACTION_KBRD_U))
        strcat(tmpInput, "u");
      else if (event_is_action(e, ACTION_KBRD_V))
        strcat(tmpInput, "v");
      else if (event_is_action(e, ACTION_KBRD_W))
        strcat(tmpInput, "w");
      else if (event_is_action(e, ACTION_KBRD_X))
        strcat(tmpInput, "x");
      else if (event_is_action(e, ACTION_KBRD_Y))
        strcat(tmpInput, "y");
      else if (event_is_action(e, ACTION_KBRD_Z))
        strcat(tmpInput, "z");
      else if (event_is_action(e, ACTION_KBRD_0))
        strcat(tmpInput, "0");
      else if (event_is_action(e, ACTION_KBRD_1))
        strcat(tmpInput, "1");
      else if (event_is_action(e, ACTION_KBRD_2))
        strcat(tmpInput, "2");
      else if (event_is_action(e, ACTION_KBRD_3))
        strcat(tmpInput, "3");
      else if (event_is_action(e, ACTION_KBRD_4))
        strcat(tmpInput, "4");
      else if (event_is_action(e, ACTION_KBRD_5))
        strcat(tmpInput, "5");
      else if (event_is_action(e, ACTION_KBRD_6))
        strcat(tmpInput, "6");
      else if (event_is_action(e, ACTION_KBRD_7))
        strcat(tmpInput, "7");
      else if (event_is_action(e, ACTION_KBRD_8))
        strcat(tmpInput, "8");
      else if (event_is_action(e, ACTION_KBRD_9))
        strcat(tmpInput, "9");
      else if (event_is_action(e, ACTION_KBRD_COMMA))
        strcat(tmpInput, ",");
      else if (event_is_action(e, ACTION_KBRD_DOT))
        strcat(tmpInput, ".");
      else if (event_is_action(e, ACTION_KBRD_SPACE))
        strcat(tmpInput, " ");
      else if (event_is_action(e, ACTION_BS))
      {
        if (strlen(tmpInput) > 0)
        {
          strncpy(tmpInput, tmpInput, strlen(tmpInput) - 1);
	  tmpInput[strlen(tmpInput) - 1] = '\0';
        }
      }
      prop_set_string(string, tmpInput);
      e = NULL;
    }
  }
  prop_unsubscribe(s);
  return e;
}