Improve state output in pinos-monitor

Make a method to return the string representation of the states and
use that in pinos-monitor to improve output
This commit is contained in:
Wim Taymans 2015-09-30 10:50:45 +02:00
parent c75efac3f9
commit 205a471e49
7 changed files with 86 additions and 3 deletions

View file

@ -402,6 +402,25 @@ pinos_stream_init (PinosStream * stream)
priv->state = PINOS_STREAM_STATE_UNCONNECTED;
}
/**
* pinos_stream_state_as_string:
* @state: a #PinosStreamState
*
* Return the string representation of @state.
*
* Returns: the string representation of @state.
*/
const gchar *
pinos_stream_state_as_string (PinosStreamState state)
{
GEnumValue *val;
val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_STREAM_STATE)),
state);
return val == NULL ? "invalid-state" : val->value_nick;
}
/**
* pinos_stream_new:
* @context: a #PinosContext