SCTC
the soundcloud.com terminal client
Data Structures | Macros | Functions | Variables
state.c File Reference
#include "_hard_config.h"
#include "state.h"
#include "helper.h"
#include "log.h"
Include dependency graph for state.c:

Data Structures

struct  track_list_state
 
struct  current_playback
 

Macros

#define CALL_CALLBACK(EVT)   { if(callbacks[EVT]) {callbacks[EVT]();} }
 

Functions

size_t state_get_current_list ()
 Get the id of the currently displayed list. More...
 
size_t state_get_current_selected ()
 
size_t state_get_current_position ()
 
size_t state_get_old_selected ()
 
struct track_liststate_get_list (size_t id)
 Get the track_list for a specific id. More...
 
enum repeat state_get_repeat ()
 Get the current repeat state. More...
 
char * state_get_title_text ()
 Get the current text in the title bar. More...
 
char * state_get_status_text ()
 Get the current text in the status bar. More...
 
enum color state_get_status_color ()
 Get the current color of the text in the status bar. More...
 
char * state_get_tb_text ()
 Get the text of the currently visible textbox. More...
 
char * state_get_tb_title ()
 Get the title of the currently visible textbox. More...
 
size_t state_get_tb_pos ()
 
char * state_get_input ()
 
struct commandstate_get_commands ()
 
size_t state_get_current_time ()
 
size_t state_get_sugg_selected ()
 
void state_set_commands (struct command *commands)
 
void state_set_current_list (size_t list)
 
void state_add_list (struct track_list *_list)
 
void state_set_repeat (enum repeat repeat)
 
void state_set_title (char *text)
 
void state_set_current_time (size_t time)
 
void state_set_sugg_selected (size_t selected)
 
void state_set_tb_pos (size_t pos)
 
void state_set_current_playback (size_t list, size_t track)
 
size_t state_get_current_playback_list ()
 
size_t state_get_current_playback_track ()
 
void state_set_current_selected (size_t selected)
 
void state_set_current_position (size_t pos)
 
void state_set_current_selected_rel (int delta)
 
void state_set_tb_pos_rel (int delta)
 
void state_set_status (enum color color, char *text)
 
void state_set_tb (char *title, char *text)
 
void state_register_callback (enum callback_event evt, void(*cb)(void))
 
bool state_init ()
 Global initialization of the internal state of SCTC. More...
 
bool state_finalize ()
 Global finalization of the internal state of SCTC. More...
 

Variables

static struct track_list_state lists [MAX_LISTS]
 
void(* callbacks [callback_event_size])(void) = {NULL}
 
static struct current_playback current_playback = {.list = ~0, .track = ~0}
 
static size_t _current_list = 0
 the index in lists of the currently displayed list (default: 0) More...
 
static enum repeat _repeat = rep_none
 the repeat state, one out of (none, one, all) More...
 
static char * _title_text = NULL
 
static char * _status_text = NULL
 
static enum color _status_color
 
static size_t _current_time = 0
 
static char * _tb_title = NULL
 
static char * _tb_text = NULL
 
static size_t _tb_pos = 0
 
static size_t _tb_old_pos = 0
 
static size_t _sugg_selected = 0
 
static char * _input = NULL
 
struct command_commands = NULL
 

Macro Definition Documentation

#define CALL_CALLBACK (   EVT)    { if(callbacks[EVT]) {callbacks[EVT]();} }

Function Documentation

void state_add_list ( struct track_list _list)

Here is the caller graph for this function:

bool state_finalize ( )

Global finalization of the internal state of SCTC.

This function is required to be called prior to termination of SCTC. Do not use any state_* after calling this function.

Returns
true in case of success, false otherwise

Here is the caller graph for this function:

bool state_init ( )

Global initialization of the internal state of SCTC.

This function is required to be called prior to the first call to any other state_* function.

Returns
true in case of success, false otherwise

Here is the caller graph for this function:

void state_register_callback ( enum callback_event  evt,
void(*)(void)  cb 
)

Here is the caller graph for this function:

Variable Documentation

struct command* _commands = NULL
size_t _current_list = 0
static

the index in lists of the currently displayed list (default: 0)

size_t _current_time = 0
static
char* _input = NULL
static
enum repeat _repeat = rep_none
static

the repeat state, one out of (none, one, all)

enum color _status_color
static
char* _status_text = NULL
static
size_t _sugg_selected = 0
static
size_t _tb_old_pos = 0
static
size_t _tb_pos = 0
static
char* _tb_text = NULL
static
char* _tb_title = NULL
static
char* _title_text = NULL
static
void(* callbacks[callback_event_size])(void) = {NULL}
struct current_playback current_playback = {.list = ~0, .track = ~0}
static
struct track_list_state lists[MAX_LISTS]
static