Esempio n. 1
0
void
event_to_ui(event_t *e)
{
  event_to_prop(prop_get_by_name(PNVEC("global", "userinterfaces", "ui", "eventSink"),
				 1, NULL), e);
  event_release(e);
}
Esempio n. 2
0
static int
top_event_handler(glw_t *w, void *opaque, glw_signal_t sig, void *extra)
{
  event_t *e = extra;
  glw_root_t *gr = opaque;

  if(sig != GLW_SIGNAL_EVENT_BUBBLE)
    return 0;

  if(e->e_type_x == EVENT_KEYDESC)
    return 0;

  if(event_is_action(e, ACTION_ENABLE_SCREENSAVER)) {
    gr->gr_screensaver_force_enable = 1;

  } else if(event_is_action(e, ACTION_NAV_BACK) ||
	    event_is_action(e, ACTION_NAV_FWD) ||
	    event_is_action(e, ACTION_HOME) ||
	    event_is_action(e, ACTION_PLAYQUEUE) ||
	    event_is_action(e, ACTION_RELOAD_DATA) ||
	    event_is_type(e, EVENT_OPENURL)) {

    prop_t *p = prop_get_by_name(PNVEC("nav", "eventsink"), 0,
                                 PROP_TAG_ROOT, gr->gr_prop_nav,
                                 NULL);
    prop_send_ext_event(p, e);
    prop_ref_dec(p);
  } else {
    event_addref(e);
    event_dispatch(e);
  }

  return 1;
}
Esempio n. 3
0
static void
notifications_update(void *opaque, prop_event_t event, ...)
{
  statusbar_t *sb = opaque;
  prop_t *p, *txt;
  statusbar_entry_t *sbe;
  char *buf;
  rstr_t *msg;
  int i, l;
  va_list ap;
  va_start(ap, event);

  switch(event) {
  case PROP_ADD_CHILD:
    p = va_arg(ap, prop_t *);

    txt = prop_get_by_name(PNVEC("self", "text"), 1,
			   PROP_TAG_NAMED_ROOT, p, "self",
			   NULL);
    if(txt != NULL) {
      msg = prop_get_string(txt);

      if(msg != NULL) {
	buf = mystrdupa(rstr_get(msg));
	l = strlen(buf);
	for(i = 0; i < l; i++)
	  if(buf[i] < ' ')
	    buf[i] = ' ';

	sbe = calloc(1, sizeof(statusbar_entry_t));
	sbe->p = prop_ref_inc(p);
	sbe->id = gtk_statusbar_push(GTK_STATUSBAR(sb->bar), sb->ctxid, buf);
	LIST_INSERT_HEAD(&sb->entries, sbe, link);
	rstr_release(msg);
      }
      prop_ref_dec(txt);
    }
    break;

  case PROP_DEL_CHILD:
    p = va_arg(ap, prop_t *);

    LIST_FOREACH(sbe, &sb->entries, link)
      if(sbe->p == p)
	break;

    if(sbe == NULL)
      break;

    prop_ref_dec(sbe->p);
    gtk_statusbar_remove(GTK_STATUSBAR(sb->bar), sb->ctxid, sbe->id);
    LIST_REMOVE(sbe, link);
    free(sbe);
    break;

  default:
    break;
  }
}
Esempio n. 4
0
static void
gu_playqueue_send_event(gu_tab_t *gt, struct event *e)
{
  prop_t *p = prop_get_by_name(PNVEC("global", "playqueue", "eventsink"), 1,
			       NULL);

  prop_send_ext_event(p, e);
  prop_ref_dec(p);
  event_release(e);
}
Esempio n. 5
0
void
gu_tab_send_event(gu_tab_t *gt, event_t *e)
{
  prop_t *p = prop_get_by_name(PNVEC("nav", "eventsink"), 1,
			       PROP_TAG_NAMED_ROOT, gt->gt_nav, "nav",
			       NULL);

  prop_send_ext_event(p, e);
  prop_ref_dec(p);
  event_release(e);
}
Esempio n. 6
0
static void
auth_ok(GtkButton *unused__, gpointer user_data)
{
  popup_t *pop = user_data;
  prop_t *p;

  p = prop_get_by_name(PNVEC("self", "username"), 1,
		       PROP_TAG_NAMED_ROOT, pop->p, "self",
		       NULL);
  if(p != NULL) {
    prop_set_string(p, gtk_entry_get_text(GTK_ENTRY(pop->username)));
    prop_ref_dec(p);
  }

  p = prop_get_by_name(PNVEC("self", "password"), 1,
		       PROP_TAG_NAMED_ROOT, pop->p, "self",
		       NULL);
  if(p != NULL) {
    prop_set_string(p, gtk_entry_get_text(GTK_ENTRY(pop->password)));
    prop_ref_dec(p);
  }
  popup_send_result(pop, ACTION_OK);
}
Esempio n. 7
0
static void
popup_send_result(popup_t *pop, action_type_t res)
{
  prop_t *p;

  p = prop_get_by_name(PNVEC("self", "eventSink"), 1,
		       PROP_TAG_NAMED_ROOT, pop->p, "self",
		       NULL);
  if(p != NULL) {
    event_t *e = event_create_action(res);
    prop_send_ext_event(p, e);
    event_release(e);
    prop_ref_dec(p);
  }
}
Esempio n. 8
0
static gboolean 
slider_updated(GtkRange *range, GtkScrollType scroll,
	       gdouble value, gpointer user_data)
{
  playdeck_t *pd = user_data;
  prop_t *p;

  pd->pos_grabbed = 0;

  p = prop_get_by_name(PNVEC("global", "media", "current", "currenttime"),
		       1, NULL);
  if(p != NULL) {
    prop_set_float_ex(p, pd->sub_pos, value, 0);
    prop_ref_dec(p);
  }
  return FALSE;
}
Esempio n. 9
0
void
event_dispatch(event_t *e)
{
  prop_t *p;
  event_int_t *eu = (event_int_t *)e;

  if(event_is_type(e, EVENT_UNICODE) && eu->val == 32) {
    // Convert [space] into playpause
    event_release(e);
    e = event_create_action(ACTION_PLAYPAUSE);
  }

  event_to_prop(prop_get_by_name(PNVEC("global", "eventsink"),
				 1, NULL), e);
  
  if(event_is_action(e, ACTION_QUIT)) {
    showtime_shutdown(0);

  } else if(event_is_action(e, ACTION_STANDBY)) {
    showtime_shutdown(10);

  } else if(event_is_action(e, ACTION_POWER_OFF)) {
    showtime_shutdown(11);

  } else if(event_is_action(e, ACTION_NAV_BACK) ||
	    event_is_action(e, ACTION_NAV_FWD) ||
	    event_is_action(e, ACTION_HOME) ||
	    event_is_action(e, ACTION_RELOAD_DATA) ||
	    event_is_type(e, EVENT_OPENURL)) {

    event_to_prop(prop_get_by_name(PNVEC("global", "nav", "eventsink"),
				   1, NULL), e);

  } else if(event_is_action(e, ACTION_VOLUME_UP) ||
	    event_is_action(e, ACTION_VOLUME_DOWN)) {

    p = prop_get_by_name(PNVEC("global", "audio", "mastervolume"), 1, NULL);
    prop_add_float(p, event_is_action(e, ACTION_VOLUME_DOWN) ? -1 : 1);
    prop_ref_dec(p);
    
  } else if(event_is_action(e, ACTION_VOLUME_MUTE_TOGGLE)) {

    p = prop_get_by_name(PNVEC("global", "audio", "mastermute"), 1, NULL);
    prop_toggle_int(p);
    prop_ref_dec(p);

  } else if(event_is_action(e, ACTION_SEEK_FAST_BACKWARD) ||
	    event_is_action(e, ACTION_SEEK_BACKWARD) ||
	    event_is_action(e, ACTION_SEEK_FAST_FORWARD) ||
	    event_is_action(e, ACTION_SEEK_FORWARD) ||
	    event_is_action(e, ACTION_PLAYPAUSE) ||
	    event_is_action(e, ACTION_PLAY) ||
	    event_is_action(e, ACTION_PAUSE) ||
	    event_is_action(e, ACTION_STOP) ||
	    event_is_action(e, ACTION_EJECT) ||
	    event_is_action(e, ACTION_PREV_TRACK) ||
	    event_is_action(e, ACTION_NEXT_TRACK) ||
	    event_is_action(e, ACTION_SHOW_MEDIA_STATS) ||
	    event_is_action(e, ACTION_SHUFFLE) ||
	    event_is_action(e, ACTION_REPEAT) ||
	    event_is_action(e, ACTION_NEXT_CHANNEL) ||
	    event_is_action(e, ACTION_PREV_CHANNEL) ||
	    event_is_action(e, ACTION_CYCLE_AUDIO) ||
	    event_is_action(e, ACTION_CYCLE_SUBTITLE) ||
	    event_is_type(e, EVENT_SELECT_AUDIO_TRACK) || 
	    event_is_type(e, EVENT_SELECT_SUBTITLE_TRACK)
	    ) {

    event_to_prop(prop_get_by_name(PNVEC("global", "media", "eventsink"),
				   1, NULL), e);
  } else if(event_is_type(e, EVENT_PLAYTRACK)) {
    event_to_prop(prop_get_by_name(PNVEC("global", "playqueue", "eventsink"),
				   1, NULL), e);

  }

  event_release(e);
}