static gboolean gw_close(GtkWidget *widget,GdkEvent *event, gpointer data) { gu_window_t *gw = data; gtk_ui_t *gu = gw->gw_gu; gu_win_destroy(gw); if(LIST_FIRST(&gu->gu_windows) == NULL) showtime_shutdown(0); return TRUE; }
void gu_win_destroy(gu_window_t *gw) { gtk_ui_t *gu = gw->gw_gu; gtk_widget_destroy(gw->gw_window); LIST_REMOVE(gw, gw_link); free(gw); if(LIST_FIRST(&gu->gu_windows) == NULL) showtime_shutdown(0); }
/** * Periodically check if we should auto standby */ static void check_autostandby(callout_t *c, void *aux) { int64_t idle = showtime_get_ts() - last_activity; idle /= (1000000 * 60); // Convert to minutes if(standby_delay && idle >= standby_delay && !active_media) { TRACE(TRACE_INFO, "runcontrol", "Automatic standby after %d minutes idle", standby_delay); showtime_shutdown(SHOWTIME_EXIT_STANDBY); return; } callout_arm(&autostandby_timer, check_autostandby, NULL, 1); }
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); }
static void do_open_shell(void *opaque, prop_event_t event, ...) { showtime_shutdown(SHOWTIME_EXIT_SHELL); }
static void do_logout(void *opaque, prop_event_t event, ...) { showtime_shutdown(SHOWTIME_EXIT_LOGOUT); }
static void do_power_off(void *opaque, prop_event_t event, ...) { showtime_shutdown(SHOWTIME_EXIT_POWEROFF); }