+static bool IsMenuEmpty( char *psz_var, vlc_object_t *p_object,
+ bool b_root = TRUE )
+{
+ vlc_value_t val, val_list;
+ int i_type, i_result, i;
+
+ /* Check the type of the object variable */
+ i_type = var_Type( p_object, psz_var );
+
+ /* Check if we want to display the variable */
+ if( !(i_type & VLC_VAR_HASCHOICE) ) return FALSE;
+
+ var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
+ if( val.i_int == 0 ) return TRUE;
+
+ if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE )
+ {
+ if( val.i_int == 1 && b_root ) return TRUE;
+ else return FALSE;
+ }
+
+ /* Check children variables in case of VLC_VAR_VARIABLE */
+ if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
+ {
+ return TRUE;
+ }
+
+ for( i = 0, i_result = TRUE; i < val_list.p_list->i_count; i++ )
+ {
+ if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
+ p_object, FALSE ) )
+ {
+ i_result = FALSE;
+ break;
+ }
+ }
+
+ /* clean up everything */
+ var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, NULL );
+
+ return i_result;
+}
+