mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	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:
		
							parent
							
								
									c75efac3f9
								
							
						
					
					
						commit
						205a471e49
					
				
					 7 changed files with 86 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -229,6 +229,25 @@ pinos_context_get_client_info_by_id (PinosContext *context,
 | 
			
		|||
  cb (context, NULL, user_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * pinos_source_state_as_string:
 | 
			
		||||
 * @state: a #PinosSourceState
 | 
			
		||||
 *
 | 
			
		||||
 * Return the string representation of @state.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: the string representation of @state.
 | 
			
		||||
 */
 | 
			
		||||
const gchar *
 | 
			
		||||
pinos_source_state_as_string (PinosSourceState state)
 | 
			
		||||
{
 | 
			
		||||
  GEnumValue *val;
 | 
			
		||||
 | 
			
		||||
  val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_SOURCE_STATE)),
 | 
			
		||||
                          state);
 | 
			
		||||
 | 
			
		||||
  return val == NULL ? "invalid-state" : val->value_nick;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
source_fill_info (PinosSourceInfo *info, GDBusProxy *proxy)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -325,6 +344,25 @@ pinos_context_get_source_info_by_id (PinosContext *context,
 | 
			
		|||
  cb (context, NULL, user_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * pinos_source_output_state_as_string:
 | 
			
		||||
 * @state: a #PinosSourceOutputState
 | 
			
		||||
 *
 | 
			
		||||
 * Return the string representation of @state.
 | 
			
		||||
 *
 | 
			
		||||
 * Returns: the string representation of @state.
 | 
			
		||||
 */
 | 
			
		||||
const gchar *
 | 
			
		||||
pinos_source_output_state_as_string (PinosSourceOutputState state)
 | 
			
		||||
{
 | 
			
		||||
  GEnumValue *val;
 | 
			
		||||
 | 
			
		||||
  val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_SOURCE_OUTPUT_STATE)),
 | 
			
		||||
                          state);
 | 
			
		||||
 | 
			
		||||
  return val == NULL ? "invalid-state" : val->value_nick;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
source_output_fill_info (PinosSourceOutputInfo *info, GDBusProxy *proxy)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue