Ejemplo n.º 1
0
event_t *
event_create_playtrack(struct prop *track, struct prop *psource, int mode)
{
  event_playtrack_t *ep = event_create(EVENT_PLAYTRACK, 
				       sizeof(event_playtrack_t));

  ep->track    = prop_xref_addref(track);
  ep->source   = psource ? prop_xref_addref(psource) : NULL;
  ep->mode     = mode;
  ep->h.e_dtor = playtrack_dtor;
  return &ep->h;
}
Ejemplo n.º 2
0
void
prop_reorder_create(prop_t *dst, prop_t *src, int flags, const char *id)
{
  prop_reorder_t *pr = calloc(1, sizeof(prop_reorder_t));

  pr->pr_order = htsmsg_store_load(id);
  if(pr->pr_order == NULL)
    pr->pr_order = htsmsg_create_list();

  pr->pr_store = strdup(id);
  pr->pr_dst = flags & PROP_REORDER_TAKE_DST_OWNERSHIP ?
    dst : prop_xref_addref(dst);

  hts_mutex_lock(&prop_mutex);

  pr->pr_srcsub = prop_subscribe(PROP_SUB_INTERNAL | PROP_SUB_DONTLOCK | 
				 PROP_SUB_TRACK_DESTROY,
				 PROP_TAG_CALLBACK, src_cb, pr,
				 PROP_TAG_ROOT, src,
				 NULL);

  pr->pr_dstsub = prop_subscribe(PROP_SUB_INTERNAL | PROP_SUB_DONTLOCK | 
				 PROP_SUB_TRACK_DESTROY,
				 PROP_TAG_CALLBACK, dst_cb, pr,
				 PROP_TAG_ROOT, dst,
				 NULL);

  hts_mutex_unlock(&prop_mutex);
}
Ejemplo n.º 3
0
prop_concat_t *
prop_concat_create(prop_t *dst, int flags)
{
  prop_concat_t *pc = calloc(1, sizeof(prop_concat_t));

  pc->pc_dst = flags & PROP_CONCAT_TAKE_DST_OWNERSHIP
    ? dst : prop_xref_addref(dst);
  TAILQ_INIT(&pc->pc_queue);
  return pc;
}
Ejemplo n.º 4
0
event_t *
event_create_playurl(const char *url, int primary, int priority, int no_audio,
		     prop_t *model)
{
  event_playurl_t *ep = event_create(EVENT_PLAY_URL, sizeof(event_playurl_t));
  ep->url = strdup(url);
  ep->model = prop_xref_addref(model);
  ep->primary = primary;
  ep->priority = priority;
  ep->no_audio = no_audio;
  ep->h.e_dtor = event_playurl_dtor;
  return &ep->h;
}
Ejemplo n.º 5
0
event_t *
event_create_playurl_args(const event_playurl_args_t *args)
{
  event_playurl_t *ep = event_create(EVENT_PLAY_URL, sizeof(event_playurl_t));
  ep->h.e_dtor = event_playurl_dtor;

  ep->url          = strdup(args->url);
  ep->how          = args->how ? strdup(args->how) : NULL;
  ep->item_model   = prop_xref_addref(args->item_model);
  ep->parent_model = prop_ref_inc(args->parent_model);
  ep->primary      = args->primary;
  ep->priority     = args->priority;
  ep->no_audio     = args->no_audio;
  ep->parent_url   = args->parent_url ? strdup(args->parent_url) : NULL;
  return &ep->h;
}
Ejemplo n.º 6
0
event_t *
event_create_playurl(const char *url, int primary, int priority, int no_audio,
		     prop_t *model, const char *how, prop_t *origin,
                     const char *parent_url)
{
  event_playurl_t *ep = event_create(EVENT_PLAY_URL, sizeof(event_playurl_t));
  ep->url = strdup(url);
  ep->how = how ? strdup(how) : NULL;
  ep->model = prop_xref_addref(model);
  ep->origin = prop_ref_inc(origin);
  ep->primary = primary;
  ep->priority = priority;
  ep->no_audio = no_audio;
  ep->parent_url = parent_url ? strdup(parent_url) : NULL;
  ep->h.e_dtor = event_playurl_dtor;
  return &ep->h;
}
Ejemplo n.º 7
0
/**
 * Clone a token
 */
token_t *
glw_view_token_copy(glw_root_t *gr, token_t *src)
{
  token_t *dst = pool_get(gr->gr_token_pool);

  dst->file = rstr_dup(src->file);
  dst->line = src->line;

  dst->type = src->type;

  switch(src->type) {
  case TOKEN_FLOAT:
    dst->t_float = src->t_float;
    break;

  case TOKEN_INT:
    dst->t_int = src->t_int;
    break;

  case TOKEN_PROPERTY_REF:
    dst->t_prop = prop_ref_inc(src->t_prop);
    break;

  case TOKEN_PROPERTY_OWNER:
    dst->t_prop = prop_xref_addref(src->t_prop);
    break;

  case TOKEN_PROPERTY_SUBSCRIPTION:
  case TOKEN_DIRECTORY:
    dst->propsubr = src->propsubr;
    break;

  case TOKEN_FUNCTION:
    dst->t_func = src->t_func;
    if(dst->t_func->ctor != NULL)
      dst->t_func->ctor(dst);
  case TOKEN_LEFT_BRACKET:
    dst->t_num_args = src->t_num_args;
    break;

  case TOKEN_OBJECT_ATTRIBUTE:
    dst->t_attrib = src->t_attrib;
    break;

  case TOKEN_CSTRING:
    dst->t_cstring = src->t_cstring;
    break;

  case TOKEN_RSTRING:
    dst->t_rstrtype = src->t_rstrtype;
    // FALLTHRU
  case TOKEN_IDENTIFIER:
  case TOKEN_PROPERTY_VALUE_NAME:
  case TOKEN_PROPERTY_CANONICAL_NAME:
    dst->t_rstring = rstr_dup(src->t_rstring);
    break;

  case TOKEN_START:
  case TOKEN_END:
  case TOKEN_HASH:
  case TOKEN_ASSIGNMENT:
  case TOKEN_COND_ASSIGNMENT:
  case TOKEN_END_OF_EXPR:
  case TOKEN_SEPARATOR:
  case TOKEN_BLOCK_OPEN:
  case TOKEN_BLOCK_CLOSE:
  case TOKEN_LEFT_PARENTHESIS:
  case TOKEN_RIGHT_PARENTHESIS:
  case TOKEN_RIGHT_BRACKET:
  case TOKEN_DOT:
  case TOKEN_ADD:
  case TOKEN_SUB:
  case TOKEN_MULTIPLY:
  case TOKEN_DIVIDE:
  case TOKEN_MODULO:
  case TOKEN_DOLLAR:
  case TOKEN_AMPERSAND:
  case TOKEN_BOOLEAN_AND:
  case TOKEN_BOOLEAN_OR:
  case TOKEN_BOOLEAN_XOR:
  case TOKEN_BOOLEAN_NOT:
  case TOKEN_EQ:
  case TOKEN_NEQ:
  case TOKEN_LT:
  case TOKEN_GT:
  case TOKEN_NULL_COALESCE:
  case TOKEN_EXPR:
  case TOKEN_RPN:
  case TOKEN_BLOCK:
  case TOKEN_NOP:
  case TOKEN_VOID:
  case TOKEN_COLON:
    break;

  case TOKEN_LINK:
    dst->t_link_rtitle = rstr_dup(src->t_link_rtitle);
    dst->t_link_rurl   = rstr_dup(src->t_link_rurl);
    break;

  case TOKEN_VECTOR_FLOAT:
  case TOKEN_EVENT:
  case TOKEN_VECTOR:
  case TOKEN_num:
    abort();
  }
  return dst;
}
Ejemplo n.º 8
0
gu_tab_t *
gu_tab_create(gu_window_t *gw, prop_t *nav, int select)
{
  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++;

  if(nav == NULL) {
    gt->gt_nav = nav_spawn(); // No navigator supplied, spawn one
  } else {
    gt->gt_nav = prop_xref_addref(nav);
  }

  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, gw->gw_gu->gu_pc,
		     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;
}